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