forked from openshift/os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.rdgo
77 lines (68 loc) · 2.84 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
def DOCKER_IMG = "registry.fedoraproject.org/fedora:28"
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 = "${env.ARTIFACT_SERVER_DIR}/rdgo"
node(env.NODE) {
checkout scm
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([sshUserPrivateKey(credentialsId: env['ARTIFACT_SSH_CREDS_ID'],
keyFileVariable: 'KEY_FILE')]) {
sh """
mkdir -p ${rdgo}
rsync -Hplpt --stats \
-e 'ssh -i ${env.KEY_FILE} \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no' \
${env.ARTIFACT_SERVER}:${rdgo}/ ${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=log"
}
if (!fileExists("rdgo.stamp")) {
currentBuild.result = 'SUCCESS'
currentBuild.description = '(No changes)'
return
}
stage("Sync Out") {
withCredentials([sshUserPrivateKey(credentialsId: env['ARTIFACT_SSH_CREDS_ID'],
keyFileVariable: 'KEY_FILE')]) {
sh """
rsync -Hrlpt --stats --delete --delete-after \
-e 'ssh -i ${env.KEY_FILE} \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no' \
${rdgo}/ ${env.ARTIFACT_SERVER}:${rdgo}
"""
}
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: env['AWS_CREDENTIALS']]]) {
sh """
aws s3 sync --delete ${rdgo}/build/ s3://aos-ci/rhcos/rdgo
"""
}
currentBuild.description = 'rdgo build+sync done'
}
}
}