Skip to content

Commit 4246c46

Browse files
Bot Updating Templated Files
1 parent 2733c75 commit 4246c46

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

Jenkinsfile

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pipeline {
9393
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
9494
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
9595
env.PULL_REQUEST = env.CHANGE_ID
96-
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'
96+
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'
9797
if ( env.SYFT_IMAGE_TAG == null ) {
9898
env.SYFT_IMAGE_TAG = 'latest'
9999
}
@@ -329,6 +329,7 @@ pipeline {
329329
fi
330330
echo "Starting Stage 2 - Delete old templates"
331331
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"
332+
OLD_TEMPLATES="${OLD_TEMPLATES} $(echo .github/workflows/{external_trigger,external_trigger_scheduler,package_trigger_scheduler,call_issue_pr_tracker,call_issues_cron}.yml)"
332333
for i in ${OLD_TEMPLATES}; do
333334
if [[ -f "${i}" ]]; then
334335
TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
@@ -364,6 +365,10 @@ pipeline {
364365
cd ${TEMPDIR}/docker-${CONTAINER_NAME}
365366
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
366367
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
368+
mkdir -p \
369+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d \
370+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d \
371+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/user/contents.d
367372
cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
368373
cp --parents readme-vars.yml ${TEMPDIR}/repo/${LS_REPO}/ || :
369374
cd ${TEMPDIR}/repo/${LS_REPO}/
@@ -393,6 +398,19 @@ pipeline {
393398
git add docs/images/docker-${CONTAINER_NAME}.md
394399
echo "Updating docs repo"
395400
git commit -m 'Bot Updating Documentation'
401+
git mv docs/images/docker-${CONTAINER_NAME}.md docs/deprecated_images/docker-${CONTAINER_NAME}.md || :
402+
if ! command -v yq || ! yq --help | grep -q 'mikefarah'; then
403+
YQ_DL_VERSION=$(curl -fsX GET "https://api.github.com/repos/mikefarah/yq/releases/latest" | jq -r '. | .tag_name')
404+
echo "No yq found, retrieving from upstream release version ${YQ_DL_VERSION}"
405+
curl -fo /usr/local/bin/yq -L "https://github.com/mikefarah/yq/releases/download/${YQ_DL_VERSION}/yq_linux_amd64"
406+
chmod +x /usr/local/bin/yq
407+
fi
408+
if ! yq -e '.plugins.[].redirects.redirect_maps.[] | select(. == "deprecated_images/docker-" + env(CONTAINER_NAME) + ".md")' mkdocs.yml >/dev/null 2>&1; then
409+
echo "Updating mkdocs.yml with deprecation info"
410+
yq -i '(.plugins.[] | select(.redirects)).redirects.redirect_maps |= . + {"images/docker-" + env(CONTAINER_NAME) + ".md" : "deprecated_images/docker-" + env(CONTAINER_NAME) + ".md"}' mkdocs.yml
411+
git add mkdocs.yml
412+
fi
413+
git commit -m 'Bot Moving Deprecated Documentation' || :
396414
git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase
397415
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} || \
398416
(MAXWAIT="10" && echo "Push to docs failed, trying again in ${MAXWAIT} seconds" && \
@@ -860,6 +878,7 @@ pipeline {
860878
if [ -n "${SEMVER}" ]; then
861879
docker buildx imagetools create --prefer-index=false -t ${PUSHIMAGE}:${SEMVER} ${CACHEIMAGE}:amd64-${COMMIT_SHA}-${BUILD_NUMBER}
862880
fi
881+
docker buildx imagetools create -t ${PUSHIMAGE}:fedora-icewm ghcr.io/linuxserver/jenkins-builder:empty || true
863882
done
864883
'''
865884
}
@@ -891,7 +910,7 @@ pipeline {
891910
fi
892911
done
893912
for MANIFESTIMAGE in "${IMAGE}" "${GITLABIMAGE}" "${GITHUBIMAGE}" "${QUAYIMAGE}"; do
894-
docker buildx imagetools create -t ${MANIFESTIMAGE}:fedora-icewm ${MANIFESTIMAGE}:amd64-fedora-icewm ${MANIFESTIMAGE}:arm64v8-fedora-icewm
913+
docker buildx imagetools create -t ${MANIFESTIMAGE}:fedora-icewm -t ${MANIFESTIMAGE}:amd64-fedora-icewm -t ${MANIFESTIMAGE}:arm64v8-fedora-icewm ghcr.io/linuxserver/jenkins-builder:empty || true
895914
docker buildx imagetools create -t ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG}
896915
897916
docker buildx imagetools create -t ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG}
@@ -1046,6 +1065,26 @@ EOF
10461065

10471066
}
10481067
}
1068+
stage('Deprecate/Disable Future Builds') {
1069+
when {
1070+
branch "fedora-icewm"
1071+
environment name: 'CHANGE_ID', value: ''
1072+
environment name: 'EXIT_STATUS', value: ''
1073+
}
1074+
steps {
1075+
sh '''#! /bin/bash
1076+
TEMPDIR=$(mktemp -d)
1077+
mkdir -p ${TEMPDIR}/repo
1078+
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
1079+
cd ${TEMPDIR}/repo/${LS_REPO}
1080+
git checkout -f fedora-icewm
1081+
git rm Jenkinsfile
1082+
git commit -m 'Disabling future builds'
1083+
git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git fedora-icewm
1084+
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git fedora-icewm
1085+
rm -Rf ${TEMPDIR}'''
1086+
}
1087+
}
10491088
}
10501089
/* ######################
10511090
Send status to Discord

0 commit comments

Comments
 (0)