-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Actions
- Loading branch information
Showing
9 changed files
with
238 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build & Deploy to DEV from Developer Branch | ||
name: Build & Deploy to DEV from developer branch | ||
|
||
env: | ||
# 🖊️ EDIT your repository secrets to log into your OpenShift cluster and set up the context. | ||
|
@@ -7,6 +7,9 @@ env: | |
OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }} | ||
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }} | ||
OPENSHIFT_NAMESPACE: ${{ secrets.GRAD_NAMESPACE }}-dev | ||
COMMON_NAMESPACE: ${{ secrets.COMMON_NAMESPACE }} | ||
NAMESPACE: ${{ secrets.GRAD_NAMESPACE }} | ||
BUSINESS_NAMESPACE: ${{ secrets.GRAD_BUSINESS_NAMESPACE }} | ||
|
||
# 🖊️ EDIT to change the image registry settings. | ||
# Registries such as GHCR, Quay.io, and Docker Hub are supported. | ||
|
@@ -15,12 +18,11 @@ env: | |
IMAGE_REGISTRY_PASSWORD: ${{ github.token }} | ||
|
||
SPRING_BOOT_IMAGE_NAME: educ-grad-student-api-dc | ||
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote | ||
|
||
REPO_NAME: "educ-grad-student-api" | ||
APP_DOMAIN: ${{ secrets.APP_DOMAIN }} | ||
BRANCH: "main" | ||
TAG: "latest" | ||
#GRAD2-1947 Resource optmization | ||
MIN_CPU: "20m" | ||
MAX_CPU: "250m" | ||
MIN_MEM: "500Mi" | ||
|
@@ -36,10 +38,12 @@ on: | |
type: choice | ||
description: Choose branch to build from | ||
options: | ||
- develop/alex | ||
- develop/chris | ||
- develop/jinil | ||
- develop/km | ||
- develop/alex | ||
- develop/chris | ||
- develop/jinil | ||
- develop/km | ||
- develop/mchintha | ||
- grad-hotfix | ||
|
||
jobs: | ||
openshift-ci-cd: | ||
|
@@ -66,8 +70,8 @@ jobs: | |
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.DOCKER_ARTIFACTORY_REPO }} | ||
username: ${{ secrets.DOCKER_ARTIFACTORY_USERNAME }} | ||
registry: ${{ vars.DOCKER_ARTIFACTORY_REPO }} | ||
username: ${{ vars.DOCKER_ARTIFACTORY_USERNAME }} | ||
password: ${{ secrets.DOCKER_ARTIFACTORY_ACCESS_TOKEN }} | ||
|
||
# https://github.com/redhat-actions/buildah-build#readme | ||
|
@@ -115,8 +119,21 @@ jobs: | |
oc -n ${{ env.OPENSHIFT_NAMESPACE }} tag ${{ steps.push-image.outputs.registry-path }} ${{ env.REPO_NAME }}:${{ env.TAG }} | ||
# Process and apply deployment template | ||
oc process -f tools/openshift/api.dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=${{ env.REPO_NAME }} -p TAG_NAME=${{ env.TAG }} -p HOST_ROUTE=${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}.${{ env.APP_DOMAIN }} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} \ | ||
| oc apply -f - | ||
oc process -f tools/openshift/api.dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=${{ env.REPO_NAME }} \ | ||
-p TAG_NAME=${{ env.TAG }} -p HOST_ROUTE=${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}.${{ env.APP_DOMAIN }} \ | ||
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} \ | ||
-p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -f - | ||
# UPDATE Configmaps | ||
curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ github.event.inputs.choice }}/tools/config/update-configmap.sh \ | ||
| bash /dev/stdin \ | ||
dev \ | ||
${{ env.REPO_NAME }} \ | ||
${{ env.NAMESPACE }} \ | ||
${{ env.COMMON_NAMESPACE }} \ | ||
${{ env.BUSINESS_NAMESPACE }} \ | ||
${{ secrets.SPLUNK_TOKEN }} \ | ||
${{ vars.APP_LOG_LEVEL }} | ||
# Start rollout (if necessary) and follow it | ||
oc rollout latest dc/${{ env.SPRING_BOOT_IMAGE_NAME }} 2> /dev/null \ | ||
|
@@ -129,4 +146,4 @@ jobs: | |
- name: ZAP Scan | ||
uses: zaproxy/[email protected] | ||
with: | ||
target: 'https://${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}-dev.apps.silver.devops.gov.bc.ca/api/v1/api-docs' | ||
target: 'https://${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}-dev.apps.silver.devops.gov.bc.ca/api/v1/api-docs' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
name: Build & Deploy to DEV from main branch | ||
|
||
env: | ||
|
||
# 🖊️ EDIT your repository secrets to log into your OpenShift cluster and set up the context. | ||
# See https://github.com/redhat-actions/oc-login#readme for how to retrieve these values. | ||
# To get a permanent token, refer to https://github.com/redhat-actions/oc-login/wiki/Using-a-Service-Account-for-GitHub-Actions | ||
OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }} | ||
OPENSHIFT_SERVER: ${{ vars.OPENSHIFT_SERVER }} | ||
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }} | ||
OPENSHIFT_NAMESPACE: ${{ secrets.GRAD_NAMESPACE }}-dev | ||
OPENSHIFT_NAMESPACE: ${{ vars.GRAD_NAMESPACE }}-dev | ||
COMMON_NAMESPACE: ${{ vars.COMMON_NAMESPACE }} | ||
GRAD_NAMESPACE: ${{ vars.GRAD_NAMESPACE }} | ||
BUSINESS_NAMESPACE: ${{ vars.GRAD_BUSINESS_NAMESPACE }} | ||
|
||
# 🖊️ EDIT to change the image registry settings. | ||
# Registries such as GHCR, Quay.io, and Docker Hub are supported. | ||
|
@@ -16,12 +18,11 @@ env: | |
IMAGE_REGISTRY_PASSWORD: ${{ github.token }} | ||
|
||
SPRING_BOOT_IMAGE_NAME: educ-grad-student-api-dc | ||
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote | ||
|
||
REPO_NAME: "educ-grad-student-api" | ||
APP_DOMAIN: ${{ secrets.APP_DOMAIN }} | ||
APP_DOMAIN: ${{ vars.APP_DOMAIN }} | ||
BRANCH: "main" | ||
TAG: "latest" | ||
#GRAD2-1947 Resource optmization | ||
MIN_CPU: "20m" | ||
MAX_CPU: "250m" | ||
MIN_MEM: "500Mi" | ||
|
@@ -36,14 +37,9 @@ on: | |
jobs: | ||
openshift-ci-cd: | ||
name: Build and deploy to OpenShift DEV | ||
# ubuntu-20.04 can also be used. | ||
runs-on: ubuntu-20.04 | ||
environment: dev | ||
|
||
#outputs: | ||
#ROUTE: ${{ steps.deploy-and-expose.outputs.route }} | ||
#SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
@@ -56,8 +52,8 @@ jobs: | |
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.DOCKER_ARTIFACTORY_REPO }} | ||
username: ${{ secrets.DOCKER_ARTIFACTORY_USERNAME }} | ||
registry: ${{ vars.DOCKER_ARTIFACTORY_REPO }} | ||
username: ${{ vars.DOCKER_ARTIFACTORY_USERNAME }} | ||
password: ${{ secrets.DOCKER_ARTIFACTORY_ACCESS_TOKEN }} | ||
|
||
# https://github.com/redhat-actions/buildah-build#readme | ||
|
@@ -105,8 +101,21 @@ jobs: | |
oc -n ${{ env.OPENSHIFT_NAMESPACE }} tag ${{ steps.push-image.outputs.registry-path }} ${{ env.REPO_NAME }}:${{ env.TAG }} | ||
# Process and apply deployment template | ||
oc process -f tools/openshift/api.dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=${{ env.REPO_NAME }} -p TAG_NAME=${{ env.TAG }} -p HOST_ROUTE=${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}.${{ env.APP_DOMAIN }} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} \ | ||
| oc apply -f - | ||
oc process -f tools/openshift/api.dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=${{ env.REPO_NAME }} \ | ||
-p TAG_NAME=${{ env.TAG }} -p HOST_ROUTE=${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}.${{ env.APP_DOMAIN }} \ | ||
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} \ | ||
-p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -f - | ||
# UPDATE Configmaps | ||
curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ env.BRANCH }}/tools/config/update-configmap.sh \ | ||
| bash /dev/stdin \ | ||
dev \ | ||
${{ env.REPO_NAME }} \ | ||
${{ env.GRAD_NAMESPACE }} \ | ||
${{ env.COMMON_NAMESPACE }} \ | ||
${{ env.BUSINESS_NAMESPACE }} \ | ||
${{ secrets.SPLUNK_TOKEN }} \ | ||
${{ vars.APP_LOG_LEVEL }} | ||
# Start rollout (if necessary) and follow it | ||
oc rollout latest dc/${{ env.SPRING_BOOT_IMAGE_NAME }} 2> /dev/null \ | ||
|
@@ -119,4 +128,4 @@ jobs: | |
- name: ZAP Scan | ||
uses: zaproxy/[email protected] | ||
with: | ||
target: 'https://${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}-dev.apps.silver.devops.gov.bc.ca/api/v1/api-docs' | ||
target: 'https://${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}-dev.apps.silver.devops.gov.bc.ca/api/v1/api-docs' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,12 @@ env: | |
# 🖊️ EDIT your repository secrets to log into your OpenShift cluster and set up the context. | ||
# See https://github.com/redhat-actions/oc-login#readme for how to retrieve these values. | ||
# To get a permanent token, refer to https://github.com/redhat-actions/oc-login/wiki/Using-a-Service-Account-for-GitHub-Actions | ||
OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }} | ||
OPENSHIFT_SERVER: ${{ vars.OPENSHIFT_SERVER }} | ||
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }} | ||
OPENSHIFT_NAMESPACE: ${{ secrets.GRAD_NAMESPACE }}-dev | ||
OPENSHIFT_NAMESPACE: ${{ vars.GRAD_NAMESPACE }}-dev | ||
COMMON_NAMESPACE: ${{ vars.COMMON_NAMESPACE }} | ||
GRAD_NAMESPACE: ${{ vars.GRAD_NAMESPACE }} | ||
BUSINESS_NAMESPACE: ${{ vars.GRAD_BUSINESS_NAMESPACE }} | ||
|
||
# 🖊️ EDIT to change the image registry settings. | ||
# Registries such as GHCR, Quay.io, and Docker Hub are supported. | ||
|
@@ -15,12 +18,10 @@ env: | |
IMAGE_REGISTRY_PASSWORD: ${{ github.token }} | ||
|
||
SPRING_BOOT_IMAGE_NAME: educ-grad-student-api-dc | ||
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote | ||
|
||
REPO_NAME: "educ-grad-student-api" | ||
APP_DOMAIN: ${{ secrets.APP_DOMAIN }} | ||
APP_DOMAIN: ${{ vars.APP_DOMAIN }} | ||
BRANCH: "grad-release" | ||
TAG: "latest" | ||
#GRAD2-1947 Resource optmization | ||
MIN_CPU: "20m" | ||
MAX_CPU: "250m" | ||
MIN_MEM: "500Mi" | ||
|
@@ -41,14 +42,9 @@ on: | |
jobs: | ||
openshift-ci-cd: | ||
name: Build and deploy to OpenShift DEV from release branch | ||
# ubuntu-20.04 can also be used. | ||
runs-on: ubuntu-20.04 | ||
environment: dev | ||
|
||
#outputs: | ||
#ROUTE: ${{ steps.deploy-and-expose.outputs.route }} | ||
#SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
@@ -63,8 +59,8 @@ jobs: | |
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.DOCKER_ARTIFACTORY_REPO }} | ||
username: ${{ secrets.DOCKER_ARTIFACTORY_USERNAME }} | ||
registry: ${{ vars.DOCKER_ARTIFACTORY_REPO }} | ||
username: ${{ vars.DOCKER_ARTIFACTORY_USERNAME }} | ||
password: ${{ secrets.DOCKER_ARTIFACTORY_ACCESS_TOKEN }} | ||
|
||
# https://github.com/redhat-actions/buildah-build#readme | ||
|
@@ -112,8 +108,21 @@ jobs: | |
oc -n ${{ env.OPENSHIFT_NAMESPACE }} tag ${{ steps.push-image.outputs.registry-path }} ${{ env.REPO_NAME }}:${{ env.TAG }} | ||
# Process and apply deployment template | ||
oc process -f tools/openshift/api.dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=${{ env.REPO_NAME }} -p TAG_NAME=${{ env.TAG }} -p HOST_ROUTE=${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}.${{ env.APP_DOMAIN }} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} \ | ||
| oc apply -f - | ||
oc process -f tools/openshift/api.dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=${{ env.REPO_NAME }} \ | ||
-p TAG_NAME=${{ env.TAG }} -p HOST_ROUTE=${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}.${{ env.APP_DOMAIN }} \ | ||
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} \ | ||
-p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -f - | ||
# UPDATE Configmaps | ||
curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ env.BRANCH }}/tools/config/update-configmap.sh \ | ||
| bash /dev/stdin \ | ||
dev \ | ||
${{ env.REPO_NAME }} \ | ||
${{ env.GRAD_NAMESPACE }} \ | ||
${{ env.COMMON_NAMESPACE }} \ | ||
${{ env.BUSINESS_NAMESPACE }} \ | ||
${{ secrets.SPLUNK_TOKEN }} \ | ||
${{ vars.APP_LOG_LEVEL }} | ||
# Start rollout (if necessary) and follow it | ||
oc rollout latest dc/${{ env.SPRING_BOOT_IMAGE_NAME }} 2> /dev/null \ | ||
|
@@ -126,4 +135,4 @@ jobs: | |
- name: ZAP Scan | ||
uses: zaproxy/[email protected] | ||
with: | ||
target: 'https://${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}-dev.apps.silver.devops.gov.bc.ca/api/v1/api-docs' | ||
target: 'https://${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}-dev.apps.silver.devops.gov.bc.ca/api/v1/api-docs' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.