@@ -42,10 +42,11 @@ pipeline {
42
42
// Setup all the basic environment variables needed for the build
43
43
stage(" Set ENV Variables base" ){
44
44
steps{
45
+ sh ''' docker pull quay.io/skopeo/stable:v1 || : '''
45
46
script{
46
47
env. EXIT_STATUS = ' '
47
48
env. LS_RELEASE = sh(
48
- script : ''' docker run --rm ghcr .io/linuxserver/alexeiled- skopeo sh -c 'skopeo inspect docker://docker .io/'${DOCKERHUB_IMAGE}' :latest 2>/dev/null' | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\ -ls' || : ''' ,
49
+ script : ''' docker run --rm quay .io/skopeo/stable:v1 inspect docker://ghcr .io/${LS_USER}/${CONTAINER_NAME} :latest 2>/dev/null | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\ -ls' || : ''' ,
49
50
returnStdout : true ). trim()
50
51
env. LS_RELEASE_NOTES = sh(
51
52
script : ''' cat readme-vars.yml | awk -F \\ " '/date: "[0-9][0-9].[0-9][0-9].[0-9][0-9]:/ {print $4;exit;}' | sed -E ':a;N;$!ba;s/\\ r{0,1}\\ n/\\\\ n/g' ''' ,
@@ -232,7 +233,7 @@ pipeline {
232
233
script{
233
234
env. SHELLCHECK_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /shellcheck-result.xml'
234
235
}
235
- sh ''' curl -sL https://raw.githubusercontent.com/linuxserver/docker-shellcheck /master/checkrun.sh | /bin/bash'''
236
+ sh ''' curl -sL https://raw.githubusercontent.com/linuxserver/docker-jenkins-builder /master/checkrun.sh | /bin/bash'''
236
237
sh ''' #! /bin/bash
237
238
docker run --rm \
238
239
-v ${WORKSPACE}:/mnt \
@@ -380,6 +381,26 @@ pipeline {
380
381
}
381
382
}
382
383
}
384
+ // If this is a master build check the S6 service file perms
385
+ stage(" Check S6 Service file Permissions" ){
386
+ when {
387
+ branch " master"
388
+ environment name : ' CHANGE_ID' , value : ' '
389
+ environment name : ' EXIT_STATUS' , value : ' '
390
+ }
391
+ steps {
392
+ script{
393
+ sh ''' #! /bin/bash
394
+ WRONG_PERM=$(find ./ -path "./.git" -prune -o \\ ( -name "run" -o -name "finish" -o -name "check" \\ ) -not -perm -u=x,g=x,o=x -print)
395
+ if [[ -n "${WRONG_PERM}" ]]; then
396
+ echo "The following S6 service files are missing the executable bit; canceling the faulty build: ${WRONG_PERM}"
397
+ exit 1
398
+ else
399
+ echo "S6 service file perms look good."
400
+ fi '''
401
+ }
402
+ }
403
+ }
383
404
/* #######################
384
405
GitLab Mirroring
385
406
####################### */
@@ -637,6 +658,7 @@ pipeline {
637
658
]) {
638
659
script{
639
660
env. CI_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /index.html'
661
+ env. CI_JSON_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /report.json'
640
662
}
641
663
sh ''' #! /bin/bash
642
664
set -e
@@ -661,8 +683,6 @@ pipeline {
661
683
-e WEB_SCREENSHOT=\" ${CI_WEB}\" \
662
684
-e WEB_AUTH=\" ${CI_AUTH}\" \
663
685
-e WEB_PATH=\" ${CI_WEBPATH}\" \
664
- -e DO_REGION="ams3" \
665
- -e DO_BUCKET="lsio-ci" \
666
686
-t ghcr.io/linuxserver/ci:latest \
667
687
python3 test_build.py'''
668
688
}
@@ -796,6 +816,9 @@ pipeline {
796
816
docker manifest create ${MANIFESTIMAGE}:${SEMVER} ${MANIFESTIMAGE}:amd64-${SEMVER} ${MANIFESTIMAGE}:arm64v8-${SEMVER}
797
817
docker manifest annotate ${MANIFESTIMAGE}:${SEMVER} ${MANIFESTIMAGE}:arm64v8-${SEMVER} --os linux --arch arm64 --variant v8
798
818
fi
819
+ docker manifest push --purge ${MANIFESTIMAGE}:arm32v7-latest || :
820
+ docker manifest create ${MANIFESTIMAGE}:arm32v7-latest ${MANIFESTIMAGE}:amd64-latest
821
+ docker manifest push --purge ${MANIFESTIMAGE}:arm32v7-latest
799
822
docker manifest push --purge ${MANIFESTIMAGE}:latest
800
823
docker manifest push --purge ${MANIFESTIMAGE}:${META_TAG}
801
824
docker manifest push --purge ${MANIFESTIMAGE}:${EXT_RELEASE_TAG}
@@ -897,8 +920,67 @@ pipeline {
897
920
environment name : ' EXIT_STATUS' , value : ' '
898
921
}
899
922
steps {
900
- sh ''' curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
901
- -d '{"body": "I am a bot, here are the test results for this PR: \\ n'${CI_URL}' \\ n'${SHELLCHECK_URL}'"}' '''
923
+ sh ''' #! /bin/bash
924
+ # Function to retrieve JSON data from URL
925
+ get_json() {
926
+ local url="$1"
927
+ local response=$(curl -s "$url")
928
+ if [ $? -ne 0 ]; then
929
+ echo "Failed to retrieve JSON data from $url"
930
+ return 1
931
+ fi
932
+ local json=$(echo "$response" | jq .)
933
+ if [ $? -ne 0 ]; then
934
+ echo "Failed to parse JSON data from $url"
935
+ return 1
936
+ fi
937
+ echo "$json"
938
+ }
939
+
940
+ build_table() {
941
+ local data="$1"
942
+
943
+ # Get the keys in the JSON data
944
+ local keys=$(echo "$data" | jq -r 'to_entries | map(.key) | .[]')
945
+
946
+ # Check if keys are empty
947
+ if [ -z "$keys" ]; then
948
+ echo "JSON report data does not contain any keys or the report does not exist."
949
+ return 1
950
+ fi
951
+
952
+ # Build table header
953
+ local header="| Tag | Passed |\\ n| --- | --- |\\ n"
954
+
955
+ # Loop through the JSON data to build the table rows
956
+ local rows=""
957
+ for build in $keys; do
958
+ local status=$(echo "$data" | jq -r ".[\\ "$build\\ "].test_success")
959
+ if [ "$status" = "true" ]; then
960
+ status="✅"
961
+ else
962
+ status="❌"
963
+ fi
964
+ local row="| "$build" | "$status" |\\ n"
965
+ rows="${rows}${row}"
966
+ done
967
+
968
+ local table="${header}${rows}"
969
+ local escaped_table=$(echo "$table" | sed 's/\" /\\\\ "/g')
970
+ echo "$escaped_table"
971
+ }
972
+
973
+ # Retrieve JSON data from URL
974
+ data=$(get_json "$CI_JSON_URL")
975
+ # Create table from JSON data
976
+ table=$(build_table "$data")
977
+ echo -e "$table"
978
+
979
+ curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
980
+ -H "Accept: application/vnd.github.v3+json" \
981
+ "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
982
+ -d "{\\ "body\\ ": \\ "I am a bot, here are the test results for this PR: \\ n${CI_URL}\\ n${SHELLCHECK_URL}\\ n${table}\\ "}"'''
983
+
902
984
}
903
985
}
904
986
}
0 commit comments