Skip to content

Commit 10bd202

Browse files
committed
Doing it for real
1 parent 2af3c1d commit 10bd202

1 file changed

Lines changed: 21 additions & 15 deletions

File tree

Jenkinsfile

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ pipeline {
99

1010
stages {
1111
stage('Build') {
12-
13-
options {
14-
// Sometimes builds freeze, but this doesn't have to be super aggressive.
15-
timeout(time: 30, unit: 'MINUTES')
16-
}
17-
1812
agent any
1913

2014
steps {
@@ -27,7 +21,10 @@ pipeline {
2721
file(credentialsId: 'build_secrets', variable: 'ORG_GRADLE_PROJECT_secretFile'),
2822
]) {
2923
echo 'Building project.'
30-
sh './gradlew build publish --stacktrace --warn'
24+
// Sometimes builds freeze, so wrap in a timeout.
25+
timeout(time: 30, unit: 'MINUTES') {
26+
sh './gradlew build publish --stacktrace --warn'
27+
}
3128
}
3229
}
3330

@@ -46,6 +43,7 @@ pipeline {
4643
}
4744

4845
stage('Release') {
46+
// Take the input in our when block so that we don't block any agents.
4947
when {
5048
expression {
5149
input(message: 'Publish without build number?', ok: 'Yes', cancel: 'No')
@@ -55,11 +53,6 @@ pipeline {
5553
beforeAgent true
5654
}
5755

58-
options {
59-
// Sometimes builds freeze, but this doesn't have to be super aggressive.
60-
timeout(time: 30, unit: 'MINUTES')
61-
}
62-
6356
agent any
6457

6558
environment {
@@ -70,9 +63,22 @@ pipeline {
7063
// Prevent older builds from being released.
7164
milestone(ordinal: 1, label: 'Release Guardian')
7265

73-
echo 'Building for release.'
74-
echo '$RELEASE'
75-
echo './gradlew build publish --stacktrace --warn'
66+
echo 'Setup project for release.'
67+
sh 'chmod +x gradlew'
68+
69+
// Clean again because the agent may have changed.
70+
sh './gradlew clean'
71+
72+
withCredentials([
73+
// build_secrets is parsed in SubprojectExtension#loadSecrets
74+
file(credentialsId: 'build_secrets', variable: 'ORG_GRADLE_PROJECT_secretFile'),
75+
]) {
76+
echo 'Building project for release.'
77+
// Sometimes builds freeze, so wrap in a timeout.
78+
timeout(time: 30, unit: 'MINUTES') {
79+
sh './gradlew build publish --stacktrace --warn'
80+
}
81+
}
7682

7783
milestone(ordinal: 2, label: 'Release')
7884
}

0 commit comments

Comments
 (0)