-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
58 lines (52 loc) · 1.81 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
pipeline {
agent any
options {
ansiColor('xterm')
}
environment {
GITHUB_TOKEN = credentials('github-token-pixelc-linux')
GITHUB_ORGANIZATION = "pixelc-linux"
GITHUB_REPO = "ubuntu-releases"
DISTRO = "Ubuntu"
}
stages {
stage('Checkout') {
steps {
sh 'git clone https://github.com/pixelc-linux/rootfs-builder rootfs-builder'
}
}
stage('Build') {
steps {
dir('rootfs-builder') {
withDockerContainer(image: 'dvitali/pixelc-build-container:7', args: '--privileged') {
sh 'bash -c "mkdir -p out/ubuntu/rootfs"'
sh 'UID=0 GID=0 DISTRO=ubuntu SYSROOT=$(pwd)/out/$DISTRO/rootfs TOP=$(pwd) ./build.sh'
}
}
}
}
stage('Publish') {
steps {
script {
env.VERSION_NAME = sh(returnStdout: true, script: 'cat VERSION_NAME').trim()
}
archiveArtifacts 'rootfs-builder/out/*_rootfs.tar.gz'
withDockerContainer(image: 'dvitali/pixelc-build-container:7'){
sh ". /etc/environment"
sh "echo $PATH"
echo "Deleting release from github before creating new one"
sh "/opt/go/bin/github-release delete --user ${GITHUB_ORGANIZATION} --repo ${GITHUB_REPO} --tag ${env.VERSION_NAME}"
echo "Creating a new release in github"
sh "/opt/go/bin/github-release release --user ${GITHUB_ORGANIZATION} --repo ${GITHUB_REPO} --tag ${env.VERSION_NAME} --name ${VERSION_NAME}"
echo "Uploading the artifacts into github"
sh "/opt/go/bin/github-release upload --user ${GITHUB_ORGANIZATION} --repo ${GITHUB_REPO} --tag ${env.VERSION_NAME} --name ${DISTRO}-${VERSION_NAME}_rootfs.tar.gz --file rootfs-builder/out/ubuntu_rootfs.tar.gz"
}
}
}
}
post {
always {
cleanWs()
}
}
}