@@ -39,10 +39,11 @@ pipeline {
3939 // Setup all the basic environment variables needed for the build
4040 stage(" Set ENV Variables base" ){
4141 steps{
42+ sh ''' docker pull quay.io/skopeo/stable:v1 || : '''
4243 script{
4344 env. EXIT_STATUS = ' '
4445 env. LS_RELEASE = sh(
45- script : ''' docker run --rm ghcr .io/linuxserver/alexeiled- skopeo sh -c 'skopeo inspect docker://docker .io/'${DOCKERHUB_IMAGE}' :mongoless 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} :mongoless 2>/dev/null | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\ -ls' || : ''' ,
4647 returnStdout : true ). trim()
4748 env. LS_RELEASE_NOTES = sh(
4849 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 {
228229 script{
229230 env. SHELLCHECK_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /shellcheck-result.xml'
230231 }
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'''
232233 sh ''' #! /bin/bash
233234 docker run --rm \
234235 -v ${WORKSPACE}:/mnt \
@@ -376,6 +377,26 @@ pipeline {
376377 }
377378 }
378379 }
380+ // If this is a mongoless build check the S6 service file perms
381+ stage(" Check S6 Service file Permissions" ){
382+ when {
383+ branch " mongoless"
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+ }
379400 /* #######################
380401 GitLab Mirroring
381402 ####################### */
@@ -633,6 +654,7 @@ pipeline {
633654 ]) {
634655 script{
635656 env. CI_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /index.html'
657+ env. CI_JSON_URL = ' https://ci-tests.linuxserver.io/' + env. IMAGE + ' /' + env. META_TAG + ' /report.json'
636658 }
637659 sh ''' #! /bin/bash
638660 set -e
@@ -657,8 +679,6 @@ pipeline {
657679 -e WEB_SCREENSHOT=\" ${CI_WEB}\" \
658680 -e WEB_AUTH=\" ${CI_AUTH}\" \
659681 -e WEB_PATH=\" ${CI_WEBPATH}\" \
660- -e DO_REGION="ams3" \
661- -e DO_BUCKET="lsio-ci" \
662682 -t ghcr.io/linuxserver/ci:latest \
663683 python3 test_build.py'''
664684 }
@@ -792,6 +812,9 @@ pipeline {
792812 docker manifest create ${MANIFESTIMAGE}:${SEMVER} ${MANIFESTIMAGE}:amd64-${SEMVER} ${MANIFESTIMAGE}:arm64v8-${SEMVER}
793813 docker manifest annotate ${MANIFESTIMAGE}:${SEMVER} ${MANIFESTIMAGE}:arm64v8-${SEMVER} --os linux --arch arm64 --variant v8
794814 fi
815+ docker manifest push --purge ${MANIFESTIMAGE}:arm32v7-mongoless || :
816+ docker manifest create ${MANIFESTIMAGE}:arm32v7-mongoless ${MANIFESTIMAGE}:amd64-mongoless
817+ docker manifest push --purge ${MANIFESTIMAGE}:arm32v7-mongoless
795818 docker manifest push --purge ${MANIFESTIMAGE}:mongoless
796819 docker manifest push --purge ${MANIFESTIMAGE}:${META_TAG}
797820 docker manifest push --purge ${MANIFESTIMAGE}:${EXT_RELEASE_TAG}
@@ -893,8 +916,67 @@ pipeline {
893916 environment name : ' EXIT_STATUS' , value : ' '
894917 }
895918 steps {
896- sh ''' curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
897- -d '{"body": "I am a bot, here are the test results for this PR: \\ n'${CI_URL}' \\ n'${SHELLCHECK_URL}'"}' '''
919+ sh ''' #! /bin/bash
920+ # Function to retrieve JSON data from URL
921+ get_json() {
922+ local url="$1"
923+ local response=$(curl -s "$url")
924+ if [ $? -ne 0 ]; then
925+ echo "Failed to retrieve JSON data from $url"
926+ return 1
927+ fi
928+ local json=$(echo "$response" | jq .)
929+ if [ $? -ne 0 ]; then
930+ echo "Failed to parse JSON data from $url"
931+ return 1
932+ fi
933+ echo "$json"
934+ }
935+
936+ build_table() {
937+ local data="$1"
938+
939+ # Get the keys in the JSON data
940+ local keys=$(echo "$data" | jq -r 'to_entries | map(.key) | .[]')
941+
942+ # Check if keys are empty
943+ if [ -z "$keys" ]; then
944+ echo "JSON report data does not contain any keys or the report does not exist."
945+ return 1
946+ fi
947+
948+ # Build table header
949+ local header="| Tag | Passed |\\ n| --- | --- |\\ n"
950+
951+ # Loop through the JSON data to build the table rows
952+ local rows=""
953+ for build in $keys; do
954+ local status=$(echo "$data" | jq -r ".[\\ "$build\\ "].test_success")
955+ if [ "$status" = "true" ]; then
956+ status="✅"
957+ else
958+ status="❌"
959+ fi
960+ local row="| "$build" | "$status" |\\ n"
961+ rows="${rows}${row}"
962+ done
963+
964+ local table="${header}${rows}"
965+ local escaped_table=$(echo "$table" | sed 's/\" /\\\\ "/g')
966+ echo "$escaped_table"
967+ }
968+
969+ # Retrieve JSON data from URL
970+ data=$(get_json "$CI_JSON_URL")
971+ # Create table from JSON data
972+ table=$(build_table "$data")
973+ echo -e "$table"
974+
975+ curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
976+ -H "Accept: application/vnd.github.v3+json" \
977+ "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
978+ -d "{\\ "body\\ ": \\ "I am a bot, here are the test results for this PR: \\ n${CI_URL}\\ n${SHELLCHECK_URL}\\ n${table}\\ "}"'''
979+
898980 }
899981 }
900982 }
0 commit comments