diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 635e229ad1..5015c84cfd 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -8,9 +8,9 @@ pipeline { timeout(time: 35, unit: 'MINUTES') /* Limit builds retained */ buildDiscarder(logRotator( - numToKeepStr: '90', - daysToKeepStr: '30', - artifactNumToKeepStr: '90', + numToKeepStr: '10', + daysToKeepStr: '20', + artifactNumToKeepStr: '10', )) } @@ -97,6 +97,11 @@ pipeline { script { cmn.gitHubNotifyPRSuccess() } } } + stage('Cleanup') { + steps { + script { cmn.clean() } + } + } } post { failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 19eecc7733..72e9417884 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -16,9 +16,9 @@ pipeline { timeout(time: 35, unit: 'MINUTES') /* Limit builds retained */ buildDiscarder(logRotator( - numToKeepStr: '90', - daysToKeepStr: '60', - artifactNumToKeepStr: '60', + numToKeepStr: '10', + daysToKeepStr: '20', + artifactNumToKeepStr: '10', )) } @@ -90,6 +90,11 @@ pipeline { script { cmn.gitHubNotifyPRSuccess() } } } + stage('Cleanup') { + steps { + script { cmn.clean() } + } + } } post { failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index 132b5990a8..e879334a0e 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -29,9 +29,9 @@ pipeline { timeout(time: 35, unit: 'MINUTES') /* Limit builds retained */ buildDiscarder(logRotator( - numToKeepStr: '60', - daysToKeepStr: '30', - artifactNumToKeepStr: '60', + numToKeepStr: '10', + daysToKeepStr: '20', + artifactNumToKeepStr: '10', )) } @@ -103,6 +103,11 @@ pipeline { script { cmn.gitHubNotifyPRSuccess() } } } + stage('Cleanup') { + steps { + script { cmn.clean() } + } + } } post { failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } diff --git a/ci/Jenkinsfile.macos b/ci/Jenkinsfile.macos index bebf8177d9..49f6c6239c 100644 --- a/ci/Jenkinsfile.macos +++ b/ci/Jenkinsfile.macos @@ -16,9 +16,9 @@ pipeline { timeout(time: 25, unit: 'MINUTES') /* Limit builds retained */ buildDiscarder(logRotator( - numToKeepStr: '60', - daysToKeepStr: '30', - artifactNumToKeepStr: '60', + numToKeepStr: '10', + daysToKeepStr: '20', + artifactNumToKeepStr: '10', )) } @@ -84,6 +84,11 @@ pipeline { script { cmn.gitHubNotifyPRSuccess() } } } + stage('Cleanup') { + steps { + script { cmn.clean() } + } + } } post { failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } diff --git a/ci/Jenkinsfile.windows b/ci/Jenkinsfile.windows index af6f95b669..cade88a870 100644 --- a/ci/Jenkinsfile.windows +++ b/ci/Jenkinsfile.windows @@ -29,9 +29,9 @@ pipeline { timeout(time: 45, unit: 'MINUTES') /* Limit builds retained */ buildDiscarder(logRotator( - numToKeepStr: '60', - daysToKeepStr: '30', - artifactNumToKeepStr: '60', + numToKeepStr: '10', + daysToKeepStr: '20', + artifactNumToKeepStr: '10', )) } @@ -106,6 +106,11 @@ pipeline { script { cmn.gitHubNotifyPRSuccess() } } } + stage('Cleanup') { + steps { + script { cmn.clean() } + } + } } post { failure { script { load('ci/common.groovy').gitHubNotifyPRFail() } } diff --git a/ci/common.groovy b/ci/common.groovy index cb80b5c53e..7e48b4fab2 100644 --- a/ci/common.groovy +++ b/ci/common.groovy @@ -149,8 +149,16 @@ def buildDuration() { def gitHubNotify(message) { def githubIssuesUrl = 'https://api.github.com/repos/status-im/status-react/issues' - /* CHANGE_ID can be provided via the build parameters */ - def changeId = params.CHANGE_ID ? params.CHANGE_ID : env.CHANGE_ID + /* CHANGE_ID can be provided via the build parameters or from parent */ + 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 msgJson = new JsonBuilder(msgObj).toPrettyString() withCredentials([usernamePassword( @@ -264,4 +272,8 @@ def runTests() { sh 'lein test-cljs' } +def clean() { + sh 'make clean' +} + return this diff --git a/ci/desktop.groovy b/ci/desktop.groovy index dd9a007f60..4e3b9794f0 100644 --- a/ci/desktop.groovy +++ b/ci/desktop.groovy @@ -2,12 +2,8 @@ cmn = load 'ci/common.groovy' packageFolder = './StatusImPackage' -def cleanupBuild() { - sh 'make clean' -} - def cleanupAndDeps() { - cleanupBuild() + cmn.clean() sh 'cp .env.jenkins .env' sh 'lein deps' cmn.installJSDeps('desktop') diff --git a/ci/mobile.groovy b/ci/mobile.groovy index 3fc52b3d53..1224010851 100644 --- a/ci/mobile.groovy +++ b/ci/mobile.groovy @@ -36,7 +36,7 @@ def podUpdate() { def prep(type = 'nightly') { cmn.doGitRebase() /* ensure that we start from a known state */ - sh 'make clean' + cmn.clean() /* select type of build */ switch (type) { case 'nightly':