Skip to content

Commit

Permalink
Updated depreciated stage declarations
Browse files Browse the repository at this point in the history
Jenkins depreciated the form of the stage step that did not accept a block
argument. https://jenkins.io/doc/pipeline/steps/pipeline-stage-step/#pipeline-stage-step
  • Loading branch information
pfeerick committed Jul 23, 2017
1 parent cff40fc commit 404e5ef
Showing 1 changed file with 118 additions and 110 deletions.
228 changes: 118 additions & 110 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,116 +13,124 @@ properties([
node('docker && linux-build') {
timestamps {
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
stage "Environment"
checkout scm

def environment = docker.build('build-environment:build-rock64-image', 'environment')

environment.inside("--privileged -u 0:0") {
withEnv([
"USE_CCACHE=true",
"RELEASE_NAME=$VERSION",
"RELEASE=$BUILD_NUMBER"
]) {
stage 'Prepare'
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
ccache -M 0 -F 0
git clean -ffdx -e ccache
'''

stage 'Sources'
sh '''#!/bin/bash
set -xe
export HOME=$WORKSPACE
export USER=jenkins
repo init -u https://github.com/ayufan-rock64/linux-manifests -b default --depth=1
repo sync -j 20 -c --force-sync
'''

stage 'U-boot'
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make u-boot
'''

stage 'Kernel'
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make kernel
'''

stage 'Images'
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make -j$(nproc)
'''
}

withEnv([
"VERSION=$VERSION",
"CHANGES=$CHANGES",
"PRERELEASE=$PRERELEASE",
"GITHUB_USER=$GITHUB_USER",
"GITHUB_REPO=$GITHUB_REPO"
]) {
stage 'Freeze'
sh '''#!/bin/bash
# use -ve, otherwise we could leak GITHUB_TOKEN...
set -ve
shopt -s nullglob
export HOME=$WORKSPACE
export USER=jenkins
repo manifest -r -o manifest.xml
'''

stage 'Release'
sh '''#!/bin/bash
set -xe
shopt -s nullglob
github-release release \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}" \
--draft
github-release upload \
--tag "${VERSION}" \
--name "manifest.xml" \
--file "manifest.xml"
for file in *.xz *.deb; do
github-release upload \
--tag "${VERSION}" \
--name "$(basename "$file")" \
--file "$file" &
done
wait
if [[ "$PRERELEASE" == "true" ]]; then
github-release edit \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}" \
--pre-release
else
github-release edit \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}"
fi
'''
stage('Environment') {
checkout scm

def environment = docker.build('build-environment:build-rock64-image', 'environment')

environment.inside("--privileged -u 0:0") {
withEnv([
"USE_CCACHE=true",
"RELEASE_NAME=$VERSION",
"RELEASE=$BUILD_NUMBER"
]) {
stage('Prepare') {
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
ccache -M 0 -F 0
git clean -ffdx -e ccache
'''
}

stage 'Sources' {
sh '''#!/bin/bash
set -xe
export HOME=$WORKSPACE
export USER=jenkins
repo init -u https://github.com/ayufan-rock64/linux-manifests -b default --depth=1
repo sync -j 20 -c --force-sync
'''
}

stage('U-boot') {
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make u-boot
'''
}

stage('Kernel') {
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make kernel
'''
}

stage('Images') {
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make -j$(nproc)
'''
}
}

withEnv([
"VERSION=$VERSION",
"CHANGES=$CHANGES",
"PRERELEASE=$PRERELEASE",
"GITHUB_USER=$GITHUB_USER",
"GITHUB_REPO=$GITHUB_REPO"
]) {
stage('Freeze') {
sh '''#!/bin/bash
# use -ve, otherwise we could leak GITHUB_TOKEN...
set -ve
shopt -s nullglob
export HOME=$WORKSPACE
export USER=jenkins
repo manifest -r -o manifest.xml
'''
}

stage('Release') {
sh '''#!/bin/bash
set -xe
shopt -s nullglob
github-release release \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}" \
--draft
github-release upload \
--tag "${VERSION}" \
--name "manifest.xml" \
--file "manifest.xml"
for file in *.xz *.deb; do
github-release upload \
--tag "${VERSION}" \
--name "$(basename "$file")" \
--file "$file" &
done
wait
if [[ "$PRERELEASE" == "true" ]]; then
github-release edit \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}" \
--pre-release
else
github-release edit \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}"
fi
'''
}
}
}
}
}
Expand Down

0 comments on commit 404e5ef

Please sign in to comment.