Skip to content

Commit 7d8c61e

Browse files
Bot Updating Templated Files
1 parent 189ef7c commit 7d8c61e

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
@@ -57,7 +57,7 @@ pipeline {
5757
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
5858
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
5959
env.PULL_REQUEST = env.CHANGE_ID
60-
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 ./root/donate.txt'
60+
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/cont-init.d/99-deprecation'
6161
}
6262
script{
6363
env.LS_RELEASE_NUMBER = sh(
@@ -276,6 +276,7 @@ pipeline {
276276
fi
277277
# Stage 2 - Delete old templates
278278
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"
279+
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)"
279280
for i in ${OLD_TEMPLATES}; do
280281
if [[ -f "${i}" ]]; then
281282
TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
@@ -310,6 +311,14 @@ pipeline {
310311
cd ${TEMPDIR}/docker-${CONTAINER_NAME}
311312
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
312313
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
314+
if [[ -d "${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d" ]]; then
315+
mkdir -p \
316+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d \
317+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d \
318+
${TEMPDIR}/repo/${LS_REPO}/root/etc/s6-overlay/s6-rc.d/user/contents.d
319+
else
320+
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/root/etc/cont-init.d
321+
fi
313322
cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
314323
cd ${TEMPDIR}/repo/${LS_REPO}/
315324
if ! grep -q '.jenkins-external' .gitignore 2>/dev/null; then
@@ -340,6 +349,10 @@ pipeline {
340349
fi
341350
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
342351
cd ${TEMPDIR}/unraid/templates/
352+
if ! grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
353+
echo "${CONTAINER_NAME}" >> ${TEMPDIR}/unraid/templates/unraid/ignore.list
354+
git add unraid/ignore.list
355+
fi
343356
if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
344357
echo "Image is on the ignore list, marking Unraid template as deprecated"
345358
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
@@ -1032,6 +1045,25 @@ pipeline {
10321045

10331046
}
10341047
}
1048+
stage('Deprecate/Disable Future Builds') {
1049+
when {
1050+
branch "alpine"
1051+
environment name: 'CHANGE_ID', value: ''
1052+
environment name: 'EXIT_STATUS', value: ''
1053+
}
1054+
steps {
1055+
sh '''#! /bin/bash
1056+
TEMPDIR=$(mktemp -d)
1057+
mkdir -p ${TEMPDIR}/repo
1058+
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
1059+
cd ${TEMPDIR}/repo/${LS_REPO}
1060+
git checkout -f alpine
1061+
git rm Jenkinsfile
1062+
git commit -m 'Disabling future builds'
1063+
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
1064+
rm -Rf ${TEMPDIR}'''
1065+
}
1066+
}
10351067
}
10361068
/* ######################
10371069
Send status to Discord

0 commit comments

Comments
 (0)