From 5c1eea7c48ff3fd0f5ea858fd1ce8d194c411b2b Mon Sep 17 00:00:00 2001 From: Michael Olund Date: Thu, 25 Apr 2024 15:37:10 -0700 Subject: [PATCH 1/7] Update build-dev.yaml --- .github/workflows/build-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index dd35a680a..2ce0e23d1 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -207,7 +207,7 @@ jobs: path_context: "src/scheduler" builder_image: ${{ env.BUILDER_IMAGE }} image: ${{ secrets.OPENSHIFT_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} - tags: latest ${{ env.SHORT_SHA }} + tags: latest ${{ env.SHORT_SHA }} {{ secrets.OPENSHIFT_LICENSE_PLATE }} - name: Push Docker image run: docker push --all-tags ${{ steps.build_image.outputs.image }} From 201435c16197bb442d84770d4b31fbec35c4b66c Mon Sep 17 00:00:00 2001 From: Michael Olund Date: Thu, 25 Apr 2024 15:40:33 -0700 Subject: [PATCH 2/7] Update build-dev.yaml --- .github/workflows/build-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 2ce0e23d1..089e2bf19 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -207,7 +207,7 @@ jobs: path_context: "src/scheduler" builder_image: ${{ env.BUILDER_IMAGE }} image: ${{ secrets.OPENSHIFT_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} - tags: latest ${{ env.SHORT_SHA }} {{ secrets.OPENSHIFT_LICENSE_PLATE }} + tags: latest ${{ env.SHORT_SHA }} ${{ secrets.OPENSHIFT_LICENSE_PLATE }} - name: Push Docker image run: docker push --all-tags ${{ steps.build_image.outputs.image }} From 0710a2f0c7c1a561c5c2952534ffd8d9d76de3b1 Mon Sep 17 00:00:00 2001 From: Michael Olund Date: Thu, 25 Apr 2024 15:54:50 -0700 Subject: [PATCH 3/7] Update build-dev.yaml --- .github/workflows/build-dev.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 089e2bf19..82067b149 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -207,7 +207,16 @@ jobs: path_context: "src/scheduler" builder_image: ${{ env.BUILDER_IMAGE }} image: ${{ secrets.OPENSHIFT_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} - tags: latest ${{ env.SHORT_SHA }} ${{ secrets.OPENSHIFT_LICENSE_PLATE }} + tags: latest ${{ env.SHORT_SHA }} + + - name: Set up secret file + run: | + echo $OPENSHIFT_LICENSE_PLATE >> secrets.txt + env: + OPENSHIFT_LICENSE_PLATE: ${{secrets.OPENSHIFT_LICENSE_PLATE}} + + - name: Run tmate + uses: mxschmitt/action-tmate@v2 - name: Push Docker image run: docker push --all-tags ${{ steps.build_image.outputs.image }} From 41c52e47ced54c9fd9dc5a4088858f1b292c1427 Mon Sep 17 00:00:00 2001 From: Michael Olund Date: Thu, 25 Apr 2024 16:02:53 -0700 Subject: [PATCH 4/7] Update build-dev.yaml --- .github/workflows/build-dev.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 82067b149..243468a2c 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -212,8 +212,18 @@ jobs: - name: Set up secret file run: | echo $OPENSHIFT_LICENSE_PLATE >> secrets.txt + echo $OPENSHIFT_EXTERNAL_REPOSITORY >> secrets.txt + echo $OPENSHIFT_SA_PASSWORD >> secrets.txt + echo $OPENSHIFT_SA_USERNAME >> secrets.txt + echo $OPENSHIFT_SERVER_URL >> secrets.txt + echo $OPENSHIFT_SERVICE_TOKEN >> secrets.txt env: - OPENSHIFT_LICENSE_PLATE: ${{secrets.OPENSHIFT_LICENSE_PLATE}} + OPENSHIFT_EXTERNAL_REPOSITORY: ${{secrets.OPENSHIFT_EXTERNAL_REPOSITORY}} + OPENSHIFT_LICENSE_PLATE: ${{secrets.OPENSHIFT_LICENSE_PLATE}} + OPENSHIFT_SA_PASSWORD: ${{secrets.OPENSHIFT_SA_PASSWORD}} + OPENSHIFT_SA_USERNAME: ${{secrets.OPENSHIFT_SA_USERNAME}} + OPENSHIFT_SERVER_URL: ${{secrets.OPENSHIFT_SERVER_URL}} + OPENSHIFT_SERVICE_TOKEN: ${{secrets.OPENSHIFT_SERVICE_TOKEN}} - name: Run tmate uses: mxschmitt/action-tmate@v2 From b383518d3f1dcec1995f36cf4625622ab202397e Mon Sep 17 00:00:00 2001 From: Michael Olund Date: Thu, 25 Apr 2024 16:05:47 -0700 Subject: [PATCH 5/7] Update build-dev.yaml --- .github/workflows/build-dev.yaml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 243468a2c..dd35a680a 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -209,25 +209,6 @@ jobs: image: ${{ secrets.OPENSHIFT_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} tags: latest ${{ env.SHORT_SHA }} - - name: Set up secret file - run: | - echo $OPENSHIFT_LICENSE_PLATE >> secrets.txt - echo $OPENSHIFT_EXTERNAL_REPOSITORY >> secrets.txt - echo $OPENSHIFT_SA_PASSWORD >> secrets.txt - echo $OPENSHIFT_SA_USERNAME >> secrets.txt - echo $OPENSHIFT_SERVER_URL >> secrets.txt - echo $OPENSHIFT_SERVICE_TOKEN >> secrets.txt - env: - OPENSHIFT_EXTERNAL_REPOSITORY: ${{secrets.OPENSHIFT_EXTERNAL_REPOSITORY}} - OPENSHIFT_LICENSE_PLATE: ${{secrets.OPENSHIFT_LICENSE_PLATE}} - OPENSHIFT_SA_PASSWORD: ${{secrets.OPENSHIFT_SA_PASSWORD}} - OPENSHIFT_SA_USERNAME: ${{secrets.OPENSHIFT_SA_USERNAME}} - OPENSHIFT_SERVER_URL: ${{secrets.OPENSHIFT_SERVER_URL}} - OPENSHIFT_SERVICE_TOKEN: ${{secrets.OPENSHIFT_SERVICE_TOKEN}} - - - name: Run tmate - uses: mxschmitt/action-tmate@v2 - - name: Push Docker image run: docker push --all-tags ${{ steps.build_image.outputs.image }} From d40de3a888569960634fdeca8dcde6dcfdb4b137 Mon Sep 17 00:00:00 2001 From: Mike Olund Date: Fri, 26 Apr 2024 13:40:56 -0700 Subject: [PATCH 6/7] CM-1347: Copy github action for OpenShift Gold --- .github/workflows/build-dev-GOLD.yaml | 233 ++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 .github/workflows/build-dev-GOLD.yaml diff --git a/.github/workflows/build-dev-GOLD.yaml b/.github/workflows/build-dev-GOLD.yaml new file mode 100644 index 000000000..7d977ef0c --- /dev/null +++ b/.github/workflows/build-dev-GOLD.yaml @@ -0,0 +1,233 @@ +name: Build dev on develop & main branch push (GOLD) + +on: + push: + branches: + - alpha + - main + +concurrency: + group: build-dev-gold-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + build-cms: + runs-on: ubuntu-latest + env: + IMAGE_NAME: strapi-${{ github.ref_name }} + BUILDER_IMAGE: registry.access.redhat.com/ubi8/nodejs-18:1-32 + steps: + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Set env + run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Login to OpenShift Container Repository + uses: docker/login-action@v2 + with: + registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} + username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} + password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} + + - name: s2i Build + id: build_image + uses: redhat-actions/s2i-build@v2 + with: + path_context: "src/cms" + builder_image: ${{ env.BUILDER_IMAGE }} + image: ${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} + tags: latest ${{ env.SHORT_SHA }} + env_vars: STRAPI_ADMIN_BACKEND_URL= + + - name: Push Docker image + run: docker push --all-tags ${{ steps.build_image.outputs.image }} + + build-admin: + runs-on: ubuntu-latest + env: + IMAGE_NAME: admin-${{ github.ref_name }} + steps: + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Set env + run: | + echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "REGISTRY_IMAGE=${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV + + - name: Login to OpenShift Container Repository + uses: docker/login-action@v2 + with: + registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} + username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} + password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: npm build + run: | + npm install + npm run build + working-directory: src/admin + + - name: Docker build + run: | + docker build -t ${{ env.IMAGE_NAME }} . + docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:latest + docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:${{ env.SHORT_SHA }} + working-directory: src/admin + + - name: Push Docker image + run: docker push --all-tags ${{ env.REGISTRY_IMAGE }} + + build-public-builder: + runs-on: ubuntu-latest + env: + IMAGE_NAME: public-builder-${{ github.ref_name }} + steps: + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Set env + run: | + echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "REGISTRY_IMAGE=${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV + + - name: Login to OpenShift Container Repository + uses: docker/login-action@v2 + with: + registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} + username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} + password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} + + - name: Build and push builder image + run: | + docker build -t ${{ env.IMAGE_NAME }} -f Builder.Dockerfile . + docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:latest + docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:${{ env.SHORT_SHA }} + working-directory: src/gatsby + + - name: Push Docker image + run: docker push --all-tags ${{ env.REGISTRY_IMAGE }} + + - name: Trigger Gatsby static build workflow + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.REPO_ACCESS_TOKEN }} + event-type: publish-gatsby + client-payload: '{"env": "dev", "branch": "${{ github.ref_name }}" }' + + build-maintenance: + runs-on: ubuntu-latest + env: + IMAGE_NAME: maintenance-${{ github.ref_name }} + steps: + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Set env + run: | + echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "REGISTRY_IMAGE=${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV + + - name: Login to OpenShift Container Repository + uses: docker/login-action@v2 + with: + registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} + username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} + password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} + + - name: Docker build + run: | + docker build -t ${{ env.IMAGE_NAME }} . + docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:latest + docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:${{ env.SHORT_SHA }} + working-directory: src/maintenance + + - name: Push Docker image + run: docker push --all-tags ${{ env.REGISTRY_IMAGE }} + + build-etl: + runs-on: ubuntu-latest + env: + IMAGE_NAME: etl-${{ github.ref_name }} + BUILDER_IMAGE: registry.access.redhat.com/ubi8/nodejs-18:1-32 + steps: + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Set env + run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Login to OpenShift Container Repository + uses: docker/login-action@v2 + with: + registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} + username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} + password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} + + - name: s2i Build + id: build_image + uses: redhat-actions/s2i-build@v2 + with: + path_context: "src/etl" + builder_image: ${{ env.BUILDER_IMAGE }} + image: ${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} + tags: latest ${{ env.SHORT_SHA }} + + - name: Push Docker image + run: docker push --all-tags ${{ steps.build_image.outputs.image }} + build-scheduler: + runs-on: ubuntu-latest + env: + IMAGE_NAME: scheduler-${{ github.ref_name }} + BUILDER_IMAGE: registry.access.redhat.com/ubi8/nodejs-18:1-32 + steps: + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Set env + run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Login to OpenShift Container Repository + uses: docker/login-action@v2 + with: + registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} + username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} + password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} + + - name: s2i Build + id: build_image + uses: redhat-actions/s2i-build@v2 + with: + path_context: "src/scheduler" + builder_image: ${{ env.BUILDER_IMAGE }} + image: ${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} + tags: latest ${{ env.SHORT_SHA }} + + - name: Push Docker image + run: docker push --all-tags ${{ steps.build_image.outputs.image }} + + deploy: + runs-on: ubuntu-latest + needs: [build-cms, build-admin] + steps: + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Login OpenShift + uses: redhat-actions/oc-login@v1 + with: + openshift_server_url: ${{ secrets.OPENSHIFT_GOLD_SERVER_URL }} + openshift_token: ${{ secrets.OPENSHIFT_GOLD_SERVICE_TOKEN }} + + - name: Trigger rollout + run: | + oc -n ${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-dev rollout restart deployment ${{ github.ref_name }}-admin + oc -n ${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-dev rollout restart deployment ${{ github.ref_name }}-cms + oc -n ${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-dev rollout restart deployment ${{ github.ref_name }}-maintenance + oc -n ${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-dev rollout restart deployment ${{ github.ref_name }}-scheduler From 90c9b7d36904ff6100c92096d956cb71081c0b0d Mon Sep 17 00:00:00 2001 From: Mike Olund Date: Fri, 26 Apr 2024 13:57:24 -0700 Subject: [PATCH 7/7] CM-1347: Remove hardcoded silver refs from dockerfiles --- src/admin/Dockerfile | 3 ++- src/gatsby/Builder.Dockerfile | 3 ++- src/gatsby/Dockerfile | 3 ++- src/maintenance/Dockerfile | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/admin/Dockerfile b/src/admin/Dockerfile index 451373974..0c0b05463 100644 --- a/src/admin/Dockerfile +++ b/src/admin/Dockerfile @@ -1,4 +1,5 @@ -FROM image-registry.apps.silver.devops.gov.bc.ca/61d198-tools/caddy:latest +#FROM image-registry.apps.silver.devops.gov.bc.ca/61d198-tools/caddy:latest +FROM caddy:2.6.2-alpine ENV APP_ROOT=/usr/share/caddy ENV XDG_CONFIG_HOME=/tmp/config diff --git a/src/gatsby/Builder.Dockerfile b/src/gatsby/Builder.Dockerfile index db0351378..49402b0bb 100644 --- a/src/gatsby/Builder.Dockerfile +++ b/src/gatsby/Builder.Dockerfile @@ -1,4 +1,5 @@ -FROM image-registry.apps.silver.devops.gov.bc.ca/61d198-tools/node:18-slim +#FROM image-registry.apps.silver.devops.gov.bc.ca/61d198-tools/node:18-slim +FROM node:18.20-slim ENV GATSBY_HOME=/gatsby diff --git a/src/gatsby/Dockerfile b/src/gatsby/Dockerfile index e5ee3e5db..03c900c3f 100644 --- a/src/gatsby/Dockerfile +++ b/src/gatsby/Dockerfile @@ -1,4 +1,5 @@ -FROM image-registry.apps.silver.devops.gov.bc.ca/61d198-tools/caddy:latest +#FROM image-registry.apps.silver.devops.gov.bc.ca/61d198-tools/caddy:latest +FROM caddy:2.6.2-alpine ENV APP_ROOT=/usr/share/caddy ENV XDG_CONFIG_HOME=/tmp/config diff --git a/src/maintenance/Dockerfile b/src/maintenance/Dockerfile index 276c3162c..9864e2b4b 100644 --- a/src/maintenance/Dockerfile +++ b/src/maintenance/Dockerfile @@ -1,4 +1,5 @@ -FROM image-registry.apps.silver.devops.gov.bc.ca/61d198-tools/caddy:latest +#FROM image-registry.apps.silver.devops.gov.bc.ca/61d198-tools/caddy:latest +FROM caddy:2.6.2-alpine ENV APP_ROOT=/usr/share/caddy ENV XDG_CONFIG_HOME=/tmp/config