Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub action fixes #131

Merged
merged 94 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
df92a77
Update frontend.dc.yaml
JavaDeveloper456788 Nov 21, 2024
ba9aa2e
Add files via upload
JavaDeveloper456788 Nov 21, 2024
19316a1
Update override-configmap-dev.sh
JavaDeveloper456788 Nov 22, 2024
b9839ea
Update update-configmap.sh
JavaDeveloper456788 Nov 22, 2024
2f654c2
Update update-configmap.sh
JavaDeveloper456788 Nov 22, 2024
0d41066
Update override-configmap-dev.sh
JavaDeveloper456788 Nov 22, 2024
063119f
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
6402397
Update frontend.dc.yaml
JavaDeveloper456788 Nov 22, 2024
9c0fcf7
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
8175472
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
85b4312
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
175d6cd
Update frontend.dc.yaml
JavaDeveloper456788 Nov 22, 2024
34f79c9
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
b98b831
Rename override-configmap-dev.sh to override-configmap.sh
JavaDeveloper456788 Nov 22, 2024
9a24246
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
8fa9a86
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
1cb6056
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
805f801
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
ef29be9
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
537beba
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
20767d8
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
92f7799
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
aefbef7
Update override-configmap.sh
JavaDeveloper456788 Nov 22, 2024
957ad09
Update frontend.dc.yaml
JavaDeveloper456788 Nov 22, 2024
d58e4d8
Update frontend.dc.yaml
JavaDeveloper456788 Nov 22, 2024
ef2a73a
Minor refactoring
cditcher Nov 22, 2024
4de76f5
Minor refactoring
cditcher Nov 22, 2024
456c824
Minor refactoring
cditcher Nov 22, 2024
734157d
Rolled change back
cditcher Nov 22, 2024
185da44
Forgot to remove configmap
cditcher Nov 22, 2024
e780c5d
Rename update-configmap.sh to update-configmap-dev.sh
JavaDeveloper456788 Nov 22, 2024
4e8475f
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
8997a0d
Rename update-configmap-dev.sh to update-configmap.sh
JavaDeveloper456788 Nov 22, 2024
56df3af
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
0bea54c
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
795b30f
Update update-configmap.sh
JavaDeveloper456788 Nov 22, 2024
3002437
Update api.dc.yaml
JavaDeveloper456788 Nov 22, 2024
8204e14
Update cas-api.dc.yaml
JavaDeveloper456788 Nov 22, 2024
e534a17
Update api.dc.yaml
JavaDeveloper456788 Nov 22, 2024
16afc30
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
859f86e
Update api.dc.yaml
JavaDeveloper456788 Nov 22, 2024
c655662
Update cas-api.dc.yaml
JavaDeveloper456788 Nov 22, 2024
14ba015
Update api.dc.yaml
JavaDeveloper456788 Nov 22, 2024
d1b6b4e
Update cas-api.dc.yaml
JavaDeveloper456788 Nov 22, 2024
b542cc3
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
9beea6c
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
d43df75
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
362775a
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
20f5f8d
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
60e087d
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
f32c6ef
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
6a2a5ed
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
8a932d0
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
9fdaeae
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
4807693
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
b86685e
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
311f8ef
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
434cba6
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 22, 2024
52e9982
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 23, 2024
5c392b7
Update update-configmap.sh
JavaDeveloper456788 Nov 23, 2024
b0334cd
Update update-configmap.sh
JavaDeveloper456788 Nov 23, 2024
6022e67
Update update-configmap.sh
JavaDeveloper456788 Nov 23, 2024
89f257d
Update api.dc.yaml
JavaDeveloper456788 Nov 23, 2024
7cfec21
Update api.dc.yaml
JavaDeveloper456788 Nov 23, 2024
5e2964b
Update cas-api.dc.yaml
JavaDeveloper456788 Nov 23, 2024
6b84bfe
Update update-configmap.sh
JavaDeveloper456788 Nov 23, 2024
648cbeb
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 23, 2024
9025e83
Update update-configmap.sh
JavaDeveloper456788 Nov 25, 2024
a063766
Update update-configmap.sh
JavaDeveloper456788 Nov 25, 2024
998ba1d
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 25, 2024
161e41b
Update frontend.dc.yaml
JavaDeveloper456788 Nov 25, 2024
5d710d1
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 25, 2024
f5f18fc
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 25, 2024
98715c8
Update frontend.dc.yaml
JavaDeveloper456788 Nov 25, 2024
d023488
Update frontend.dc.yaml
JavaDeveloper456788 Nov 25, 2024
230b62a
Update frontend.dc.yaml
JavaDeveloper456788 Nov 25, 2024
c7b43fa
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 26, 2024
eb58619
Update cas-api.dc.yaml
JavaDeveloper456788 Nov 27, 2024
ed53b79
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
e7291d8
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
6dd3198
Update cas-api.dc.yaml
JavaDeveloper456788 Nov 27, 2024
d74ec35
Update cas-api.dc.yaml
JavaDeveloper456788 Nov 27, 2024
e036af2
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
b3661d6
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
4e3223b
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
6b31371
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
af0e8f5
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
1c02c35
Update frontend.dc.yaml
JavaDeveloper456788 Nov 27, 2024
8f13618
Update frontend.dc.yaml
JavaDeveloper456788 Nov 27, 2024
3885606
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
a34b6b3
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
f68cb33
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
f4a0580
Update build.from.master.branch.deploy.to.dev.yml
JavaDeveloper456788 Nov 27, 2024
1cf3863
Update frontend.dc.yaml
JavaDeveloper456788 Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 45 additions & 62 deletions .github/workflows/build.from.master.branch.deploy.to.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
REDHAT_REGISTRY_USERNAME: '${{ secrets.REDHAT_REGISTRY_USERNAME }}'
REDHAT_REGISTRY_PASSWORD: '${{ secrets.REDHAT_REGISTRY_PASSWORD }}'

