@@ -33,10 +33,11 @@ pipeline {
33
33
// Setup all the basic environment variables needed for the build
34
34
stage(" Set ENV Variables base" ){
35
35
steps{
36
+ sh ''' docker pull quay.io/skopeo/stable:v1 || : '''
36
37
script{
37
38
env. EXIT_STATUS = ' '
38
39
env. LS_RELEASE = sh(
39
- 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' || : ''' ,
40
+ 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' || : ''' ,
40
41
returnStdout : true ). trim()
41
42
env. LS_RELEASE_NOTES = sh(
42
43
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' ''' ,
@@ -220,7 +221,7 @@ pipeline {
220
221
script{
221
222
env. SHELLCHECK_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /shellcheck-result.xml'
222
223
}
223
- sh ''' curl -sL https://raw.githubusercontent.com/linuxserver/docker-shellcheck /master/checkrun.sh | /bin/bash'''
224
+ sh ''' curl -sL https://raw.githubusercontent.com/linuxserver/docker-jenkins-builder /master/checkrun.sh | /bin/bash'''
224
225
sh ''' #! /bin/bash
225
226
docker run --rm \
226
227
-v ${WORKSPACE}:/mnt \
@@ -347,6 +348,26 @@ pipeline {
347
348
}
348
349
}
349
350
}
351
+ // If this is a master build check the S6 service file perms
352
+ stage(" Check S6 Service file Permissions" ){
353
+ when {
354
+ branch " master"
355
+ environment name : ' CHANGE_ID' , value : ' '
356
+ environment name : ' EXIT_STATUS' , value : ' '
357
+ }
358
+ steps {
359
+ script{
360
+ sh ''' #! /bin/bash
361
+ WRONG_PERM=$(find ./ -path "./.git" -prune -o \\ ( -name "run" -o -name "finish" -o -name "check" \\ ) -not -perm -u=x,g=x,o=x -print)
362
+ if [[ -n "${WRONG_PERM}" ]]; then
363
+ echo "The following S6 service files are missing the executable bit; canceling the faulty build: ${WRONG_PERM}"
364
+ exit 1
365
+ else
366
+ echo "S6 service file perms look good."
367
+ fi '''
368
+ }
369
+ }
370
+ }
350
371
/* #######################
351
372
GitLab Mirroring
352
373
####################### */
@@ -639,6 +660,7 @@ pipeline {
639
660
]) {
640
661
script{
641
662
env. CI_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /index.html'
663
+ env. CI_JSON_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /report.json'
642
664
}
643
665
sh ''' #! /bin/bash
644
666
set -e
@@ -665,8 +687,6 @@ pipeline {
665
687
-e WEB_SCREENSHOT=\" ${CI_WEB}\" \
666
688
-e WEB_AUTH=\" ${CI_AUTH}\" \
667
689
-e WEB_PATH=\" ${CI_WEBPATH}\" \
668
- -e DO_REGION="ams3" \
669
- -e DO_BUCKET="lsio-ci" \
670
690
-t ghcr.io/linuxserver/ci:latest \
671
691
python3 test_build.py'''
672
692
}
@@ -920,8 +940,67 @@ pipeline {
920
940
environment name : ' EXIT_STATUS' , value : ' '
921
941
}
922
942
steps {
923
- sh ''' curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
924
- -d '{"body": "I am a bot, here are the test results for this PR: \\ n'${CI_URL}' \\ n'${SHELLCHECK_URL}'"}' '''
943
+ sh ''' #! /bin/bash
944
+ # Function to retrieve JSON data from URL
945
+ get_json() {
946
+ local url="$1"
947
+ local response=$(curl -s "$url")
948
+ if [ $? -ne 0 ]; then
949
+ echo "Failed to retrieve JSON data from $url"
950
+ return 1
951
+ fi
952
+ local json=$(echo "$response" | jq .)
953
+ if [ $? -ne 0 ]; then
954
+ echo "Failed to parse JSON data from $url"
955
+ return 1
956
+ fi
957
+ echo "$json"
958
+ }
959
+
960
+ build_table() {
961
+ local data="$1"
962
+
963
+ # Get the keys in the JSON data
964
+ local keys=$(echo "$data" | jq -r 'to_entries | map(.key) | .[]')
965
+
966
+ # Check if keys are empty
967
+ if [ -z "$keys" ]; then
968
+ echo "JSON report data does not contain any keys or the report does not exist."
969
+ return 1
970
+ fi
971
+
972
+ # Build table header
973
+ local header="| Tag | Passed |\\ n| --- | --- |\\ n"
974
+
975
+ # Loop through the JSON data to build the table rows
976
+ local rows=""
977
+ for build in $keys; do
978
+ local status=$(echo "$data" | jq -r ".[\\ "$build\\ "].test_success")
979
+ if [ "$status" = "true" ]; then
980
+ status="✅"
981
+ else
982
+ status="❌"
983
+ fi
984
+ local row="| "$build" | "$status" |\\ n"
985
+ rows="${rows}${row}"
986
+ done
987
+
988
+ local table="${header}${rows}"
989
+ local escaped_table=$(echo "$table" | sed 's/\" /\\\\ "/g')
990
+ echo "$escaped_table"
991
+ }
992
+
993
+ # Retrieve JSON data from URL
994
+ data=$(get_json "$CI_JSON_URL")
995
+ # Create table from JSON data
996
+ table=$(build_table "$data")
997
+ echo -e "$table"
998
+
999
+ curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
1000
+ -H "Accept: application/vnd.github.v3+json" \
1001
+ "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1002
+ -d "{\\ "body\\ ": \\ "I am a bot, here are the test results for this PR: \\ n${CI_URL}\\ n${SHELLCHECK_URL}\\ n${table}\\ "}"'''
1003
+
925
1004
}
926
1005
}
927
1006
}
0 commit comments