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