ASPNETCORE_ENVIRONMENT: 'Development'


SOURCE_REPOSITORY: 'https://github.com/bcgov/EDUC-HUB.git'
DOTNET_STARTUP_PROJECT: 'CASInterfaceService/cas-interface-service.csproj'
Expand All @@ -31,25 +31,40 @@ env:
MIN_MEM: 250Mi
MAX_MEM: 500Mi


#frontend config maps vars
APP_DEBUG: 'FALSE'
DYNAMICSBASEURL: http://ecas-api:8080/api
DOCUMENTROOT: /public
#ecas api config maps vars
ASPNETCORE_ENVIRONMENT: 'Development'
DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT: Cloud
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL: https://ecasdev.api.crm3.dynamics.com/api/data/v9.2/
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL: https://localhost
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL: https://ecasdev.crm3.dynamics.com/api/data/
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL: https://ecasdev.api.crm3.dynamics.com

#cas api config maps vars
ASPNETCORE_ENVIRONMENT_CAS: 'Production'
CAS_API_SERVER: https://cfs-systws.cas.gov.bc.ca:7026
CAS_TOKEN_URI: /ords/cas/oauth/token
CAS_INVOICE_URI: /ords/cas/cfs/apinvoice/

HOST_ROUTE: '${{ secrets.SITE_URL }}'
'on':
BRANCH: "Github_action_fixes"

CA_CERT: ${{ secrets.CA_CERT }}
CERTIFICATE: ${{ secrets.CERT }}
PRIVATE_KEY: ${{ secrets.PRIV_KEY }}

on:
workflow_dispatch:
push:
branches:
- master






jobs:
build-and-deploy-dev:
name: Build and deploy to DEV
runs-on: ubuntu-24.04
environment: dev



steps:
- name: Check for required secrets
uses: actions/github-script@v6
Expand All @@ -60,7 +75,6 @@ jobs:
OPENSHIFT_TOKEN: `${{ secrets.OPENSHIFT_TOKEN }}`,
};


const GHCR = "ghcr.io";

if (`${{ env.IMAGE_REGISTRY }}`.startsWith(GHCR)) {
Expand All @@ -72,7 +86,6 @@ jobs:
secrets["IMAGE_REGISTRY_PASSWORD"] = `${{ secrets.IMAGE_REGISTRY_PASSWORD }}`;
}


