@@ -39,10 +39,11 @@ pipeline {
39
39
// Setup all the basic environment variables needed for the build
40
40
stage(" Set ENV Variables base" ){
41
41
steps{
42
+ sh ''' docker pull quay.io/skopeo/stable:v1 || : '''
42
43
script{
43
44
env. EXIT_STATUS = ' '
44
45
env. LS_RELEASE = sh(
45
- 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' || : ''' ,
46
+ 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' || : ''' ,
46
47
returnStdout : true ). trim()
47
48
env. LS_RELEASE_NOTES = sh(
48
49
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' ''' ,
@@ -226,7 +227,7 @@ pipeline {
226
227
script{
227
228
env. SHELLCHECK_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /shellcheck-result.xml'
228
229
}
229
- sh ''' curl -sL https://raw.githubusercontent.com/linuxserver/docker-shellcheck /master/checkrun.sh | /bin/bash'''
230
+ sh ''' curl -sL https://raw.githubusercontent.com/linuxserver/docker-jenkins-builder /master/checkrun.sh | /bin/bash'''
230
231
sh ''' #! /bin/bash
231
232
docker run --rm \
232
233
-v ${WORKSPACE}:/mnt \
@@ -374,6 +375,26 @@ pipeline {
374
375
}
375
376
}
376
377
}
378
+ // If this is a master build check the S6 service file perms
379
+ stage(" Check S6 Service file Permissions" ){
380
+ when {
381
+ branch " master"
382
+ environment name : ' CHANGE_ID' , value : ' '
383
+ environment name : ' EXIT_STATUS' , value : ' '
384
+ }
385
+ steps {
386
+ script{
387
+ sh ''' #! /bin/bash
388
+ WRONG_PERM=$(find ./ -path "./.git" -prune -o \\ ( -name "run" -o -name "finish" -o -name "check" \\ ) -not -perm -u=x,g=x,o=x -print)
389
+ if [[ -n "${WRONG_PERM}" ]]; then
390
+ echo "The following S6 service files are missing the executable bit; canceling the faulty build: ${WRONG_PERM}"
391
+ exit 1
392
+ else
393
+ echo "S6 service file perms look good."
394
+ fi '''
395
+ }
396
+ }
397
+ }
377
398
/* #######################
378
399
GitLab Mirroring
379
400
####################### */
@@ -666,6 +687,7 @@ pipeline {
666
687
]) {
667
688
script{
668
689
env. CI_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /index.html'
690
+ env. CI_JSON_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /report.json'
669
691
}
670
692
sh ''' #! /bin/bash
671
693
set -e
@@ -692,8 +714,6 @@ pipeline {
692
714
-e WEB_SCREENSHOT=\" ${CI_WEB}\" \
693
715
-e WEB_AUTH=\" ${CI_AUTH}\" \
694
716
-e WEB_PATH=\" ${CI_WEBPATH}\" \
695
- -e DO_REGION="ams3" \
696
- -e DO_BUCKET="lsio-ci" \
697
717
-t ghcr.io/linuxserver/ci:latest \
698
718
python3 test_build.py'''
699
719
}
@@ -947,8 +967,67 @@ pipeline {
947
967
environment name : ' EXIT_STATUS' , value : ' '
948
968
}
949
969
steps {
950
- sh ''' curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
951
- -d '{"body": "I am a bot, here are the test results for this PR: \\ n'${CI_URL}' \\ n'${SHELLCHECK_URL}'"}' '''
970
+ sh ''' #! /bin/bash
971
+ # Function to retrieve JSON data from URL
972
+ get_json() {
973
+ local url="$1"
974
+ local response=$(curl -s "$url")
975
+ if [ $? -ne 0 ]; then
976
+ echo "Failed to retrieve JSON data from $url"
977
+ return 1
978
+ fi
979
+ local json=$(echo "$response" | jq .)
980
+ if [ $? -ne 0 ]; then
981
+ echo "Failed to parse JSON data from $url"
982
+ return 1
983
+ fi
984
+ echo "$json"
985
+ }
986
+
987
+ build_table() {
988
+ local data="$1"
989
+
990
+ # Get the keys in the JSON data
991
+ local keys=$(echo "$data" | jq -r 'to_entries | map(.key) | .[]')
992
+
993
+ # Check if keys are empty
994
+ if [ -z "$keys" ]; then
995
+ echo "JSON report data does not contain any keys or the report does not exist."
996
+ return 1
997
+ fi
998
+
999
+ # Build table header
1000
+ local header="| Tag | Passed |\\ n| --- | --- |\\ n"
1001
+
1002
+ # Loop through the JSON data to build the table rows
1003
+ local rows=""
1004
+ for build in $keys; do
1005
+ local status=$(echo "$data" | jq -r ".[\\ "$build\\ "].test_success")
1006
+ if [ "$status" = "true" ]; then
1007
+ status="✅"
1008
+ else
1009
+ status="❌"
1010
+ fi
1011
+ local row="| "$build" | "$status" |\\ n"
1012
+ rows="${rows}${row}"
1013
+ done
1014
+
1015
+ local table="${header}${rows}"
1016
+ local escaped_table=$(echo "$table" | sed 's/\" /\\\\ "/g')
1017
+ echo "$escaped_table"
1018
+ }
1019
+
1020
+ # Retrieve JSON data from URL
1021
+ data=$(get_json "$CI_JSON_URL")
1022
+ # Create table from JSON data
1023
+ table=$(build_table "$data")
1024
+ echo -e "$table"
1025
+
1026
+ curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
1027
+ -H "Accept: application/vnd.github.v3+json" \
1028
+ "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1029
+ -d "{\\ "body\\ ": \\ "I am a bot, here are the test results for this PR: \\ n${CI_URL}\\ n${SHELLCHECK_URL}\\ n${table}\\ "}"'''
1030
+
952
1031
}
953
1032
}
954
1033
}
0 commit comments