Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
molund committed Apr 30, 2024
2 parents 9cacaa2 + 90c9b7d commit a9b42ac
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 4 deletions.
233 changes: 233 additions & 0 deletions .github/workflows/build-dev-GOLD.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion src/admin/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/gatsby/Builder.Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/gatsby/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/maintenance/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit a9b42ac

Please sign in to comment.