add cleanup steps and reduce number of builds to keep

skip github notification if no CHANGE_ID is available

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2018-12-13 10:49:16 +01:00
parent f56a500f64
commit 9f7d32b1c5
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
8 changed files with 56 additions and 23 deletions

View File

@ -8,9 +8,9 @@ pipeline {
timeout(time: 35, unit: 'MINUTES') timeout(time: 35, unit: 'MINUTES')
/* Limit builds retained */ /* Limit builds retained */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: '90', numToKeepStr: '10',
daysToKeepStr: '30', daysToKeepStr: '20',
artifactNumToKeepStr: '90', artifactNumToKeepStr: '10',
)) ))
} }
@ -97,6 +97,11 @@ pipeline {
script { cmn.gitHubNotifyPRSuccess() } script { cmn.gitHubNotifyPRSuccess() }
} }
} }
stage('Cleanup') {
steps {
script { cmn.clean() }
}
}
} }
post { post {
failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } }

View File

@ -16,9 +16,9 @@ pipeline {
timeout(time: 35, unit: 'MINUTES') timeout(time: 35, unit: 'MINUTES')
/* Limit builds retained */ /* Limit builds retained */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: '90', numToKeepStr: '10',
daysToKeepStr: '60', daysToKeepStr: '20',
artifactNumToKeepStr: '60', artifactNumToKeepStr: '10',
)) ))
} }
@ -90,6 +90,11 @@ pipeline {
script { cmn.gitHubNotifyPRSuccess() } script { cmn.gitHubNotifyPRSuccess() }
} }
} }
stage('Cleanup') {
steps {
script { cmn.clean() }
}
}
} }
post { post {
failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } }

View File

@ -29,9 +29,9 @@ pipeline {
timeout(time: 35, unit: 'MINUTES') timeout(time: 35, unit: 'MINUTES')
/* Limit builds retained */ /* Limit builds retained */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: '60', numToKeepStr: '10',
daysToKeepStr: '30', daysToKeepStr: '20',
artifactNumToKeepStr: '60', artifactNumToKeepStr: '10',
)) ))
} }
@ -103,6 +103,11 @@ pipeline {
script { cmn.gitHubNotifyPRSuccess() } script { cmn.gitHubNotifyPRSuccess() }
} }
} }
stage('Cleanup') {
steps {
script { cmn.clean() }
}
}
} }
post { post {
failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } }

View File

@ -16,9 +16,9 @@ pipeline {
timeout(time: 25, unit: 'MINUTES') timeout(time: 25, unit: 'MINUTES')
/* Limit builds retained */ /* Limit builds retained */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: '60', numToKeepStr: '10',
daysToKeepStr: '30', daysToKeepStr: '20',
artifactNumToKeepStr: '60', artifactNumToKeepStr: '10',
)) ))
} }
@ -84,6 +84,11 @@ pipeline {
script { cmn.gitHubNotifyPRSuccess() } script { cmn.gitHubNotifyPRSuccess() }
} }
} }
stage('Cleanup') {
steps {
script { cmn.clean() }
}
}
} }
post { post {
failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } }

View File

@ -29,9 +29,9 @@ pipeline {
timeout(time: 45, unit: 'MINUTES') timeout(time: 45, unit: 'MINUTES')
/* Limit builds retained */ /* Limit builds retained */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: '60', numToKeepStr: '10',
daysToKeepStr: '30', daysToKeepStr: '20',
artifactNumToKeepStr: '60', artifactNumToKeepStr: '10',
)) ))
} }
@ -106,6 +106,11 @@ pipeline {
script { cmn.gitHubNotifyPRSuccess() } script { cmn.gitHubNotifyPRSuccess() }
} }
} }
stage('Cleanup') {
steps {
script { cmn.clean() }
}
}
} }
post { post {
failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } }

View File

@ -149,8 +149,16 @@ def buildDuration() {
def gitHubNotify(message) { def gitHubNotify(message) {
def githubIssuesUrl = 'https://api.github.com/repos/status-im/status-react/issues' def githubIssuesUrl = 'https://api.github.com/repos/status-im/status-react/issues'
/* CHANGE_ID can be provided via the build parameters */ /* CHANGE_ID can be provided via the build parameters or from parent */
def changeId = params.CHANGE_ID ? params.CHANGE_ID : env.CHANGE_ID def changeId = env.CHANGE_ID
changeId = params.CHANGE_ID ? params.CHANGE_ID : changeId
changeId = getParentRunEnv('CHANGE_ID') ? getParentRunEnv('CHANGE_ID') : changeId
/* CHANGE_ID exists only when run as a PR build */
if (!changeId) {
println('This build is not related to a PR, CHANGE_ID missing.')
println('GitHub notification impossible, skipping...')
return
}
def msgObj = [body: message] def msgObj = [body: message]
def msgJson = new JsonBuilder(msgObj).toPrettyString() def msgJson = new JsonBuilder(msgObj).toPrettyString()
withCredentials([usernamePassword( withCredentials([usernamePassword(
@ -264,4 +272,8 @@ def runTests() {
sh 'lein test-cljs' sh 'lein test-cljs'
} }
def clean() {
sh 'make clean'
}
return this return this

View File

@ -2,12 +2,8 @@ cmn = load 'ci/common.groovy'
packageFolder = './StatusImPackage' packageFolder = './StatusImPackage'
def cleanupBuild() {
sh 'make clean'
}
def cleanupAndDeps() { def cleanupAndDeps() {
cleanupBuild() cmn.clean()
sh 'cp .env.jenkins .env' sh 'cp .env.jenkins .env'
sh 'lein deps' sh 'lein deps'
cmn.installJSDeps('desktop') cmn.installJSDeps('desktop')

View File

@ -36,7 +36,7 @@ def podUpdate() {
def prep(type = 'nightly') { def prep(type = 'nightly') {
cmn.doGitRebase() cmn.doGitRebase()
/* ensure that we start from a known state */ /* ensure that we start from a known state */
sh 'make clean' cmn.clean()
/* select type of build */ /* select type of build */
switch (type) { switch (type) {
case 'nightly': case 'nightly':