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

Commit ce46490

Browse files
Bot Updating Templated Files
1 parent 1ac9dd2 commit ce46490

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
@@ -61,7 +61,7 @@ pipeline {
6161
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
6262
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
6363
env.PULL_REQUEST = env.CHANGE_ID
64-
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'
64+
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'
6565
}
6666
script{
6767
env.LS_RELEASE_NUMBER = sh(
@@ -280,6 +280,7 @@ pipeline {
280280
fi
281281
# Stage 2 - Delete old templates
282282
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"
283+
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)"
283284
for i in ${OLD_TEMPLATES}; do
284285
if [[ -f "${i}" ]]; then
285286
TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
@@ -314,6 +315,14 @@ pipeline {
314315
cd ${TEMPDIR}/docker-${CONTAINER_NAME}
315316
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
316317
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
318+
if [[ -d "${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d" ]]; then
319+
mkdir -p \
320+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d \
321+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d \
322+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/user/contents.d
323+
else
324+
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/root/etc/cont-init.d
325+
fi
317326
cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
318327
cp --parents readme-vars.yml ${TEMPDIR}/repo/${LS_REPO}/ || :
319328
cd ${TEMPDIR}/repo/${LS_REPO}/
@@ -347,6 +356,10 @@ pipeline {
347356
fi
348357
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
349358
cd ${TEMPDIR}/unraid/templates/
359+
if ! grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
360+
echo "${CONTAINER_NAME}" >> ${TEMPDIR}/unraid/templates/unraid/ignore.list
361+
git add unraid/ignore.list
362+
fi
350363
if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
351364
echo "Image is on the ignore list, marking Unraid template as deprecated"
352365
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
@@ -965,6 +978,25 @@ EOF
965978

966979
}
967980
}
981+
stage('Deprecate/Disable Future Builds') {
982+
when {
983+
branch "master"
984+
environment name: 'CHANGE_ID', value: ''
985+
environment name: 'EXIT_STATUS', value: ''
986+
}
987+
steps {
988+
sh '''#! /bin/bash
989+
TEMPDIR=$(mktemp -d)
990+
mkdir -p ${TEMPDIR}/repo
991+
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
992+
cd ${TEMPDIR}/repo/${LS_REPO}
993+
git checkout -f master
994+
git rm Jenkinsfile
995+
git commit -m 'Disabling future builds'
996+
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
997+
rm -Rf ${TEMPDIR}'''
998+
}
999+
}
9681000
}
9691001
/* ######################
9701002
Send status to Discord

0 commit comments

Comments
 (0)