5
5
OPENSHIFT_TOKEN : ${{ secrets.OPENSHIFT_TOKEN }}
6
6
OPENSHIFT_TOOLS_NAMESPACE : " 3cd915-tools"
7
7
MS_TEAMS_WEBHOOK_BUILD_CHANNEL : ${{ secrets.MS_TEAMS_WEBHOOK_URI_BUILD_CHANNEL }}
8
+ AUTH__KEYCLOAK__SECRET : ${{ secrets.KEYCLOAK_SECRET_PROD }}
9
+ AUTH__KEYCLOAK__SERVICEACCOUNT__SECRET : ${{ secrets.KEYCLOAK_SERVICEACCOUNT_SECRET }}
10
+ sync-directory : ./tools/keycloak/sync
11
+ ASPNETCORE_ENVIRONMENT : " prod"
8
12
9
13
APP_PORT : 8080
10
14
DESTINATION : " prod"
70
74
[[ -z ${{github.event.inputs.OVERRIDE_VERSION}} ]] && RELEASE_VERSION=${{steps.previoustag.outputs.tag}}-master || RELEASE_VERSION=${{github.event.inputs.OVERRIDE_VERSION}}-master
71
75
RELEASE_TAG=$RELEASE_VERSION ./openshift/4.0/player.sh deploy api $DESTINATION -apply
72
76
RELEASE_TAG=$RELEASE_VERSION ./openshift/4.0/player.sh deploy app $DESTINATION -apply
77
+
78
+ # the command:
79
+ # 1) creates an openshift job with generated name to avoid name conflict, substituting the variables in the template.
80
+ # 2) greps the generated name from the previous step.
81
+ # 3) waits for the job to complete using the generated name.
82
+ database-upgrade :
83
+ name : Upgrade database
84
+ needs : [deploy]
85
+ runs-on : ubuntu-latest
86
+ steps :
87
+ - name : Checkout Source Code
88
+ uses : actions/checkout@v3
89
+ - name : Login to OpenShift
90
+ uses : redhat-actions/oc-login@v1
91
+ with :
92
+ openshift_server_url : ${{ env.OPENSHIFT_SERVER }}
93
+ openshift_token : ${{ env.OPENSHIFT_TOKEN }}
94
+ insecure_skip_tls_verify : true
95
+ namespace : 3cd915-prod
96
+ - name : call scripts to upgrade database
97
+ shell : bash
98
+ run : |
99
+ oc process -f ./openshift/4.0/templates/jobs/db-deploy.yaml -p DB_SECRET_NAME=pims-database -p GIT_BRANCH=master -p SERVER_NAME=sqlprd.th.gov.bc.ca -p DB_NAME=PIMS_PRD -p NAMESPACE=3cd915-prod | oc create -f - | grep -oP "(?<=job\.batch/)[^\s]*" | (read JOB_NAME; oc wait --for=condition=complete job/$JOB_NAME --timeout=120s)
100
+
101
+ # # Call the mayan sync task three times, once for each mayan sync endpoint. The task will wait for the job to complete before exiting.
102
+ # # Note: this depends on the mayan-sync configmap for the target namespace being up to date.
103
+ mayan-sync :
104
+ name : sync mayan
105
+ needs : database-upgrade
106
+ runs-on : ubuntu-latest
107
+ steps :
108
+ - name : Checkout Source Code
109
+ uses : actions/checkout@v3
110
+ - name : Login to OpenShift
111
+ uses : redhat-actions/oc-login@v1
112
+ with :
113
+ openshift_server_url : ${{ env.OPENSHIFT_SERVER }}
114
+ openshift_token : ${{ env.OPENSHIFT_TOKEN }}
115
+ insecure_skip_tls_verify : true
116
+ namespace : 3cd915-prod
117
+ - name : call scripts to sync mayan
118
+ shell : bash
119
+ run : |
120
+ oc process -f ./openshift/4.0/templates/jobs/mayan-sync.yaml -p NAMESPACE=3cd915-prod -p TOKEN_URL=https://loginproxy.gov.bc.ca:443/auth/realms/standard/protocol/openid-connect/token -p CLIENT_ID=property-services-project-api-4380 -p MAYAN_SYNC_URL=https://pims-app-3cd915-prod.apps.silver.devops.gov.bc.ca/api/documents/sync/mayan/metadatatype -p KEYCLOAK_SECRET_NAME=pims-api-sso | oc create -f - | grep -oP "(?<=\/)[^\s]*" | (read TASK_NAME; oc wait --for=condition=succeeded taskruns/$TASK_NAME --timeout=80s)
121
+ oc process -f ./openshift/4.0/templates/jobs/mayan-sync.yaml -p NAMESPACE=3cd915-prod -p TOKEN_URL=https://loginproxy.gov.bc.ca:443/auth/realms/standard/protocol/openid-connect/token -p CLIENT_ID=property-services-project-api-4380 -p MAYAN_SYNC_URL=https://pims-app-3cd915-prod.apps.silver.devops.gov.bc.ca/documents/sync/documenttype -p KEYCLOAK_SECRET_NAME=pims-api-sso | oc create -f - | grep -oP "(?<=\/)[^\s]*" | (read TASK_NAME; oc wait --for=condition=succeeded taskruns/$TASK_NAME --timeout=80s)
122
+ oc process -f ./openshift/4.0/templates/jobs/mayan-sync.yaml -p NAMESPACE=3cd915-prod -p TOKEN_URL=https://loginproxy.gov.bc.ca:443/auth/realms/standard/protocol/openid-connect/token -p CLIENT_ID=property-services-project-api-4380 -p MAYAN_SYNC_URL=https://pims-app-3cd915-prod.apps.silver.devops.gov.bc.ca/api/documents/sync/mayan -p KEYCLOAK_SECRET_NAME=pims-api-sso | oc create -f - | grep -oP "(?<=\/)[^\s]*" | (read TASK_NAME; oc wait --for=condition=succeeded taskruns/$TASK_NAME --timeout=80s)
123
+
124
+ sync-keycloak :
125
+ name : Sync Keycloak
126
+ needs : database-upgrade
127
+ runs-on : ubuntu-latest
128
+ steps :
129
+ - name : Checkout Source Code
130
+ uses : actions/checkout@v3
131
+
132
+ - name : Setup .NET 8
133
+ uses : actions/setup-dotnet@v3
134
+ with :
135
+ dotnet-version : " 8.0.x"
136
+
137
+ - name : Install dependencies for keycloak sync
138
+ run : dotnet restore
139
+ working-directory : ${{env.sync-directory}}
140
+
141
+ - name : Build keycloak sync
142
+ run : dotnet build
143
+ working-directory : ${{env.sync-directory}}
144
+
145
+ - name : Start keycloak sync
146
+ run : dotnet run
147
+ working-directory : ${{env.sync-directory}}
0 commit comments