Skip to content

Commit 0bdddac

Browse files
authored
Merge pull request #14 from pfeerick/jenkins-conditional-release
Jenkins conditional release
2 parents 28b516a + 0306f88 commit 0bdddac

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed

Jenkinsfile

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ properties([
66
booleanParam(defaultValue: false, description: 'If build should be marked as pre-release', name: 'PRERELEASE'),
77
string(defaultValue: 'ayufan-pine64', description: 'GitHub username or organization', name: 'GITHUB_USER'),
88
string(defaultValue: 'build-pine64-image', description: 'GitHub repository', name: 'GITHUB_REPO'),
9+
booleanParam(defaultValue: true, description: 'Whether to upload to Github for release or not', name: 'GITHUB_UPLOAD'),
10+
choice(choices: 'all\nkernel-tarball\nlinux-package\nxenial-minimal-pinebook\nxenial-mate-pinebook\nstretch-i3-pinebook\nxenial-pinebook\nlinux-pinebook\nxenial-minimal-pine64\nlinux-pine64\nxenial-minimal-sopine\nlinux-sopine', description: 'What makefile build type to target', name: 'MAKE_TARGET')
911
])
1012
])
1113
*/
@@ -36,7 +38,7 @@ node('docker && linux-build') {
3638
sh '''#!/bin/bash
3739
set +xe
3840
export CCACHE_DIR=$WORKSPACE/ccache
39-
make -j4
41+
make -j4 $MAKE_TARGET
4042
'''
4143
}
4244

@@ -48,38 +50,42 @@ node('docker && linux-build') {
4850
"GITHUB_REPO=$GITHUB_REPO"
4951
]) {
5052
stage 'Release'
51-
sh '''#!/bin/bash
52-
set -xe
53-
shopt -s nullglob
54-
55-
github-release release \
56-
--tag "${VERSION}" \
57-
--name "$VERSION: $BUILD_TAG" \
58-
--description "${CHANGES}\n\n${BUILD_URL}" \
59-
--draft
53+
if (params.GITHUB_UPLOAD) {
54+
sh '''#!/bin/bash
55+
set -xe
56+
shopt -s nullglob
6057
61-
for file in *.xz *.deb; do
62-
github-release upload \
58+
github-release release \
6359
--tag "${VERSION}" \
64-
--name "$(basename "$file")" \
65-
--file "$file" &
66-
done
60+
--name "$VERSION: $BUILD_TAG" \
61+
--description "${CHANGES}\n\n${BUILD_URL}" \
62+
--draft
63+
64+
for file in *.xz *.deb; do
65+
github-release upload \
66+
--tag "${VERSION}" \
67+
--name "$(basename "$file")" \
68+
--file "$file" &
69+
done
6770
68-
wait
71+
wait
6972
70-
if [[ "$PRERELEASE" == "true" ]]; then
71-
github-release edit \
72-
--tag "${VERSION}" \
73-
--name "$VERSION: $BUILD_TAG" \
74-
--description "${CHANGES}\n\n${BUILD_URL}" \
75-
--pre-release
76-
else
77-
github-release edit \
78-
--tag "${VERSION}" \
79-
--name "$VERSION: $BUILD_TAG" \
80-
--description "${CHANGES}\n\n${BUILD_URL}"
81-
fi
82-
'''
73+
if [[ "$PRERELEASE" == "true" ]]; then
74+
github-release edit \
75+
--tag "${VERSION}" \
76+
--name "$VERSION: $BUILD_TAG" \
77+
--description "${CHANGES}\n\n${BUILD_URL}" \
78+
--pre-release
79+
else
80+
github-release edit \
81+
--tag "${VERSION}" \
82+
--name "$VERSION: $BUILD_TAG" \
83+
--description "${CHANGES}\n\n${BUILD_URL}"
84+
fi
85+
'''
86+
} else {
87+
echo 'Flagged as an no upload release job'
88+
}
8389
}
8490
}
8591
}

0 commit comments

Comments
 (0)