@@ -76,6 +76,7 @@ pipeline {
7676 script{
7777 env. EXIT_STATUS = ' '
7878 env. CI_TEST_ATTEMPTED = ' '
79+ env. PUSH_ATTEMPTED = ' '
7980 env. LS_RELEASE = sh(
8081 script : ''' docker run --rm quay.io/skopeo/stable:v1 inspect docker://ghcr.io/${LS_USER}/${CONTAINER_NAME}:el-xfce 2>/dev/null | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\ -ls' || : ''' ,
8182 returnStdout : true ). trim()
@@ -94,7 +95,7 @@ pipeline {
9495 env. CODE_URL = ' https://github.com/' + env. LS_USER + ' /' + env. LS_REPO + ' /commit/' + env. GIT_COMMIT
9596 env. DOCKERHUB_LINK = ' https://hub.docker.com/r/' + env. DOCKERHUB_IMAGE + ' /tags/'
9697 env. PULL_REQUEST = env. CHANGE_ID
97- env. TEMPLATED_FILES = ' Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/call_issue_pr_tracker.yml ./.github/workflows/call_issues_cron.yml ./.github/workflows/permissions.yml ./.github/workflows/external_trigger.yml '
98+ env. TEMPLATED_FILES = ' Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./root/etc/s6-overlay/s6-rc.d/init-deprecate/run ./root/etc/s6-overlay/s6-rc.d/init-deprecate/up ./root/etc/s6-overlay/s6-rc.d/init-deprecate/type ./root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d/init-config-end ./root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d/init-deprecate ./root/etc/s6-overlay/s6-rc.d/user/contents.d/init-deprecate '
9899 if ( env. SYFT_IMAGE_TAG == null ) {
99100 env. SYFT_IMAGE_TAG = ' latest'
100101 }
@@ -333,6 +334,7 @@ pipeline {
333334 fi
334335 echo "Starting Stage 2 - Delete old templates"
335336 OLD_TEMPLATES=".github/ISSUE_TEMPLATE.md .github/ISSUE_TEMPLATE/issue.bug.md .github/ISSUE_TEMPLATE/issue.feature.md .github/workflows/call_invalid_helper.yml .github/workflows/stale.yml .github/workflows/package_trigger.yml"
337+ OLD_TEMPLATES="${OLD_TEMPLATES} $(echo .github/workflows/{external_trigger,external_trigger_scheduler,package_trigger_scheduler,call_issue_pr_tracker,call_issues_cron}.yml)"
336338 for i in ${OLD_TEMPLATES}; do
337339 if [[ -f "${i}" ]]; then
338340 TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
@@ -368,6 +370,10 @@ pipeline {
368370 cd ${TEMPDIR}/docker-${CONTAINER_NAME}
369371 mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
370372 mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
373+ mkdir -p \
374+ ${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d \
375+ ${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d \
376+ ${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/user/contents.d
371377 cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
372378 cp --parents readme-vars.yml ${TEMPDIR}/repo/${LS_REPO}/ || :
373379 cd ${TEMPDIR}/repo/${LS_REPO}/
@@ -397,6 +403,19 @@ pipeline {
397403 git add docs/images/docker-${CONTAINER_NAME}.md
398404 echo "Updating docs repo"
399405 git commit -m 'Bot Updating Documentation'
406+ git mv docs/images/docker-${CONTAINER_NAME}.md docs/deprecated_images/docker-${CONTAINER_NAME}.md || :
407+ if ! command -v yq || ! yq --help | grep -q 'mikefarah'; then
408+ YQ_DL_VERSION=$(curl -fsX GET "https://api.github.com/repos/mikefarah/yq/releases/latest" | jq -r '. | .tag_name')
409+ echo "No yq found, retrieving from upstream release version ${YQ_DL_VERSION}"
410+ curl -fo /usr/local/bin/yq -L "https://github.com/mikefarah/yq/releases/download/${YQ_DL_VERSION}/yq_linux_amd64"
411+ chmod +x /usr/local/bin/yq
412+ fi
413+ if ! yq -e '.plugins.[].redirects.redirect_maps.[] | select(. == "deprecated_images/docker-" + env(CONTAINER_NAME) + ".md")' mkdocs.yml >/dev/null 2>&1; then
414+ echo "Updating mkdocs.yml with deprecation info"
415+ yq -i '(.plugins.[] | select(.redirects)).redirects.redirect_maps |= . + {"images/docker-" + env(CONTAINER_NAME) + ".md" : "deprecated_images/docker-" + env(CONTAINER_NAME) + ".md"}' mkdocs.yml
416+ git add mkdocs.yml
417+ fi
418+ git commit -m 'Bot Moving Deprecated Documentation' || :
400419 git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase
401420 git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} || \
402421 (MAXWAIT="10" && echo "Push to docs failed, trying again in ${MAXWAIT} seconds" && \
@@ -860,6 +879,9 @@ pipeline {
860879 environment name : ' EXIT_STATUS' , value : ' '
861880 }
862881 steps {
882+ script{
883+ env. PUSH_ATTEMPTED = ' true'
884+ }
863885 retry_backoff(5 ,5 ) {
864886 sh ''' #! /bin/bash
865887 set -e
@@ -877,6 +899,7 @@ pipeline {
877899 docker buildx imagetools create --prefer-index=false -t ${PUSHIMAGE}:${SEMVER} ${CACHEIMAGE}:amd64-${COMMIT_SHA}-${BUILD_NUMBER} || \
878900 { if [[ "${PUSHIMAGE}" != "${QUAYIMAGE}" ]]; then exit 1; fi; }
879901 fi
902+ docker buildx imagetools create -t ${PUSHIMAGE}:el-xfce ghcr.io/linuxserver/jenkins-builder:empty || true
880903 done
881904 '''
882905 }
@@ -889,11 +912,18 @@ pipeline {
889912 environment name : ' EXIT_STATUS' , value : ' '
890913 }
891914 steps {
915+ script{
916+ env. PUSH_ATTEMPTED = ' true'
917+ }
892918 retry_backoff(5 ,5 ) {
893919 sh ''' #! /bin/bash
894920 set -e
895921 for MANIFESTIMAGE in "${IMAGE}" "${GITLABIMAGE}" "${GITHUBIMAGE}" "${QUAYIMAGE}"; do
896- [[ ${MANIFESTIMAGE%%/*} =~ \\ . ]] && MANIFESTIMAGEPLUS="${MANIFESTIMAGE}" || MANIFESTIMAGEPLUS="docker.io/${MANIFESTIMAGE}"
922+ if [[ "${MANIFESTIMAGE%%/*}" =~ \\ . ]]; then
923+ MANIFESTIMAGEPLUS="${MANIFESTIMAGE}"
924+ else
925+ MANIFESTIMAGEPLUS="docker.io/${MANIFESTIMAGE}"
926+ fi
897927 IFS=',' read -ra CACHE <<< "$BUILDCACHE"
898928 for i in "${CACHE[@]}"; do
899929 if [[ "${MANIFESTIMAGEPLUS}" == "$(cut -d "/" -f1 <<< ${i})"* ]]; then
@@ -912,8 +942,7 @@ pipeline {
912942 fi
913943 done
914944 for MANIFESTIMAGE in "${IMAGE}" "${GITLABIMAGE}" "${GITHUBIMAGE}" "${QUAYIMAGE}"; do
915- docker buildx imagetools create -t ${MANIFESTIMAGE}:el-xfce ${MANIFESTIMAGE}:amd64-el-xfce ${MANIFESTIMAGE}:arm64v8-el-xfce || \
916- { if [[ "${MANIFESTIMAGE}" != "${QUAYIMAGE}" ]]; then exit 1; fi; }
945+ docker buildx imagetools create -t ${MANIFESTIMAGE}:el-xfce -t ${MANIFESTIMAGE}:amd64-el-xfce -t ${MANIFESTIMAGE}:arm64v8-el-xfce ghcr.io/linuxserver/jenkins-builder:empty || true
917946 docker buildx imagetools create -t ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG} || \
918947 { if [[ "${MANIFESTIMAGE}" != "${QUAYIMAGE}" ]]; then exit 1; fi; }
919948 docker buildx imagetools create -t ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG} || \
@@ -1010,6 +1039,26 @@ EOF
10101039 ) '''
10111040 }
10121041 }
1042+ stage(' Deprecate/Disable Future Builds' ) {
1043+ when {
1044+ branch " el-xfce"
1045+ environment name : ' CHANGE_ID' , value : ' '
1046+ environment name : ' EXIT_STATUS' , value : ' '
1047+ }
1048+ steps {
1049+ sh ''' #! /bin/bash
1050+ TEMPDIR=$(mktemp -d)
1051+ mkdir -p ${TEMPDIR}/repo
1052+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
1053+ cd ${TEMPDIR}/repo/${LS_REPO}
1054+ git checkout -f el-xfce
1055+ git rm Jenkinsfile
1056+ git commit -m 'Disabling future builds'
1057+ git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git el-xfce
1058+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git el-xfce
1059+ rm -Rf ${TEMPDIR}'''
1060+ }
1061+ }
10131062 }
10141063 /* ######################
10151064 Comment on PR and Send status to Discord
@@ -1061,7 +1110,7 @@ EOF
10611110 }
10621111 script {
10631112 if (env. GITHUBIMAGE =~ / lspipepr/ ){
1064- if (env. CI_TEST_ATTEMPTED == " true" ){
1113+ if (env. CI_TEST_ATTEMPTED == " true" || env . PUSH_ATTEMPTED == " true " ){
10651114 sh ''' #! /bin/bash
10661115 # Function to retrieve JSON data from URL
10671116 get_json() {
@@ -1122,14 +1171,21 @@ EOF
11221171 curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
11231172 -H "Accept: application/vnd.github.v3+json" \
11241173 "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1125- -d "{\\ "body\\ ": \\ "I am a bot, here are the test results for this PR: \\ n${CI_URL}\\ n${SHELLCHECK_URL}\\ n${table}\\ "}"
1174+ -d "{\\ "body\\ ": \\ "I am a bot, here are the test results for this PR for commit ${COMMIT_SHA:0:7} : \\ n${CI_URL}\\ n${SHELLCHECK_URL}\\ n${table}\\ "}"
11261175 else
11271176 curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
11281177 -H "Accept: application/vnd.github.v3+json" \
11291178 "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1130- -d "{\\ "body\\ ": \\ "I am a bot, here is the pushed image/manifest for this PR: \\ n\\ n\\ `${GITHUBIMAGE}:${META_TAG}\\ `\\ "}"
1179+ -d "{\\ "body\\ ": \\ "I am a bot, here is the pushed image/manifest for this PR for commit ${COMMIT_SHA:0:7} : \\ n\\ n\\ `${GITHUBIMAGE}:${META_TAG}\\ `\\ "}"
11311180 fi
11321181 '''
1182+ } else {
1183+ sh ''' #! /bin/bash
1184+ curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
1185+ -H "Accept: application/vnd.github.v3+json" \
1186+ "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1187+ -d "{\\ "body\\ ": \\ "I am a bot, the build for PR commit ${COMMIT_SHA:0:7} failed and as a result no CI test was attempted and no images were pushed.\\ "}"
1188+ '''
11331189 }
11341190 }
11351191 }
0 commit comments