Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.

Commit 6acf580

Browse files
Bot Updating Templated Files
1 parent 8b4a90c commit 6acf580

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
@@ -64,7 +64,7 @@ pipeline {
6464
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
6565
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
6666
env.PULL_REQUEST = env.CHANGE_ID
67-
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'
67+
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'
6868
}
6969
script{
7070
env.LS_RELEASE_NUMBER = sh(
@@ -290,6 +290,7 @@ pipeline {
290290
fi
291291
# Stage 2 - Delete old templates
292292
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"
293+
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)"
293294
for i in ${OLD_TEMPLATES}; do
294295
if [[ -f "${i}" ]]; then
295296
TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
@@ -324,6 +325,14 @@ pipeline {
324325
cd ${TEMPDIR}/docker-${CONTAINER_NAME}
325326
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
326327
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
328+
if [[ -d "${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d" ]]; then
329+
mkdir -p \
330+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d \
331+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d \
332+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/user/contents.d
333+
else
334+
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/root/etc/cont-init.d
335+
fi
327336
cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
328337
cp --parents readme-vars.yml ${TEMPDIR}/repo/${LS_REPO}/ || :
329338
cd ${TEMPDIR}/repo/${LS_REPO}/
@@ -357,6 +366,10 @@ pipeline {
357366
fi
358367
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
359368
cd ${TEMPDIR}/unraid/templates/
369+
if ! grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
370+
echo "${CONTAINER_NAME}" >> ${TEMPDIR}/unraid/templates/unraid/ignore.list
371+
git add unraid/ignore.list
372+
fi
360373
if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
361374
echo "Image is on the ignore list, marking Unraid template as deprecated"
362375
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
@@ -975,6 +988,25 @@ EOF
975988

976989
}
977990
}
991+
stage('Deprecate/Disable Future Builds') {
992+
when {
993+
branch "master"
994+
environment name: 'CHANGE_ID', value: ''
995+
environment name: 'EXIT_STATUS', value: ''
996+
}
997+
steps {
998+
sh '''#! /bin/bash
999+
TEMPDIR=$(mktemp -d)
1000+
mkdir -p ${TEMPDIR}/repo
1001+
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
1002+
cd ${TEMPDIR}/repo/${LS_REPO}
1003+
git checkout -f master
1004+
git rm Jenkinsfile
1005+
git commit -m 'Disabling future builds'
1006+
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
1007+
rm -Rf ${TEMPDIR}'''
1008+
}
1009+
}
9781010
}
9791011
/* ######################
9801012
Send status to Discord

0 commit comments

Comments
 (0)