From 474f104ab4ec12386c9233ed44880873f0741d3d Mon Sep 17 00:00:00 2001 From: Warren Christian <70002196+warrenchristian1telus@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:33:05 -0800 Subject: [PATCH] Add redis-proxy to build.yml --- .../archive/build-push-all-images.yml | 2 +- .github/workflows/build.yml | 7 ++ .github/workflows/redis-proxy.yml | 66 +++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/redis-proxy.yml diff --git a/.github/workflows/archive/build-push-all-images.yml b/.github/workflows/archive/build-push-all-images.yml index 219cc50..0bd55f7 100644 --- a/.github/workflows/archive/build-push-all-images.yml +++ b/.github/workflows/archive/build-push-all-images.yml @@ -114,7 +114,7 @@ jobs: - name: ๐Ÿ› ๏ธ Build Redis Proxy run: | cd ./config/redis - docker buildx build --build-arg GOLANG_FROM_IMAGE=${{ secrets.ARTIFACTORY_URL }}/${{ GOLANG_IMAGE }} --build-arg UBUNTU_FROM_IMAGE=${{ secrets.ARTIFACTORY_URL }}/${{ UBUNTU_IMAGE }} --tag ${{ secrets.ARTIFACTORY_URL }}/${{ env.REDIS_PROXY_NAME }}:${{ env.OPENSHIFT_DEPLOY_PROJECT }}-${{ github.ref_name }} --output=type=image,push=true --push -f ./GoLang.Dockerfile . + docker buildx build --build-arg GOLANG_FROM_IMAGE=${{ secrets.ARTIFACTORY_URL }}/${{ env.GOLANG_IMAGE }} --build-arg UBUNTU_FROM_IMAGE=${{ secrets.ARTIFACTORY_URL }}/${{ env.UBUNTU_IMAGE }} --tag ${{ secrets.ARTIFACTORY_URL }}/${{ env.REDIS_PROXY_NAME }}:${{ env.OPENSHIFT_DEPLOY_PROJECT }}-${{ github.ref_name }} --output=type=image,push=true --push -f ./GoLang.Dockerfile . - name: ๐Ÿ› ๏ธ Build Moodle Image run: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bdb065..6e00ea4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -152,6 +152,13 @@ jobs: uses: ./.github/workflows/moodle.yml secrets: inherit + redis-proxy: + name: ๐Ÿ”จ Redis Proxy + needs: [checkEnv] + if: needs.checkEnv.outputs.SKIP_BUILDS == 'NO' + uses: ./.github/workflows/redis-proxy.yml + secrets: inherit + call-cleanup-workflow: name: ๐Ÿงน๏ธ Clean-up uses: ./.github/workflows/cleanup.yml diff --git a/.github/workflows/redis-proxy.yml b/.github/workflows/redis-proxy.yml new file mode 100644 index 0000000..cedcf5a --- /dev/null +++ b/.github/workflows/redis-proxy.yml @@ -0,0 +1,66 @@ +name: Redis + +concurrency: + group: cron-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +env: + APP: moodle + USER: ${{ github.actor }} + +on: + workflow_call: + +jobs: + build-images: + name: '๐Ÿธ Build to JFrog' + runs-on: ubuntu-22.04 + if: (github.ref_name == 'dev' || github.ref_name == 'test' || github.ref_name == 'prod') + steps: + # Checkout the PR branch + - name: ๐Ÿ“ค Checkout Target Branch + uses: actions/checkout@v4 + with: + ref: dev + sparse-checkout: | + config/redis + example.env + example.versions.env + openshift/scripts + + # Login to Artifactory + - name: ๐Ÿ”‘ Login to Artifactory + uses: docker/login-action@v3 + with: + registry: ${{ secrets.ARTIFACTORY_URL }} + username: ${{ secrets.ARTIFACTORY_USER }} + password: ${{ secrets.ARTIFACTORY_PASSWORD }} + + - name: Setup Env Vars + id: dotenv + uses: falti/dotenv-action@v1 + with: + path: example.env + export-variables: true + keys-case: upper + + - name: Setup Versions Env Vars + id: dotenv_versions + uses: falti/dotenv-action@v1 + with: + path: example.versions.env + export-variables: true + keys-case: upper + + - name: ๐Ÿ› ๏ธ Pull Base Images + run: | + docker pull ${{ env.GOLANG_IMAGE }} + docker pull ${{ env.UBUNTU_IMAGE }} + + - name: ๐Ÿธ Build and Push to JFrog + run: | + docker tag ${{ env.GOLANG_IMAGE }} ${{ secrets.ARTIFACTORY_URL }}/${{ env.GOLANG_IMAGE }} + docker push ${{ secrets.ARTIFACTORY_URL }}/${{ env.GOLANG_IMAGE }} + docker tag ${{ env.UBUNTU_IMAGE }} ${{ secrets.ARTIFACTORY_URL }}/${{ env.UBUNTU_IMAGE }} + docker push ${{ secrets.ARTIFACTORY_URL }}/${{ env.UBUNTU_IMAGE }} + docker buildx build --build-arg GOLANG_FROM_IMAGE=${{ secrets.ARTIFACTORY_URL }}/${{ env.GOLANG_IMAGE }} --build-arg UBUNTU_FROM_IMAGE=${{ secrets.ARTIFACTORY_URL }}/${{ env.UBUNTU_IMAGE }} --tag ${{ secrets.ARTIFACTORY_URL }}/${{ env.REDIS_PROXY_NAME }}:${{ env.OPENSHIFT_DEPLOY_PROJECT }}-${{ github.ref_name }} --output=type=image,push=true --push -f ./GoLang.Dockerfile .