From 13f3e7ee1133d2ab157f7ccc03fd7f2d7debfcfd Mon Sep 17 00:00:00 2001 From: Westin Miller Date: Thu, 21 Sep 2017 22:54:48 -0700 Subject: [PATCH] Jenkins only releases from master, and builds in Release only on master. Packages don't contain PDB files on master builds either. --- Jenkinsfile | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cec3b0b..921e256 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,11 @@ node { stage('Build') { currentBuild.description = bat(returnStdout: true, script: '@powershell -File Versioning/version.ps1').trim() - bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=Release /p:Platform=x64" + if (env.BRANCH_NAME == "master") { + bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=Release /p:Platform=x64" + } else { + bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=Debug /p:Platform=x64" + } } stage('Test') { @@ -42,6 +46,9 @@ node { IF EXIST bin\\package-server RMDIR /S /Q bin\\package-server xcopy bin\\x64\\Release bin\\package-server\\ del bin\\package-server\\Torch.Client*''' + if (env.BRANCH_NAME == "master") { + bat 'del bin\\package-server\\*.pdb' + } bat "powershell -Command \"Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory(\\\"\$PWD\\bin\\package-server\\\", \\\"\$PWD\\bin\\torch-server.zip\\\")\"" archiveArtifacts artifacts: 'bin/torch-server.zip', caseSensitive: false, onlyIfSuccessful: true @@ -49,18 +56,23 @@ node { IF EXIST bin\\package-client RMDIR /S /Q bin\\package-client xcopy bin\\x64\\Release bin\\package-client\\ del bin\\package-client\\Torch.Server*''' + if (env.BRANCH_NAME == "master") { + bat 'del bin\\package-client\\*.pdb' + } bat "powershell -Command \"Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory(\\\"\$PWD\\bin\\package-client\\\", \\\"\$PWD\\bin\\torch-client.zip\\\")\"" archiveArtifacts artifacts: 'bin/torch-client.zip', caseSensitive: false, onlyIfSuccessful: true archiveArtifacts artifacts: 'bin/x64/Release/Torch*', caseSensitive: false, fingerprint: true, onlyIfSuccessful: true } - gitVersion = bat(returnStdout: true, script: "@git describe --tags").trim() - gitSimpleVersion = bat(returnStdout: true, script: "@git describe --tags --abbrev=0").trim() - if (gitVersion == gitSimpleVersion) { - stage('Release') { - withCredentials([usernamePassword(credentialsId: 'torch-github', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { - powershell "& ./Jenkins/release.ps1 \"https://api.github.com/repos/TorchAPI/Torch/\" \"$gitSimpleVersion\" \"$USERNAME:$PASSWORD\" @(\"bin/torch-server.zip\", \"bin/torch-client.zip\")" + if (env.BRANCH_NAME == "master") { + gitVersion = bat(returnStdout: true, script: "@git describe --tags").trim() + gitSimpleVersion = bat(returnStdout: true, script: "@git describe --tags --abbrev=0").trim() + if (gitVersion == gitSimpleVersion) { + stage('Release') { + withCredentials([usernamePassword(credentialsId: 'torch-github', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { + powershell "& ./Jenkins/release.ps1 \"https://api.github.com/repos/TorchAPI/Torch/\" \"$gitSimpleVersion\" \"$USERNAME:$PASSWORD\" @(\"bin/torch-server.zip\", \"bin/torch-client.zip\")" + } } } }