Skip to content

Commit

Permalink
Merge pull request #4517 from asanchezr/release/uat_is94
Browse files Browse the repository at this point in the history
UAT Release - IS93 and IS94
  • Loading branch information
FuriousLlama authored Dec 5, 2024
2 parents d5019db + ff6ddb0 commit 063fa1e
Show file tree
Hide file tree
Showing 945 changed files with 197,252 additions and 11,914 deletions.
52 changes: 36 additions & 16 deletions .github/workflows/api-dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ jobs:
build-backend:
needs: check-changes
if: ${{ needs.check-changes.outputs.backend == 'true' }}
runs-on: ubuntu-latest
if: ${{ needs.check-changes.outputs.backend == 'true' }}
strategy:
matrix:
services: [{directory: ./source/backend/api, solution: 'Pims.sln'}, {directory: ./source/backend/proxy, solution: 'Proxy.sln'}]
env:
working-directory: ./source/backend
working-directory: ${{ matrix.services.directory }}
solution-name: ${{ matrix.services.solution }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_BRANCH: "${{github.ref}}"
GIT_BRANCH: "${{ github.ref }}"

steps:
- uses: actions/checkout@v4
Expand All @@ -45,19 +49,20 @@ jobs:
dotnet-version: "8.0.x"

- name: Install dependencies
run: dotnet restore
run: dotnet restore ${{env.solution-name}}
working-directory: ${{env.working-directory}}

- name: Install coverlet for code coverage
run: dotnet tool install -g coverlet.console --version 1.7.2
- name: Build
run: dotnet build ${{env.solution-name}} --configuration Release --no-restore
working-directory: ${{env.working-directory}}

- name: Build
run: dotnet build --configuration Release --no-restore
- name: Install coverlet for code coverage
run: dotnet tool install -g coverlet.console --version 1.7.2
working-directory: ${{env.working-directory}}

- name: Test
run: dotnet test --no-restore --verbosity normal
if: ${{ env.solution-name == 'Pims.sln' }}
run: dotnet test Pims.sln --no-restore --verbosity normal
working-directory: ${{env.working-directory}}

# For future reference, if we have N test projects the flow of events would be:
Expand All @@ -84,46 +89,54 @@ jobs:
#
# The final `coverage.opencover.xml` is the one we want
- name: Generate code coverage
working-directory: ${{env.working-directory}}/tests/unit
if: ${{ env.solution-name == 'Pims.sln' }}
working-directory: ${{env.working-directory}}/../tests/unit
run: |
pwd
mkdir -p TestResults
rm -rf api/TestResults
rm -rf dal/TestResults
rm -rf mockdal/TestResults
cd api
dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore
dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore > out.txt
ls
cat out.txt
mv TestResults/*/* ../TestResults/
cd ..
cd dal
dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore
ls
mv TestResults/*/* ../TestResults/
cd ..
cd mockdal
dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore
ls
mv TestResults/*/* ../TestResults/
cd ..
head TestResults/coverage.opencover.xml
- name: Save PR number and scan results
if: ${{ env.solution-name == 'Pims.sln' }}
run: |
mkdir -p ./pr
echo ${{ github.event.pull_request.number }} > ./pr/NR
cp ${{env.working-directory}}/tests/unit/TestResults/coverage.opencover.xml ./pr
cp ${{env.working-directory}}/../tests/unit/TestResults/coverage.opencover.xml ./pr
- uses: actions/upload-artifact@v4
if: ${{ env.solution-name == 'Pims.sln' }}
with:
name: pr-codecov
path: pr/

- name: SonarScanner for .NET 8 with pull request decoration support
id: scan
uses: highbyte/[email protected]
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' && env.solution-name == 'Pims.sln' }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
dotnetBuildArguments: ${{env.working-directory}}
dotnetTestArguments: ${{env.working-directory}} --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
dotnetBuildArguments: ${{env.working-directory}}/${{ env.solution-name }}
dotnetTestArguments: ${{env.working-directory}}/${{ env.solution-name }} --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
# Optional extra command arguments the the SonarScanner 'begin' command
sonarBeginArguments: /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/coverage.opencover.xml" -d:sonar.cs.vstest.reportsPaths="**/TestResults/*.trx" -d:sonar.qualitygate.wait=true
# The key of the SonarQube project
Expand All @@ -132,7 +145,14 @@ jobs:
sonarProjectName: PIMS-API
# The SonarQube server URL. For SonarCloud, skip this setting.
sonarHostname: ${{secrets.SONAR_URL}}

post-build:
needs: build-backend
runs-on: ubuntu-latest
env:
working-directory: ./source/backend
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_BRANCH: "${{github.ref}}"
steps:
# Send notifications only if MS_TEAMS_NOTIFY_URL secret has been set
- name: Failure notification to Teams Channel
env:
Expand Down
37 changes: 28 additions & 9 deletions .github/workflows/ci-cd-pims-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:
TAG_DEV: "dev"
TAG_TEST: "test"
TAG_PROD: "prod"
DEPLOYMENT_NAMESPACE: "3cd915-dev"

on:
pull_request_target:
Expand Down Expand Up @@ -78,12 +79,13 @@ jobs:
openshift_token: ${{ env.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ env.OPENSHIFT_TOOLS_NAMESPACE }}
- name: Call script to build backend (pims-api)
- name: Call script to build backend services
run: |
./openshift/4.0/player.sh build api -apply
./openshift/4.0/player.sh build proxy -apply
deploy:
name: Deploy frontend and api to OpenShift
name: Deploy to OpenShift
needs: [build-frontend, build-api]
runs-on: ubuntu-latest
steps:
Expand All @@ -96,10 +98,27 @@ jobs:
openshift_token: ${{ env.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ env.OPENSHIFT_TOOLS_NAMESPACE }}
- name: call scripts to deploy api and frontend
- name: Deploy PIMS frontend
shell: bash
run: |
oc tag pims-app:latest-$DESTINATION pims-app:$DESTINATION
oc -n $DEPLOYMENT_NAMESPACE rollout restart deployment/pims-app-$DESTINATION
oc -n $DEPLOYMENT_NAMESPACE rollout status --timeout=600s deployment/pims-app-$DESTINATION
- name: Deploy PIMS api
shell: bash
run: |
oc tag pims-api:latest-$DESTINATION pims-api:$DESTINATION
oc -n $DEPLOYMENT_NAMESPACE rollout restart deployment/pims-api-$DESTINATION
oc -n $DEPLOYMENT_NAMESPACE rollout status --timeout=600s deployment/pims-api-$DESTINATION
- name: Deploy geoserver proxy microservice
shell: bash
run: |
oc tag pims-proxy:latest-$DESTINATION pims-proxy:$DESTINATION
oc -n $DEPLOYMENT_NAMESPACE rollout restart deployment/pims-proxy-$DESTINATION
oc -n $DEPLOYMENT_NAMESPACE rollout status --timeout=600s deployment/pims-proxy-$DESTINATION
- name: Deploy mayan
shell: bash
run: |
./openshift/4.0/player.sh deploy api $DESTINATION -apply
./openshift/4.0/player.sh deploy app $DESTINATION -apply
oc tag mayan-bcgov:latest-$DESTINATION mayan-bcgov:$DESTINATION
# the command:
Expand Down Expand Up @@ -127,8 +146,8 @@ jobs:
oc wait --for=condition=complete job/$JOB_NAME --timeout=120s
oc get pods -o custom-columns=POD:.metadata.name --no-headers | grep -Eo $JOB_NAME-[^\s].* | (read POD_NAME; oc logs $POD_NAME)
## Call the mayan sync task three times, once for each mayan sync endpoint. The task will wait for the job to complete before exiting.
## Note: this depends on the mayan-sync configmap for the target namespace being up to date.
## Call the mayan sync task three times, once for each mayan sync endpoint. The task will wait for the job to complete before exiting.
## Note: this depends on the mayan-sync configmap for the target namespace being up to date.
mayan-sync:
name: sync mayan
needs: database-upgrade
Expand All @@ -150,7 +169,7 @@ jobs:
oc process -f ./openshift/4.0/templates/jobs/mayan-sync.yaml -p NAMESPACE=3cd915-dev -p TOKEN_URL=https://dev.loginproxy.gov.bc.ca:443/auth/realms/standard/protocol/openid-connect/token -p CLIENT_ID=property-services-project-api-dev-only-4700 -p MAYAN_SYNC_URL=https://pims-app-3cd915-dev.apps.silver.devops.gov.bc.ca:443/api/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)
oc process -f ./openshift/4.0/templates/jobs/mayan-sync.yaml -p NAMESPACE=3cd915-dev -p TOKEN_URL=https://dev.loginproxy.gov.bc.ca:443/auth/realms/standard/protocol/openid-connect/token -p CLIENT_ID=property-services-project-api-dev-only-4700 -p MAYAN_SYNC_URL=https://pims-app-3cd915-dev.apps.silver.devops.gov.bc.ca:443/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)
## Call the tekton pipeline that executes the keycloak sync. Dependent on the pims-api being accessible. Can run in parallel with the mayan sync.
## Call the tekton pipeline that executes the keycloak sync. Dependent on the pims-api being accessible. Can run in parallel with the mayan sync.
keycloak-sync:
name: sync keycloak
needs: database-upgrade
Expand All @@ -168,7 +187,7 @@ jobs:
- name: call scripts to sync keycloak
shell: bash
run: |
oc process -f ./openshift/4.0/templates/jobs/keycloak-sync-pipeline-run.yaml -p ASPNETCORE_ENVIRONMENT=$ASPNETCORE_ENVIRONMENT -p NAMESPACE=3cd915-dev -p BRANCH=$DESTINATION -p API_URL=http://pims-api:8080/api | oc create -f - | grep -oP "(?<=\/)[^\s]*" | (read PIPELINE_NAME; oc wait --for=condition=succeeded pipelineruns/$PIPELINE_NAME --timeout=500s)
oc process -f ./openshift/4.0/templates/jobs/keycloak-sync-pipeline-run.yaml -p ASPNETCORE_ENVIRONMENT=$ASPNETCORE_ENVIRONMENT -p NAMESPACE=3cd915-dev -p BRANCH=$DESTINATION -p API_URL=http://pims-api-dev:8080/api | oc create -f - | grep -oP "(?<=\/)[^\s]*" | (read PIPELINE_NAME; oc wait --for=condition=succeeded pipelineruns/$PIPELINE_NAME --timeout=500s)
ci-cd-end-notification:
name: CI-CD End Notification to Teams Channel
Expand Down
142 changes: 0 additions & 142 deletions .github/workflows/ci-cd-pims-master.yml

This file was deleted.

Loading

0 comments on commit 063fa1e

Please sign in to comment.