From 6e8e8db12e3c77dc828b44e544b2dc609ddcc0ee Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Wed, 26 Jul 2023 16:55:18 +0200 Subject: [PATCH] jenkins --- CarbonLib.csproj | 2 +- Jenkinsfile | 49 +++++++++++++++++---------------------------- Jenkinsfile.develop | 49 +++++++++++++++++---------------------------- 3 files changed, 37 insertions(+), 63 deletions(-) diff --git a/CarbonLib.csproj b/CarbonLib.csproj index 61231c5..ed44f6a 100644 --- a/CarbonLib.csproj +++ b/CarbonLib.csproj @@ -8,7 +8,7 @@ false false false - 2.0.2 + 2.0.99 diff --git a/Jenkinsfile b/Jenkinsfile index 5724458..a2aa2a4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,42 +1,29 @@ +@Library('farmmaps-shared-library') _ + pipeline { - agent any - environment { - APP_VERSION_PREFIX=sh(script: ' cat *.csproj| xmlstarlet sel -t -m "/Project/PropertyGroup/Version" -v . -n|awk -v def="1.0.0" "{print} END { if(NR==0) {print def} }"', returnStdout: true).trim() - APP_NAME=sh(script: ' cat *.csproj| xmlstarlet sel -t -m "/Project/PropertyGroup/AssemblyName" -v . -n|awk -v def="App" "{print tolower(\\$0)} END { if(NR==0) {print def} }"', returnStdout: true).trim() - APP_VERSION="${APP_VERSION_PREFIX}" + agent any; + options { + copyArtifactPermission projectNames: env.allProjectsArtifactPermission; + } + triggers { + upstream( + upstreamProjects: '/FarmMaps/Base.Core.Common.Geometry/master', + threshold: hudson.model.Result.SUCCESS + ) } stages { - stage('Dotnet Restore') { + stage('BaseBuildAll') { steps { - sh '''dotnet restore CarbonLib.csproj''' + stepBaseBuildAll(); } } - stage('Dotnet Build') { - steps { - sh '''dotnet build CarbonLib.csproj''' - } - } - stage('Dotnet Package') { - steps { - sh '''rm -rf nuget - dotnet pack -c release -o nuget -p:PackageVersion=${APP_VERSION} CarbonLib.csproj''' - } - } - stage('Dotnet Publish') { - steps { - sh '''dotnet nuget push nuget/*.nupkg -k 0c3e3afc-935b-3db1-b023-e0d4799e674d -s https://repository.akkerweb.nl/repository/nuget-hosted/''' - } - } - } + } post { + success { + postSuccess(); + } always { - emailext ( - body: '${DEFAULT_CONTENT}', - mimeType: 'text/html', - replyTo: '${DEFAULT_REPLYTO}', - subject: '${DEFAULT_SUBJECT}', - to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']]) - ) + postAlways(); } } } \ No newline at end of file diff --git a/Jenkinsfile.develop b/Jenkinsfile.develop index f163ccc..93b96b0 100644 --- a/Jenkinsfile.develop +++ b/Jenkinsfile.develop @@ -1,42 +1,29 @@ +@Library('farmmaps-shared-library') _ + pipeline { - agent any - environment { - APP_VERSION_PREFIX=sh(script: ' cat *.csproj| xmlstarlet sel -t -m "/Project/PropertyGroup/Version" -v . -n|awk -v def="1.0.0" "{print} END { if(NR==0) {print def} }"', returnStdout: true).trim() - APP_NAME=sh(script: ' cat *.csproj| xmlstarlet sel -t -m "/Project/PropertyGroup/AssemblyName" -v . -n|awk -v def="App" "{print tolower(\\$0)} END { if(NR==0) {print def} }"', returnStdout: true).trim() - APP_VERSION="${APP_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}" + agent any; + options { + copyArtifactPermission projectNames: env.allProjectsArtifactPermission; + } + triggers { + upstream( + upstreamProjects: '/FarmMaps.Develop/Base.Core.Common.Geometry/develop', + threshold: hudson.model.Result.SUCCESS + ) } stages { - stage('Dotnet Restore') { + stage('BaseBuildAll') { steps { - sh '''dotnet restore CarbonLib.csproj''' + stepBaseBuildAll(); } } - stage('Dotnet Build'){ - steps { - sh '''dotnet build CarbonLib.csproj''' - } - } - stage('Dotnet Package') { - steps { - sh '''rm -rf nuget - dotnet pack -c debug -o nuget -p:PackageVersion=${APP_VERSION} CarbonLib.csproj''' - } - } - stage('Dotnet Publish') { - steps { - sh '''dotnet nuget push nuget/*.nupkg -k 0c3e3afc-935b-3db1-b023-e0d4799e674d -s https://repository.akkerweb.nl/repository/nuget-hosted/''' - } - } - } + } post { + success { + postSuccess(); + } always { - emailext ( - body: '${DEFAULT_CONTENT}', - mimeType: 'text/html', - replyTo: '${DEFAULT_REPLYTO}', - subject: '${DEFAULT_SUBJECT}', - to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']]) - ) + postAlways(); } } } \ No newline at end of file