Skip to content

Commit 2c8da06

Browse files
Bot Updating Templated Files
1 parent 3e0e82e commit 2c8da06

File tree

1 file changed

+71
-17
lines changed

1 file changed

+71
-17
lines changed

Jenkinsfile

Lines changed: 71 additions & 17 deletions
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 ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.md ./.github/ISSUE_TEMPLATE/issue.feature.md ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/greetings.yml ./.github/workflows/stale.yml ./root/donate.txt ./.github/workflows/package_trigger.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/external_trigger.yml ./.github/workflows/external_trigger_scheduler.yml'
58+
env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.md ./.github/ISSUE_TEMPLATE/issue.feature.md ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/stale.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml ./root/donate.txt'
5959
}
6060
script{
6161
env.LS_RELEASE_NUMBER = sh(
@@ -307,22 +307,24 @@ pipeline {
307307
git commit -m 'Bot Updating Documentation'
308308
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all
309309
fi
310-
mkdir -p ${TEMPDIR}/unraid
310+
mkdir -p ${TEMPDIR}/unraid
311311
git clone https://github.com/linuxserver/docker-templates.git ${TEMPDIR}/unraid/docker-templates
312312
git clone https://github.com/linuxserver/templates.git ${TEMPDIR}/unraid/templates
313-
if [[ -f ${TEMPDIR}/unraid/docker-templates/linuxserver.io/img/${CONTAINER_NAME}-icon.png ]]; then
314-
sed -i "s|master/linuxserver.io/img/linuxserver-ls-logo.png|master/linuxserver.io/img/${CONTAINER_NAME}-icon.png|" ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml
313+
if [[ -f ${TEMPDIR}/unraid/docker-templates/linuxserver.io/img/${CONTAINER_NAME}-logo.png ]]; then
314+
sed -i "s|master/linuxserver.io/img/linuxserver-ls-logo.png|master/linuxserver.io/img/${CONTAINER_NAME}-logo.png|" ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml
315315
fi
316316
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
317+
cd ${TEMPDIR}/unraid/templates/
317318
if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
318-
echo "Image is on the ignore list, skipping Unraid template upload"
319+
echo "Image is on the ignore list, removing Unraid template"
320+
git rm unraid/${CONTAINER_NAME}.xml || :
321+
git commit -m 'Bot Removing Deprecated Unraid Template' || :
319322
else
320323
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
321-
cd ${TEMPDIR}/unraid/templates/
322324
git add unraid/${CONTAINER_NAME}.xml
323325
git commit -m 'Bot Updating Unraid Template'
324-
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git --all
325326
fi
327+
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git --all
326328
fi
327329
rm -Rf ${TEMPDIR}'''
328330
script{
@@ -379,8 +381,21 @@ pipeline {
379381
}
380382
steps {
381383
echo "Running on node: ${NODE_NAME}"
382-
sh "docker build --no-cache --pull -t ${IMAGE}:${META_TAG} \
383-
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
384+
sh "docker build \
385+
--label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
386+
--label \"org.opencontainers.image.authors=linuxserver.io\" \
387+
--label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-sqlitebrowser/packages\" \
388+
--label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-sqlitebrowser\" \
389+
--label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-sqlitebrowser\" \
390+
--label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
391+
--label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
392+
--label \"org.opencontainers.image.vendor=linuxserver.io\" \
393+
--label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
394+
--label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
395+
--label \"org.opencontainers.image.title=Sqlitebrowser\" \
396+
--label \"org.opencontainers.image.description=[DB Browser for SQLite](https://sqlitebrowser.org/) is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite.\" \
397+
--no-cache --pull -t ${IMAGE}:${META_TAG} \
398+
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
384399
}
385400
}
386401
// Build MultiArch Docker containers for push to LS Repo
@@ -393,8 +408,21 @@ pipeline {
393408
stage('Build X86') {
394409
steps {
395410
echo "Running on node: ${NODE_NAME}"
396-
sh "docker build --no-cache --pull -t ${IMAGE}:amd64-${META_TAG} \
397-
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
411+
sh "docker build \
412+
--label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
413+
--label \"org.opencontainers.image.authors=linuxserver.io\" \
414+
--label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-sqlitebrowser/packages\" \
415+
--label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-sqlitebrowser\" \
416+
--label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-sqlitebrowser\" \
417+
--label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
418+
--label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
419+
--label \"org.opencontainers.image.vendor=linuxserver.io\" \
420+
--label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
421+
--label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
422+
--label \"org.opencontainers.image.title=Sqlitebrowser\" \
423+
--label \"org.opencontainers.image.description=[DB Browser for SQLite](https://sqlitebrowser.org/) is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite.\" \
424+
--no-cache --pull -t ${IMAGE}:amd64-${META_TAG} \
425+
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
398426
}
399427
}
400428
stage('Build ARMHF') {
@@ -407,8 +435,21 @@ pipeline {
407435
sh '''#! /bin/bash
408436
echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
409437
'''
410-
sh "docker build --no-cache --pull -f Dockerfile.armhf -t ${IMAGE}:arm32v7-${META_TAG} \
411-
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
438+
sh "docker build \
439+
--label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
440+
--label \"org.opencontainers.image.authors=linuxserver.io\" \
441+
--label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-sqlitebrowser/packages\" \
442+
--label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-sqlitebrowser\" \
443+
--label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-sqlitebrowser\" \
444+
--label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
445+
--label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
446+
--label \"org.opencontainers.image.vendor=linuxserver.io\" \
447+
--label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
448+
--label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
449+
--label \"org.opencontainers.image.title=Sqlitebrowser\" \
450+
--label \"org.opencontainers.image.description=[DB Browser for SQLite](https://sqlitebrowser.org/) is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite.\" \
451+
--no-cache --pull -f Dockerfile.armhf -t ${IMAGE}:arm32v7-${META_TAG} \
452+
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
412453
sh "docker tag ${IMAGE}:arm32v7-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER}"
413454
retry(5) {
414455
sh "docker push ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER}"
@@ -428,8 +469,21 @@ pipeline {
428469
sh '''#! /bin/bash
429470
echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
430471
'''
431-
sh "docker build --no-cache --pull -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} \
432-
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
472+
sh "docker build \
473+
--label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
474+
--label \"org.opencontainers.image.authors=linuxserver.io\" \
475+
--label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-sqlitebrowser/packages\" \
476+
--label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-sqlitebrowser\" \
477+
--label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-sqlitebrowser\" \
478+
--label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
479+
--label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
480+
--label \"org.opencontainers.image.vendor=linuxserver.io\" \
481+
--label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
482+
--label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
483+
--label \"org.opencontainers.image.title=Sqlitebrowser\" \
484+
--label \"org.opencontainers.image.description=[DB Browser for SQLite](https://sqlitebrowser.org/) is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite.\" \
485+
--no-cache --pull -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} \
486+
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
433487
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
434488
retry(5) {
435489
sh "docker push ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
@@ -740,7 +794,7 @@ pipeline {
740794
echo '{"tag_name":"'${META_TAG}'",\
741795
"target_commitish": "master",\
742796
"name": "'${META_TAG}'",\
743-
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**Remote Changes:**\\n\\n' > start
797+
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Remote Changes:**\\n\\n' > start
744798
printf '","draft": false,"prerelease": false}' >> releasebody.json
745799
paste -d'\\0' start releasebody.json > releasebody.json.done
746800
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
@@ -765,7 +819,7 @@ pipeline {
765819
set -e
766820
TEMPDIR=$(mktemp -d)
767821
docker pull ghcr.io/linuxserver/jenkins-builder:latest
768-
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH="${BRANCH_NAME}" -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
822+
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH="${BRANCH_NAME}" -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
769823
docker pull ghcr.io/linuxserver/readme-sync
770824
docker run --rm=true \
771825
-e DOCKERHUB_USERNAME=$DOCKERUSER \

0 commit comments

Comments
 (0)