forked from openshift/os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.rdgo
80 lines (68 loc) · 2.66 KB
/
Jenkinsfile.rdgo
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
def TIMER = "H/30 * * * *"
def NODE = "atomic-jslave-autobrew"
def DOCKER_IMG = "quay.io/cgwalters/coreos-assembler"
def DOCKER_ARGS = "--net=host -v /srv:/srv --privileged"
// this var conveniently refers to a location on the server as well as the
// local dir we sync to/from
def rdgo = "/srv/rhcos/output/rdgo"
node(NODE) {
docker.image(DOCKER_IMG).pull()
checkout scm
utils = load("pipeline-utils.groovy")
utils.define_properties(TIMER)
try {
docker.image(DOCKER_IMG).inside(DOCKER_ARGS) {
stage("Provision") {
sh """
dnf install -y git rsync openssh-clients dnf-plugins-core fedpkg dnf-utils awscli
cp RPM-GPG-* /etc/pki/rpm-gpg/
dnf copr -y enable walters/buildtools-fedora
dnf install -y rpmdistro-gitoverlay
"""
}
stage("Sync In") {
withCredentials([
string(credentialsId: params.ARTIFACT_SERVER, variable: 'ARTIFACT_SERVER'),
sshUserPrivateKey(credentialsId: params.ARTIFACT_SSH_CREDS_ID, keyFileVariable: 'KEY_FILE'),
]) {
utils.rsync_dir_in(ARTIFACT_SERVER, KEY_FILE, rdgo)
}
}
stage("Setup and Initialize RDGO") {
sh """
rm -f rdgo.stamp
ln -sf $WORKSPACE/overlay.yml ${rdgo}/
cd ${rdgo}
rpmdistro-gitoverlay init
"""
}
stage("Resolve and Fetch Sources") {
sh "cd ${rdgo} && rpmdistro-gitoverlay resolve --fetch-all"
}
stage("Build Overlay Packages") {
sh "cd ${rdgo} && rpmdistro-gitoverlay build --touch-if-changed $WORKSPACE/rdgo.stamp --logdir=${WORKSPACE}/log"
}
if (!fileExists("rdgo.stamp")) {
currentBuild.result = 'SUCCESS'
currentBuild.description = '(No changes)'
return
}
stage("Sync Out") {
withCredentials([
string(credentialsId: params.ARTIFACT_SERVER, variable: 'ARTIFACT_SERVER'),
sshUserPrivateKey(credentialsId: params.ARTIFACT_SSH_CREDS_ID, keyFileVariable: 'KEY_FILE'),
]) {
utils.rsync_dir_out(ARTIFACT_SERVER, KEY_FILE, rdgo)
}
withCredentials([
[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: params.AWS_CREDENTIALS],
]) {
sh "aws s3 sync --delete ${rdgo}/build/ s3://aos-ci/rhcos/rdgo"
}
currentBuild.description = 'rdgo build+sync done'
}
}
} finally {
archiveArtifacts artifacts: "log/**", allowEmptyArchive: true
}
}