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

split off geoserver functionality into a microservice - update docker… #4427

Merged
merged 9 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
5 changes: 3 additions & 2 deletions .github/workflows/ci-cd-pims-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ env:
TAG_DEV: "dev"
TAG_TEST: "test"
TAG_PROD: "prod"

on:
pull_request_target:
branches: [dev]
Expand Down Expand Up @@ -78,9 +77,10 @@ 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
Expand All @@ -99,6 +99,7 @@ jobs:
- name: call scripts to deploy api and frontend
run: |
./openshift/4.0/player.sh deploy api $DESTINATION -apply
./openshift/4.0/player.sh deploy proxy $DESTINATION -apply
./openshift/4.0/player.sh deploy app $DESTINATION -apply
oc tag mayan-bcgov:latest-$DESTINATION mayan-bcgov:$DESTINATION

Expand Down
142 changes: 0 additions & 142 deletions .github/workflows/ci-cd-pims-master.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/uat_hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
- name: Call script to build backend (pims-api)
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
Expand All @@ -98,6 +99,7 @@ jobs:
- name: call scripts to deploy api and frontend
run: |
./openshift/4.0/player.sh deploy api $DESTINATION -apply
./openshift/4.0/player.sh deploy proxy $DESTINATION -apply
./openshift/4.0/player.sh deploy app $DESTINATION -apply

# the command:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/uat_pre_release_hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ jobs:
- name: Call script to build backend (pims-api)
run: |
OC_JOB_NAME=${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh build api -apply
OC_JOB_NAME=${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh build proxy -apply

deploy:
name: Deploy frontend and api to OpenShift
Expand All @@ -124,6 +125,7 @@ jobs:
- name: call scripts to deploy api and frontend
run: |
RELEASE_TAG=latest-${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh deploy api $DESTINATION -apply
RELEASE_TAG=latest-${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh deploy proxy $DESTINATION -apply
RELEASE_TAG=latest-${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh deploy app $DESTINATION -apply

# the command:
Expand Down Expand Up @@ -212,6 +214,7 @@ jobs:
VERSION=$(make version)
oc tag pims-app:uat pims-app:v${VERSION}-master
oc tag pims-api:uat pims-api:v${VERSION}-master
oc tag pims-proxy:uat pims-api:v${VERSION}-master

ci-cd-end-notification:
if: always()
Expand Down
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ services:
args:
BUILD_CONFIGURATION: Debug
env_file: source/backend/api/.env
environment:
- ASPNETCORE_ENVIRONMENT=Docker
ports:
- ${API_HTTPS_PORT:-5001}:443
- ${API_HTTP_PORT:-5000}:8080
Expand All @@ -67,6 +69,29 @@ services:
networks:
- psp

####################### Proxy #######################
proxy:
profiles:
- all
- psp
restart: on-failure:1
container_name: psp-proxy
build:
context: source/backend
dockerfile: Dockerfile.proxy
args:
BUILD_CONFIGURATION: Debug
env_file: source/backend/proxy/.env
environment:
- ASPNETCORE_ENVIRONMENT=Docker
ports:
- ${PROXY_HTTPS_PORT:-5003}:443
- ${PROXY_HTTP_PORT:-5002}:8080
depends_on:
- geoserver
networks:
- psp

####################### Frontend #######################
frontend:
profiles:
Expand Down
1 change: 0 additions & 1 deletion source/backend/.s2i/environment

This file was deleted.

Loading
Loading