Skip to content

Commit bdc3f51

Browse files
committed
Revert "Use declarative pipeline"
This reverts commit e00164e.
1 parent e00164e commit bdc3f51

File tree

1 file changed

+75
-90
lines changed

1 file changed

+75
-90
lines changed

Jenkinsfile

Lines changed: 75 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,87 @@
1-
pipeline {
2-
// parameters {
3-
// string (
4-
// defaultValue: '1.0',
5-
// description: 'Current version number',
6-
// name : 'VERSION')
7-
// text (
8-
// defaultValue: '',
9-
// description: 'A list of changes',
10-
// name : 'CHANGES')
11-
// booleanParam (
12-
// defaultValue: false,
13-
// description: 'If build should be marked as pre-release',
14-
// name : 'PRERELEASE')
15-
// string (
16-
// defaultValue: '1.0',
17-
// description: 'GitHub username or organization',
18-
// name : 'GITHUB_USER')
19-
// string (
20-
// defaultValue: '1.0',
21-
// description: 'GitHub repository',
22-
// name : 'GITHUB_REPO')
23-
// }
1+
/**
2+
properties([
3+
parameters([
4+
string(defaultValue: '1.0', description: 'Current version number', name: 'VERSION'),
5+
text(defaultValue: '', description: 'A list of changes', name: 'CHANGES'),
6+
booleanParam(defaultValue: false, description: 'If build should be marked as pre-release', name: 'PRERELEASE'),
7+
string(defaultValue: 'ayufan-pine64', description: 'GitHub username or organization', name: 'GITHUB_USER'),
8+
string(defaultValue: 'build-pine64-image', description: 'GitHub repository', name: 'GITHUB_REPO'),
9+
])
10+
])
11+
*/
2412

25-
agent {
26-
dockerfile {
27-
dir 'build-environment'
28-
label 'docker && linux-build'
29-
args '--privileged -u 0:0'
30-
}
31-
}
32-
environment {
33-
USE_CCACHE = 'true'
34-
RELEASE_NAME = "$RELEASE_NAME"
35-
RELEASE = "$BUILD_NUMBER"
36-
CCACHE_DIR = "$WORKSPACE/ccache"
37-
PRERELEASE = "$PRERELEASE"
38-
GITHUB_USER = "$GITHUB_USER"
39-
GITHUB_REPO = "$GITHUB_REPO"
40-
}
41-
options {
42-
timestamps()
43-
}
13+
node('docker && linux-build') {
14+
timestamps {
15+
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
16+
stage "Environment"
17+
checkout scm
4418

45-
stages {
46-
stage('Prepare') {
47-
steps {
48-
sh 'ccache -M 0 -F 0'
49-
sh 'git clean -ffdx -e ccache'
50-
}
51-
}
52-
53-
stage('Build') {
54-
steps {
55-
sh 'make'
56-
}
57-
}
19+
def environment = docker.build('build-environment:build-pine64-image', 'build-environment')
5820

59-
stage('Release') {
60-
steps {
61-
sh '''#!/bin/bash
62-
set -xe
63-
shopt -s nullglob
21+
environment.inside("--privileged -u 0:0") {
22+
withEnv([
23+
"USE_CCACHE=true",
24+
"RELEASE_NAME=$VERSION",
25+
"RELEASE=$BUILD_NUMBER"
26+
]) {
27+
stage 'Prepare'
28+
sh '''#!/bin/bash
29+
set +xe
30+
export CCACHE_DIR=$WORKSPACE/ccache
31+
ccache -M 0 -F 0
32+
git clean -ffdx -e ccache
33+
'''
6434

65-
github-release release \
66-
--tag "${VERSION}" \
67-
--name "$VERSION: $BUILD_TAG" \
68-
--description "${CHANGES}\n\n${BUILD_URL}" \
69-
--draft
35+
stage 'Build'
36+
sh '''#!/bin/bash
37+
set +xe
38+
export CCACHE_DIR=$WORKSPACE/ccache
39+
make
40+
'''
41+
}
42+
43+
withEnv([
44+
"VERSION=$VERSION",
45+
"CHANGES=$CHANGES",
46+
"PRERELEASE=$PRERELEASE",
47+
"GITHUB_USER=$GITHUB_USER",
48+
"GITHUB_REPO=$GITHUB_REPO"
49+
]) {
50+
stage 'Release'
51+
sh '''#!/bin/bash
52+
set -xe
53+
shopt -s nullglob
7054
71-
for file in *.xz *.deb; do
72-
github-release upload \
55+
github-release release \
7356
--tag "${VERSION}" \
74-
--name "$(basename "$file")" \
75-
--file "$file" &
76-
done
57+
--name "$VERSION: $BUILD_TAG" \
58+
--description "${CHANGES}\n\n${BUILD_URL}" \
59+
--draft
7760
78-
wait
61+
for file in *.xz *.deb; do
62+
github-release upload \
63+
--tag "${VERSION}" \
64+
--name "$(basename "$file")" \
65+
--file "$file" &
66+
done
7967
80-
if [[ "$PRERELEASE" == "true" ]]; then
81-
github-release edit \
82-
--tag "${VERSION}" \
83-
--name "$VERSION: $BUILD_TAG" \
84-
--description "${CHANGES}\n\n${BUILD_URL}" \
85-
--pre-release
86-
else
87-
github-release edit \
88-
--tag "${VERSION}" \
89-
--name "$VERSION: $BUILD_TAG" \
90-
--description "${CHANGES}\n\n${BUILD_URL}"
91-
fi
92-
'''
93-
}
94-
}
95-
}
68+
wait
9669
97-
post {
98-
always {
99-
sh 'git clean -ffdx -e ccache'
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+
'''
83+
}
84+
}
10085
}
10186
}
10287
}

0 commit comments

Comments
 (0)