const missingSecrets = Object.entries(secrets).filter(([ name, value
]) => {
if (value.length === 0) {
Expand All @@ -83,7 +96,6 @@ jobs:
return false;
});


if (missingSecrets.length > 0) {
core.setFailed(`❌ At least one required secret is not set in the repository. \n` +
"You can add it using:\n" +
Expand All @@ -95,6 +107,7 @@ jobs:
else {
core.info(`✅ All the required secrets are set`);
}

- name: Check out repository
uses: actions/checkout@v3

Expand All @@ -107,18 +120,21 @@ jobs:
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: 4

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: '${{ env.DOCKER_ARTIFACTORY_REPO }}'
username: '${{ secrets.DOCKER_HUB_USERNAME }}'
password: '${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}'

- name: Login to REDHAT
uses: docker/login-action@v1
with:
registry: '${{ env.REDHAT_REGISTRY }}'
username: '${{ secrets.REDHAT_REGISTRY_USERNAME }}'
password: '${{ secrets.REDHAT_REGISTRY_PASSWORD }}'

- name: Check out repository
run: git clone '${{ env.SOURCE_REPOSITORY }}'

Expand All @@ -132,6 +148,7 @@ jobs:
tags: ${{ env.TAG }}
env_vars: |
DOTNET_STARTUP_PROJECT=${{env.DOTNET_STARTUP_PROJECT}}

- name: Setup and Build ecas api
id: build-image-api
uses: redhat-actions/s2i-build@v2
Expand All @@ -140,6 +157,7 @@ jobs:
builder_image: registry.redhat.io/rhel8/dotnet-60
image: '${{env.APP_NAME_API }}'
tags: ${{ env.TAG }}

- name: Setup and Build Frontend
id: build-image-frontend
uses: redhat-actions/s2i-build@v2
Expand All @@ -148,6 +166,7 @@ jobs:
builder_image: registry.redhat.io/rhscl/php-73-rhel7
image: '${{env.APP_NAME_FRONTEND }}'
tags: ${{ env.TAG }}

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
Expand All @@ -156,10 +175,7 @@ jobs:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: List docker images
run: docker images





- name: Push frontend to registry
id: push-image-frontend
uses: redhat-actions/push-to-registry@v2
Expand All @@ -169,6 +185,7 @@ jobs:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

- name: Push api to registry
id: push-image-api
uses: redhat-actions/push-to-registry@v2
Expand All @@ -178,6 +195,7 @@ jobs:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

- name: Push cas to registry
id: push-image-cas
uses: redhat-actions/push-to-registry@v2
Expand All @@ -187,7 +205,6 @@ jobs:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}


- uses: actions/checkout@v3
- name: Deploy
Expand Down Expand Up @@ -219,65 +236,31 @@ jobs:

oc tag -n ${{ env.OPENSHIFT_NAMESPACE_DEV }} ${{ steps.push-image-frontend.outputs.registry-path }} ${{ env.REPO_NAME }}-frontend:${{ env.TAG }}

echo "Frontend tag success"

oc tag -n ${{ env.OPENSHIFT_NAMESPACE_DEV }} ${{ steps.push-image-api.outputs.registry-path }} ${{env.REPO_NAME }}-api:${{ env.TAG }}

echo "Ecas API tag success"


oc tag -n ${{ env.OPENSHIFT_NAMESPACE_DEV }} ${{ steps.push-image-cas.outputs.registry-path }} ${{env.REPO_NAME }}-cas-api:${{ env.TAG }}


echo "CAS API tag success"
curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ env.BRANCH }}/openshift/update-configmap.sh | bash /dev/stdin "${{ env.REPO_NAME }}" "${{ env.OPENSHIFT_NAMESPACE_DEV }}" "${{env.APP_DEBUG}}" "${{env.DOCUMENTROOT}}" "${{ env.DYNAMICSBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT_CAS}}" "${{env.CAS_API_SERVER}}" "${{env.CAS_TOKEN_URI}}" "${{env.CAS_INVOICE_URI}}"


# Process and apply deployment template

oc process -f ./openshift/templates/ecas-frontend/frontend.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_DEV }} -p TAG=${{ env.TAG }} -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 }} -p HOST_ROUTE=${{ env.HOST_ROUTE}}\
oc process -f ./openshift/templates/ecas-frontend/frontend.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_DEV }} -p TAG=${{ env.TAG }} -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 }} -p HOST_ROUTE=${{ env.HOST_ROUTE}} -p CA_CERT="${{ env.CA_CERT }}" -p CERTIFICATE="${{ env.CERTIFICATE }}" -p PRIVATE_KEY="${{ env.PRIVATE_KEY }}"\
| oc apply -f -



oc process -f ./openshift/templates/ecas-api/api.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_DEV }} -p TAG=${{ env.TAG }} -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 }} -p HOST_ROUTE=${{ env.HOST_ROUTE }} -p ASPNETCORE_ENVIRONMENT=${{ env.ASPNETCORE_ENVIRONMENT }}\
oc process -f ./openshift/templates/ecas-api/api.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_DEV }} -p TAG=${{ env.TAG }} -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 }} -p HOST_ROUTE=${{ env.HOST_ROUTE }}\
| oc apply -f -


oc process -f ./openshift/templates/cas-api/cas-api.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_DEV }} -p TAG=${{ env.TAG }} -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 }} -p HOST_ROUTE=${{ env.HOST_ROUTE }}\
| oc apply -f -





# Start rollout (if necessary) and follow it


oc rollout latest dc/${{ env.APP_NAME_FRONTEND }} 2> /dev/null \

|| true && echo "Rollout Front End in progress"

oc rollout latest dc/${{ env.APP_NAME_API }} 2> /dev/null \

|| true && echo "Rollout ECAS API in progress"

oc rollout latest dc/${{ env.APP_NAME_CAS }} 2> /dev/null \

|| true && echo "Rollout CAS API in progress"

oc logs dc/${{ env.APP_NAME_FRONTEND }}

oc logs dc/${{ env.APP_NAME_API }}

oc logs dc/${{ env.APP_NAME_CAS }}

# Get status, returns 0 if rollout is successful

oc rollout status dc/${{ env.APP_NAME_FRONTEND }}

oc rollout status dc/${{ env.APP_NAME_API }}

oc rollout status dc/${{ env.APP_NAME_CAS }}


- name: ZAP Scan
uses: zaproxy/[email protected]
with:
Expand Down
Loading
Loading