-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted DeploymentConfig to Deployment (#333)
- Loading branch information
Showing
6 changed files
with
99 additions
and
85 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 |
---|---|---|
|
@@ -17,7 +17,7 @@ env: | |
IMAGE_REGISTRY_USER: ${{ github.actor }} | ||
IMAGE_REGISTRY_PASSWORD: ${{ github.token }} | ||
|
||
SPRING_BOOT_IMAGE_NAME: educ-grad-student-graduation-api-dc | ||
SPRING_BOOT_IMAGE_NAME: educ-grad-student-graduation-api | ||
|
||
REPO_NAME: "educ-grad-student-graduation-api" | ||
APP_DOMAIN: ${{ secrets.APP_DOMAIN }} | ||
|
@@ -52,10 +52,6 @@ jobs: | |
runs-on: ubuntu-22.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 | ||
|
@@ -113,16 +109,23 @@ jobs: | |
oc login --token=${{ env.OPENSHIFT_TOKEN }} --server=${{ env.OPENSHIFT_SERVER }} | ||
oc project ${{ env.OPENSHIFT_NAMESPACE }} | ||
# Cancel any rollouts in progress | ||
oc rollout cancel dc/${{ env.SPRING_BOOT_IMAGE_NAME }} 2> /dev/null \ | ||
oc rollout cancel deployment/${{ env.SPRING_BOOT_IMAGE_NAME }} 2> /dev/null \ | ||
|| true && echo "No rollout in progress" | ||
# tag image stream | ||
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 \ | ||
|
@@ -147,14 +150,13 @@ jobs: | |
${{ vars.APP_LOG_LEVEL }} | ||
# Start rollout (if necessary) and follow it | ||
oc rollout latest dc/${{ env.SPRING_BOOT_IMAGE_NAME }} 2> /dev/null \ | ||
|| true && echo "Rollout in progress" | ||
oc logs -f dc/${{ env.SPRING_BOOT_IMAGE_NAME }} | ||
oc rollout restart deployment/${{ env.SPRING_BOOT_IMAGE_NAME }} | ||
# Get status, returns 0 if rollout is successful | ||
oc rollout status dc/${{ env.SPRING_BOOT_IMAGE_NAME }} | ||
oc rollout status deployment/${{ env.SPRING_BOOT_IMAGE_NAME }} | ||
# now hit it with a zap scan | ||
- name: ZAP Scan | ||
uses: zaproxy/[email protected] | ||
with: | ||
target: 'https://${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}.apps.silver.devops.gov.bc.ca/api/v1/api-docs' | ||
target: 'https://${{ env.REPO_NAME }}-${{ env.OPENSHIFT_NAMESPACE }}.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
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
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
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
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