From dbd1f862a492f22e9d1eaaafe3f6ec2effd64527 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 3 Aug 2022 16:13:00 +0200 Subject: [PATCH] Update jenkins --> gitlab --- .gitlab-ci.yml | 91 ++++++++++++++++++++++++++++++ Jenkinsfile => 2review/Jenkinsfile | 0 2 files changed, 91 insertions(+) create mode 100644 .gitlab-ci.yml rename Jenkinsfile => 2review/Jenkinsfile (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..1eb80c6 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,91 @@ +variables: + NUGET_PATH: 'C:\Tools\nuget.exe' + MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe' + ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools' + EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release' + DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds' + VERS_MAIN: '4.1' + NEW_REL: '' + NEW_DEB: '' + NEXUS_PATH: 'MedAP' + PROJ_NAME: 'MedAP' + APP_NAME: 'MedAP' + APP_CONF: 'Release' + + +# helper x fix pacchetti nuget da repo locale nexus.steamware.net +.nuget-fix: &nuget-fix + - | + $hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C + if ($hasSource -eq 0) { + C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" + } else { + C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" + } + echo $hasSource + +# helper x fix version number +.version-fix: &version-fix + - | + $env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format ddHH) + echo "Set vers: $env:NEW_REL" + $contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw + $newContenuto = $contenuto -replace '000.000', $env:NEW_REL + $newContenuto | Set-Content -Path 'VersGen\VersGen.cs' + +stages: + - build + - staging + - deploy + +MedAP:build: + stage: build + tags: + - win + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore MedAP.sln -verbosity quiet' + - *version-fix + script: + - '& "$env:MSBUILD_PATH" MedAP/MedAP.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m' + +MedAP:staging: + stage: staging + tags: + - win + rules: + - if: '$CI_COMMIT_BRANCH == "develop"' + variables: + APP_NAME: MedAP_TK + PROJ_NAME: MedAP + NEXUS_PATH: MedAP + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore MedAP.sln -verbosity quiet' + - *version-fix + script: + - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS01.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal MedAP/MedAP.csproj' + # lasciato commentato in prod + # - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=DEMO-OVH.pubxml /p:RunCodeAnalysis=false /p:Configuration=DEMO-OVH /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal MedAP/MedAP.csproj' + needs: ["MedAP:build"] + +MedAP:deploy: + stage: deploy + tags: + - win + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + variables: + APP_NAME: MedAP + PROJ_NAME: MedAP + NEXUS_PATH: MedAP + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore MedAP.sln -verbosity quiet' + - *version-fix + script: + - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS02.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal MedAP/MedAP.csproj' + # lasciato commentato in prod + # - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=PROD-OVH.pubxml /p:RunCodeAnalysis=false /p:Configuration=PROD-OVH /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal MedAP/MedAP.csproj' + needs: ["MedAP:build"] + \ No newline at end of file diff --git a/Jenkinsfile b/2review/Jenkinsfile similarity index 100% rename from Jenkinsfile rename to 2review/Jenkinsfile