From 93818b0e5fb2de813223a0118cecc7c9198b0bb9 Mon Sep 17 00:00:00 2001 From: Herman Jensen Date: Tue, 24 Oct 2023 21:16:36 +0200 Subject: [PATCH] chore: refresh dotnet --- dotnet/iwebapi/.gitlab-ci.yml | 47 +++++++++---------- .../Company.WebApplication1.csproj | 16 +++---- dotnet/iworker/.gitlab-ci.yml | 47 +++++++++---------- .../Company.Worker1/Company.Worker1.csproj | 10 ++-- 4 files changed, 59 insertions(+), 61 deletions(-) diff --git a/dotnet/iwebapi/.gitlab-ci.yml b/dotnet/iwebapi/.gitlab-ci.yml index 21eeea85..f3d1d871 100644 --- a/dotnet/iwebapi/.gitlab-ci.yml +++ b/dotnet/iwebapi/.gitlab-ci.yml @@ -48,29 +48,26 @@ analyze: image: ghcr.io/nosinovacao/dotnet-sonar:latest script: - dotnet restore - - dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin + - dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin /k:$SONAR_PROJECT /d:sonar.host.url=$SONAR_HOST_URL /d:sonar.login=$SONAR_TOKEN /d:sonar.cs.opencover.reportsPaths=IntegrationTests/coverage.opencover.xml /name:$SONAR_PROJECT - - dotnet build + - dotnet build - dotnet /sonar-scanner/SonarScanner.MSBuild.dll end - /d:sonar.login=$SONAR_TOKEN + /d:sonar.login=$SONAR_TOKEN allow_failure: true retry: 2 needs: [] -image:dev: +image:create: stage: image image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] - variables: - IMAGE_TAG: dev - IMAGE_VERSION: $CI_PIPELINE_IID environment: - name: Development + name: $ENVIRONMENT_NAME action: prepare script: - echo $DOCKER_AUTH_CONFIG > /kaniko/.docker/config.json @@ -80,18 +77,18 @@ image:dev: --destination $CI_REGISTRY_IMAGE:$IMAGE_TAG --destination $CI_REGISTRY_IMAGE:$IMAGE_VERSION rules: - - if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "main"' - needs: [ "build" ] - -image:prod: - extends: image:dev - variables: - IMAGE_TAG: latest - IMAGE_VERSION: $CI_COMMIT_TAG - environment: - name: Production - rules: - - if: '$CI_COMMIT_TAG' + - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" + variables: + ENVIRONMENT_NAME: Development + IMAGE_TAG: dev + IMAGE_VERSION: $CI_PIPELINE_IID + - if: "$CI_COMMIT_TAG" + variables: + ENVIRONMENT_NAME: Production + IMAGE_TAG: latest + IMAGE_VERSION: $CI_COMMIT_TAG + needs: + - build # --- deployment --- deploy:dev: @@ -122,9 +119,12 @@ deploy:dev: --set secrets.Sentry__Dsn=$SENTRY_DSN --set config.ASPNETCORE_ENVIRONMENT=$CI_ENVIRONMENT_NAME rules: - - if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "main"' - needs: [ "test", "image:dev" ] + - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" + needs: + - test + - image:create +# example production deployment job, remove the dot to enable .deploy:prod: extends: deploy:dev variables: @@ -134,6 +134,5 @@ deploy:dev: name: Production url: https://$CI_PROJECT_NAME.apps.int.intility.no rules: - - if: '$CI_COMMIT_TAG' + - if: "$CI_COMMIT_TAG" when: manual - needs: [ "test", "image:prod" ] diff --git a/dotnet/iwebapi/Company.WebApplication1/Company.WebApplication1.csproj b/dotnet/iwebapi/Company.WebApplication1/Company.WebApplication1.csproj index 5192de30..31e774fc 100644 --- a/dotnet/iwebapi/Company.WebApplication1/Company.WebApplication1.csproj +++ b/dotnet/iwebapi/Company.WebApplication1/Company.WebApplication1.csproj @@ -12,14 +12,14 @@ $(NoWarn);1591 - - - - - + + + + + - - - + + + diff --git a/dotnet/iworker/.gitlab-ci.yml b/dotnet/iworker/.gitlab-ci.yml index 2f1cbb23..bea6e097 100644 --- a/dotnet/iworker/.gitlab-ci.yml +++ b/dotnet/iworker/.gitlab-ci.yml @@ -48,29 +48,26 @@ analyze: image: ghcr.io/nosinovacao/dotnet-sonar:latest script: - dotnet restore - - dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin + - dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin /k:$SONAR_PROJECT /d:sonar.host.url=$SONAR_HOST_URL /d:sonar.login=$SONAR_TOKEN /d:sonar.cs.opencover.reportsPaths=IntegrationTests/coverage.opencover.xml /name:$SONAR_PROJECT - - dotnet build + - dotnet build - dotnet /sonar-scanner/SonarScanner.MSBuild.dll end - /d:sonar.login=$SONAR_TOKEN + /d:sonar.login=$SONAR_TOKEN allow_failure: true retry: 2 needs: [] -image:dev: +image:create: stage: image image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] - variables: - IMAGE_TAG: dev - IMAGE_VERSION: $CI_PIPELINE_IID environment: - name: Development + name: $ENVIRONMENT_NAME action: prepare script: - echo $DOCKER_AUTH_CONFIG > /kaniko/.docker/config.json @@ -80,18 +77,18 @@ image:dev: --destination $CI_REGISTRY_IMAGE:$IMAGE_TAG --destination $CI_REGISTRY_IMAGE:$IMAGE_VERSION rules: - - if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "main"' - needs: [ "build" ] - -image:prod: - extends: image:dev - variables: - IMAGE_TAG: latest - IMAGE_VERSION: $CI_COMMIT_TAG - environment: - name: Production - rules: - - if: '$CI_COMMIT_TAG' + - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" + variables: + ENVIRONMENT_NAME: Development + IMAGE_TAG: dev + IMAGE_VERSION: $CI_PIPELINE_IID + - if: "$CI_COMMIT_TAG" + variables: + ENVIRONMENT_NAME: Production + IMAGE_TAG: latest + IMAGE_VERSION: $CI_COMMIT_TAG + needs: + - build # --- deployment --- deploy:dev: @@ -123,9 +120,12 @@ deploy:dev: --set secrets.Sentry__Dsn=$SENTRY_DSN --set config.DOTNET_ENVIRONMENT=$CI_ENVIRONMENT_NAME rules: - - if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "main"' - needs: [ "test", "image:dev" ] + - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" + needs: + - test + - image:create +# example production deployment job, remove the dot to enable .deploy:prod: extends: deploy:dev variables: @@ -133,6 +133,5 @@ deploy:dev: environment: name: Production rules: - - if: '$CI_COMMIT_TAG' + - if: "$CI_COMMIT_TAG" when: manual - needs: [ "test", "image:prod" ] diff --git a/dotnet/iworker/Company.Worker1/Company.Worker1.csproj b/dotnet/iworker/Company.Worker1/Company.Worker1.csproj index e6c1d819..a506ed87 100644 --- a/dotnet/iworker/Company.Worker1/Company.Worker1.csproj +++ b/dotnet/iworker/Company.Worker1/Company.Worker1.csproj @@ -10,11 +10,11 @@ - + - - - - + + + +