Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit f3919cb

Browse files
Bot Updating Templated Files
1 parent 9b31fa3 commit f3919cb

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

Jenkinsfile

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pipeline {
5555
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
5656
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
5757
env.PULL_REQUEST = env.CHANGE_ID
58-
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 ./.github/workflows/package_trigger.yml'
58+
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/cont-init.d/99-deprecation'
5959
}
6060
script{
6161
env.LS_RELEASE_NUMBER = sh(
@@ -272,6 +272,7 @@ pipeline {
272272
fi
273273
# Stage 2 - Delete old templates
274274
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 Dockerfile.armhf"
275+
OLD_TEMPLATES="${OLD_TEMPLATES} $(echo .github/workflows/{external_trigger,external_trigger_scheduler,package_trigger,package_trigger_scheduler,call_issue_pr_tracker,call_issues_cron}.yml)"
275276
for i in ${OLD_TEMPLATES}; do
276277
if [[ -f "${i}" ]]; then
277278
TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
@@ -306,6 +307,14 @@ pipeline {
306307
cd ${TEMPDIR}/docker-${CONTAINER_NAME}
307308
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
308309
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
310+
if [[ -d "${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d" ]]; then
311+
mkdir -p \
312+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d \
313+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d \
314+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/user/contents.d
315+
else
316+
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/root/etc/cont-init.d
317+
fi
309318
cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
310319
cp --parents readme-vars.yml ${TEMPDIR}/repo/${LS_REPO}/ || :
311320
cd ${TEMPDIR}/repo/${LS_REPO}/
@@ -339,6 +348,10 @@ pipeline {
339348
fi
340349
if [[ ("${BRANCH_NAME}" == "master") || ("${BRANCH_NAME}" == "main") ]] && [[ (! -f ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml) || ("$(md5sum ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml | awk '{ print $1 }')") ]]; then
341350
cd ${TEMPDIR}/unraid/templates/
351+
if ! grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
352+
echo "${CONTAINER_NAME}" >> ${TEMPDIR}/unraid/templates/unraid/ignore.list
353+
git add unraid/ignore.list
354+
fi
342355
if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
343356
echo "Image is on the ignore list, marking Unraid template as deprecated"
344357
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
@@ -951,6 +964,25 @@ pipeline {
951964

952965
}
953966
}
967+
stage('Deprecate/Disable Future Builds') {
968+
when {
969+
branch "master"
970+
environment name: 'CHANGE_ID', value: ''
971+
environment name: 'EXIT_STATUS', value: ''
972+
}
973+
steps {
974+
sh '''#! /bin/bash
975+
TEMPDIR=$(mktemp -d)
976+
mkdir -p ${TEMPDIR}/repo
977+
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
978+
cd ${TEMPDIR}/repo/${LS_REPO}
979+
git checkout -f master
980+
git rm Jenkinsfile
981+
git commit -m 'Disabling future builds'
982+
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
983+
rm -Rf ${TEMPDIR}'''
984+
}
985+
}
954986
}
955987
/* ######################
956988
Send status to Discord

0 commit comments

Comments
 (0)