@@ -81,7 +81,7 @@ pipeline {
8181 env. CODE_URL = ' https://github.com/' + env. LS_USER + ' /' + env. LS_REPO + ' /commit/' + env. GIT_COMMIT
8282 env. DOCKERHUB_LINK = ' https://hub.docker.com/r/' + env. DOCKERHUB_IMAGE + ' /tags/'
8383 env. PULL_REQUEST = env. CHANGE_ID
84- 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 ./root/donate.txt '
84+ 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/donate.txt ./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 '
8585 }
8686 sh ''' #! /bin/bash
8787 echo "The default github branch detected as ${GH_DEFAULT_BRANCH}" '''
@@ -315,6 +315,7 @@ pipeline {
315315 fi
316316 echo "Starting Stage 2 - Delete old templates"
317317 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"
318+ OLD_TEMPLATES="${OLD_TEMPLATES} $(echo .github/workflows/{external_trigger,external_trigger_scheduler,package_trigger_scheduler,call_issue_pr_tracker,call_issues_cron}.yml)"
318319 for i in ${OLD_TEMPLATES}; do
319320 if [[ -f "${i}" ]]; then
320321 TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
@@ -379,6 +380,10 @@ pipeline {
379380 cd ${TEMPDIR}/docker-${CONTAINER_NAME}
380381 mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
381382 mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
383+ mkdir -p \
384+ ${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d \
385+ ${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d \
386+ ${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/user/contents.d
382387 cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
383388 cp --parents readme-vars.yml ${TEMPDIR}/repo/${LS_REPO}/ || :
384389 cd ${TEMPDIR}/repo/${LS_REPO}/
@@ -408,6 +413,19 @@ pipeline {
408413 git add docs/images/docker-${CONTAINER_NAME}.md
409414 echo "Updating docs repo"
410415 git commit -m 'Bot Updating Documentation'
416+ git mv docs/images/docker-${CONTAINER_NAME}.md docs/deprecated_images/docker-${CONTAINER_NAME}.md || :
417+ if ! command -v yq || ! yq --help | grep -q 'mikefarah'; then
418+ YQ_DL_VERSION=$(curl -fsX GET "https://api.github.com/repos/mikefarah/yq/releases/latest" | jq -r '. | .tag_name')
419+ echo "No yq found, retrieving from upstream release version ${YQ_DL_VERSION}"
420+ curl -fo /usr/local/bin/yq -L "https://github.com/mikefarah/yq/releases/download/${YQ_DL_VERSION}/yq_linux_amd64"
421+ chmod +x /usr/local/bin/yq
422+ fi
423+ if ! yq -e '.plugins.[].redirects.redirect_maps.[] | select(. == "deprecated_images/docker-" + env(CONTAINER_NAME) + ".md")' mkdocs.yml >/dev/null 2>&1; then
424+ echo "Updating mkdocs.yml with deprecation info"
425+ yq -i '(.plugins.[] | select(.redirects)).redirects.redirect_maps |= . + {"images/docker-" + env(CONTAINER_NAME) + ".md" : "deprecated_images/docker-" + env(CONTAINER_NAME) + ".md"}' mkdocs.yml
426+ git add mkdocs.yml
427+ fi
428+ git commit -m 'Bot Moving Deprecated Documentation' || :
411429 git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase
412430 git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} || \
413431 (MAXWAIT="10" && echo "Push to docs failed, trying again in ${MAXWAIT} seconds" && \
@@ -429,6 +447,10 @@ pipeline {
429447 echo "Updating Unraid template"
430448 cd ${TEMPDIR}/unraid/templates/
431449 GH_TEMPLATES_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||')
450+ if ! grep -wq "^${CONTAINER_NAME}$" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
451+ echo "${CONTAINER_NAME}" >> ${TEMPDIR}/unraid/templates/unraid/ignore.list
452+ git add unraid/ignore.list
453+ fi
432454 if grep -wq "^${CONTAINER_NAME}$" ${TEMPDIR}/unraid/templates/unraid/ignore.list && [[ -f ${TEMPDIR}/unraid/templates/unraid/deprecated/${CONTAINER_NAME}.xml ]]; then
433455 echo "Image is on the ignore list, and already in the deprecation folder."
434456 elif grep -wq "^${CONTAINER_NAME}$" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
@@ -907,6 +929,7 @@ pipeline {
907929 if [ -n "${SEMVER}" ]; then
908930 docker buildx imagetools create --prefer-index=false -t ${PUSHIMAGE}:${SEMVER} ${CACHEIMAGE}:amd64-${COMMIT_SHA}-${BUILD_NUMBER}
909931 fi
932+ docker buildx imagetools create -t ${PUSHIMAGE}:legacy ghcr.io/linuxserver/jenkins-builder:empty || true
910933 done
911934 '''
912935 }
@@ -938,7 +961,7 @@ pipeline {
938961 fi
939962 done
940963 for MANIFESTIMAGE in "${IMAGE}" "${GITLABIMAGE}" "${GITHUBIMAGE}" "${QUAYIMAGE}"; do
941- docker buildx imagetools create -t ${MANIFESTIMAGE}:legacy ${MANIFESTIMAGE}:amd64-legacy ${MANIFESTIMAGE}:arm64v8-legacy
964+ docker buildx imagetools create -t ${MANIFESTIMAGE}:legacy -t ${MANIFESTIMAGE}:amd64-legacy -t ${MANIFESTIMAGE}:arm64v8-legacy ghcr.io/linuxserver/jenkins-builder:empty || true
942965 docker buildx imagetools create -t ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG}
943966
944967 docker buildx imagetools create -t ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG}
@@ -1093,6 +1116,26 @@ EOF
10931116
10941117 }
10951118 }
1119+ stage(' Deprecate/Disable Future Builds' ) {
1120+ when {
1121+ branch " legacy"
1122+ environment name : ' CHANGE_ID' , value : ' '
1123+ environment name : ' EXIT_STATUS' , value : ' '
1124+ }
1125+ steps {
1126+ sh ''' #! /bin/bash
1127+ TEMPDIR=$(mktemp -d)
1128+ mkdir -p ${TEMPDIR}/repo
1129+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
1130+ cd ${TEMPDIR}/repo/${LS_REPO}
1131+ git checkout -f legacy
1132+ git rm Jenkinsfile
1133+ git commit -m 'Disabling future builds'
1134+ git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git legacy
1135+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git legacy
1136+ rm -Rf ${TEMPDIR}'''
1137+ }
1138+ }
10961139 }
10971140 /* ######################
10981141 Send status to Discord
0 commit comments