@@ -17,6 +17,8 @@ pipeline {
17
17
GITLAB_TOKEN = credentials(' b6f0f1dd-6952-4cf6-95d1-9c06380283f0' )
18
18
GITLAB_NAMESPACE = credentials(' gitlab-namespace-id' )
19
19
DOCKERHUB_TOKEN = credentials(' docker-hub-ci-pat' )
20
+ QUAYIO_API_TOKEN = credentials(' quayio-repo-api-token' )
21
+ GIT_SIGNING_KEY = credentials(' 484fbca6-9a4f-455e-b9e3-97ac98785f5f' )
20
22
BUILD_VERSION_ARG = ' NGINX_VERSION'
21
23
LS_USER = ' linuxserver'
22
24
LS_REPO = ' docker-socket-proxy'
@@ -39,9 +41,23 @@ pipeline {
39
41
CI_WEBPATH = ' '
40
42
}
41
43
stages {
44
+ stage(" Set git config" ){
45
+ steps{
46
+ sh ''' #!/bin/bash
47
+ cat ${GIT_SIGNING_KEY} > /config/.ssh/id_sign
48
+ chmod 600 /config/.ssh/id_sign
49
+ ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub
50
+ echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits"
51
+ git config --global gpg.format ssh
52
+ git config --global user.signingkey /config/.ssh/id_sign
53
+ git config --global commit.gpgsign true
54
+ '''
55
+ }
56
+ }
42
57
// Setup all the basic environment variables needed for the build
43
58
stage(" Set ENV Variables base" ){
44
59
steps{
60
+ echo " Running on node: ${ NODE_NAME} "
45
61
sh ''' #! /bin/bash
46
62
containers=$(docker ps -aq)
47
63
if [[ -n "${containers}" ]]; then
@@ -446,10 +462,10 @@ pipeline {
446
462
}
447
463
}
448
464
/* #######################
449
- GitLab Mirroring
465
+ GitLab Mirroring and Quay.io Repo Visibility
450
466
####################### */
451
- // Ping into Gitlab to mirror this repo and have a registry endpoint
452
- stage(" GitLab Mirror" ){
467
+ // Ping into Gitlab to mirror this repo and have a registry endpoint & mark this repo on Quay.io as public
468
+ stage(" GitLab Mirror and Quay.io Visibility " ){
453
469
when {
454
470
environment name : ' EXIT_STATUS' , value : ' '
455
471
}
@@ -465,6 +481,8 @@ pipeline {
465
481
"visibility":"public"}' '''
466
482
sh ''' curl -H "Private-Token: ${GITLAB_TOKEN}" -X PUT "https://gitlab.com/api/v4/projects/Linuxserver.io%2F${LS_REPO}" \
467
483
-d "mirror=true&import_url=https://github.com/linuxserver/${LS_REPO}.git" '''
484
+ sh ''' curl -H "Content-Type: application/json" -H "Authorization: Bearer ${QUAYIO_API_TOKEN}" -X POST "https://quay.io/api/v1/repository${QUAYIMAGE/quay.io/}/changevisibility" \
485
+ -d '{"visibility":"public"}' ||: '''
468
486
}
469
487
}
470
488
/* ###############
@@ -559,7 +577,7 @@ pipeline {
559
577
--provenance=false --sbom=false \
560
578
--build-arg ${ BUILD_VERSION_ARG} =${ EXT_RELEASE} --build-arg VERSION=\" ${ VERSION_TAG} \" --build-arg BUILD_DATE=${ GITHUB_DATE} ."
561
579
sh " docker tag ${ IMAGE} :arm64v8-${ META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${ COMMIT_SHA} -${ BUILD_NUMBER} "
562
- retry( 5 ) {
580
+ retry_backoff( 5 , 5 ) {
563
581
sh " docker push ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${ COMMIT_SHA} -${ BUILD_NUMBER} "
564
582
}
565
583
sh ''' #! /bin/bash
@@ -715,7 +733,7 @@ pipeline {
715
733
passwordVariable : ' QUAYPASS'
716
734
]
717
735
]) {
718
- retry( 5 ) {
736
+ retry_backoff( 5 , 5 ) {
719
737
sh ''' #! /bin/bash
720
738
set -e
721
739
echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin
@@ -733,7 +751,7 @@ pipeline {
733
751
docker push ${PUSHIMAGE}:${META_TAG}
734
752
docker push ${PUSHIMAGE}:${EXT_RELEASE_TAG}
735
753
if [ -n "${SEMVER}" ]; then
736
- docker push ${PUSHIMAGE}:${SEMVER}
754
+ docker push ${PUSHIMAGE}:${SEMVER}
737
755
fi
738
756
done
739
757
'''
@@ -756,7 +774,7 @@ pipeline {
756
774
passwordVariable : ' QUAYPASS'
757
775
]
758
776
]) {
759
- retry( 5 ) {
777
+ retry_backoff( 5 , 5 ) {
760
778
sh ''' #! /bin/bash
761
779
set -e
762
780
echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin
@@ -819,7 +837,7 @@ pipeline {
819
837
"object": "'${COMMIT_SHA}'",\
820
838
"message": "Tagging Release '${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}' to main",\
821
839
"type": "commit",\
822
- "tagger": {"name": "LinuxServer Jenkins ","email": "jenkins @linuxserver.io","date": "'${GITHUB_DATE}'"}}' '''
840
+ "tagger": {"name": "LinuxServer-CI ","email": "ci @linuxserver.io","date": "'${GITHUB_DATE}'"}}' '''
823
841
echo " Pushing New release for Tag"
824
842
sh ''' #! /bin/bash
825
843
echo "Updating external repo packages to ${EXT_RELEASE_CLEAN}" > releasebody.json
951
969
###################### */
952
970
post {
953
971
always {
972
+ sh ''' #!/bin/bash
973
+ rm -rf /config/.ssh/id_sign
974
+ rm -rf /config/.ssh/id_sign.pub
975
+ git config --global --unset gpg.format
976
+ git config --global --unset user.signingkey
977
+ git config --global --unset commit.gpgsign
978
+ '''
954
979
script{
955
980
if (env. EXIT_STATUS == " ABORTED" ){
956
981
sh ' echo "build aborted"'
@@ -980,3 +1005,20 @@ EOF
980
1005
}
981
1006
}
982
1007
}
1008
+
1009
+ def retry_backoff (int max_attempts , int power_base , Closure c ) {
1010
+ int n = 0
1011
+ while (n < max_attempts) {
1012
+ try {
1013
+ c()
1014
+ return
1015
+ } catch (err) {
1016
+ if ((n + 1 ) >= max_attempts) {
1017
+ throw err
1018
+ }
1019
+ sleep(power_base ** n)
1020
+ n++
1021
+ }
1022
+ }
1023
+ return
1024
+ }
0 commit comments