forked from Native-Planet/urbit-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
58 lines (58 loc) · 2.7 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
environment {
dockerpw = credentials('Dockerhub PW')
versionauth = credentials('VersionAuth')
channel = sh (
script: '''
environ=`echo $BRANCH_NAME|sed 's@origin/@@g'`
if [ "${environ}" = "master" ]; then
echo "latest"
elif [ "${environ}" = "staging" ]; then
echo "edge"
else
echo "nobuild"
fi
''',
returnStdout: true
).trim()
}
stages {
stage('Build') {
environment {
tag = sh (
script: '''
git clone https://github.com/urbit/vere
cd vere
tag=$(git describe --tags --abbrev=0 --exclude "*-rc*")
tag=$(echo "$tag" | sed -e "s/^vere-//")
cd .. && rm -rf vere
echo $tag
''',
returnStdout: true
).trim()
}
steps {
sh (
script: '''
docker login --username=nativeplanet --password=$dockerpw
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --use --name xbuilder --node xbuilder0
docker buildx build --build-arg TAG=$tag --push --tag nativeplanet/urbit:${tag} --tag nativeplanet/urbit:latest --platform linux/amd64,linux/arm64 .
arm64_hash=`curl -s "https://hub.docker.com/v2/repositories/nativeplanet/urbit/tags/${tag}/?page_size=100" \
|jq -r '.images[]|select(.architecture=="arm64").digest'|sed 's/sha256://g'`
amd64_hash=`curl -s "https://hub.docker.com/v2/repositories/nativeplanet/urbit/tags/${tag}/?page_size=100" \
|jq -r '.images[]|select(.architecture=="amd64").digest'|sed 's/sha256://g'`
curl -X PUT -H "X-Api-Key: ${versionauth}" \
https://version.groundseg.app/modify/groundseg/${channel}/vere/amd64_sha256/${amd64_hash}
curl -X PUT -H "X-Api-Key: ${versionauth}" \
https://version.groundseg.app/modify/groundseg/${channel}/vere/arm64_sha256/${arm64_hash}
curl -X PUT -H "X-Api-Key: ${versionauth}" \
https://version.groundseg.app/modify/groundseg/${channel}/vere/tag/${tag}
''',
returnStdout: true
)
}
}
}
}