Skip to content

Commit

Permalink
upload only if in dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
demarey committed Apr 12, 2022
1 parent 2238017 commit 84e238e
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def buildArchitecture(architecture, pharoVersion) {
}
}

//Do not deploy if in PR
if (isPullRequest()){
// Do not deploy if not in dev branch
if ( shouldNotUpload() ){
return;
}
node('linux') {
Expand Down Expand Up @@ -124,9 +124,7 @@ def notifyBuild() {
}

def cleanUploadFolderIfNeeded(launcherVersion) {
if (isPullRequest()) {
//Only upload files if not in a PR (i.e., CHANGE_ID not empty)
echo "[DO NO UPLOAD] In PR " + (env.CHANGE_ID?.trim())
if (shouldNotUpload()) {
return;
}

Expand Down Expand Up @@ -160,9 +158,7 @@ def finalizeUpload(launcherVersion) {
}

def upload(file, launcherVersion) {
if (isPullRequest()) {
//Only upload files if not in a PR (i.e., CHANGE_ID not empty)
echo "[DO NO UPLOAD] In PR " + (env.CHANGE_ID?.trim())
if (shouldNotUpload()) {
return;
}

Expand All @@ -186,6 +182,26 @@ def fileNameArchSuffix(architecture) {
return (architecture == '64') ? 'x64' : architecture
}

def shouldNotUpload() {
if (isPullRequest()) {
//Only upload files if not in a PR (i.e., CHANGE_ID not empty)
echo "[DO NO UPLOAD] In PR " + (env.CHANGE_ID?.trim())
return true
}

if (isNotDevBranch()) {
echo "[DO NO UPLOAD] In branch " + (env.BRANCH_NAME?.trim())
return true
}

// Do upload
return false
}

def isNotDevBranch() {
return env.BRANCH_NAME != "dev"
}

def isPullRequest() {
return env.CHANGE_ID != null
}
Expand Down

0 comments on commit 84e238e

Please sign in to comment.