Skip to content

Commit 52f93f6

Browse files
Bot Updating Templated Files
1 parent 34eb72e commit 52f93f6

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
@@ -58,7 +58,7 @@ pipeline {
5858
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
5959
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
6060
env.PULL_REQUEST = env.CHANGE_ID
61-
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 ./.github/workflows/package_trigger.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/external_trigger.yml ./.github/workflows/external_trigger_scheduler.yml'
61+
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'
6262
}
6363
script{
6464
env.LS_RELEASE_NUMBER = sh(
@@ -311,22 +311,24 @@ pipeline {
311311
git commit -m 'Bot Updating Documentation'
312312
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all
313313
fi
314-
mkdir -p ${TEMPDIR}/unraid
314+
mkdir -p ${TEMPDIR}/unraid
315315
git clone https://github.com/linuxserver/docker-templates.git ${TEMPDIR}/unraid/docker-templates
316316
git clone https://github.com/linuxserver/templates.git ${TEMPDIR}/unraid/templates
317-
if [[ -f ${TEMPDIR}/unraid/docker-templates/linuxserver.io/img/${CONTAINER_NAME}-icon.png ]]; then
318-
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
317+
if [[ -f ${TEMPDIR}/unraid/docker-templates/linuxserver.io/img/${CONTAINER_NAME}-logo.png ]]; then
318+
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
319319
fi
320320
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
321+
cd ${TEMPDIR}/unraid/templates/
321322
if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
322-
echo "Image is on the ignore list, skipping Unraid template upload"
323+
echo "Image is on the ignore list, removing Unraid template"
324+
git rm unraid/${CONTAINER_NAME}.xml || :
325+
git commit -m 'Bot Removing Deprecated Unraid Template' || :
323326
else
324327
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
325-
cd ${TEMPDIR}/unraid/templates/
326328
git add unraid/${CONTAINER_NAME}.xml
327329
git commit -m 'Bot Updating Unraid Template'
328-
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git --all
329330
fi
331+
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git --all
330332
fi
331333
rm -Rf ${TEMPDIR}'''
332334
script{
@@ -383,8 +385,21 @@ pipeline {
383385
}
384386
steps {
385387
echo "Running on node: ${NODE_NAME}"
386-
sh "docker build --no-cache --pull -t ${IMAGE}:${META_TAG} \
387-
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
388+
sh "docker build \
389+
--label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
390+
--label \"org.opencontainers.image.authors=linuxserver.io\" \
391+
--label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-mariadb/packages\" \
392+
--label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-mariadb\" \
393+
--label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-mariadb\" \
394+
--label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
395+
--label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
396+
--label \"org.opencontainers.image.vendor=linuxserver.io\" \
397+
--label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
398+
--label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
399+
--label \"org.opencontainers.image.title=Mariadb\" \
400+
--label \"org.opencontainers.image.description=[Mariadb](https://mariadb.org/) is one of the most popular database servers. Made by the original developers of MySQL.\" \
401+
--no-cache --pull -t ${IMAGE}:${META_TAG} \
402+
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
388403
}
389404
}
390405
// Build MultiArch Docker containers for push to LS Repo
@@ -397,8 +412,21 @@ pipeline {
397412
stage('Build X86') {
398413
steps {
399414
echo "Running on node: ${NODE_NAME}"
400-
sh "docker build --no-cache --pull -t ${IMAGE}:amd64-${META_TAG} \
401-
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
415+
sh "docker build \
416+
--label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
417+
--label \"org.opencontainers.image.authors=linuxserver.io\" \
418+
--label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-mariadb/packages\" \
419+
--label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-mariadb\" \
420+
--label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-mariadb\" \
421+
--label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
422+
--label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
423+
--label \"org.opencontainers.image.vendor=linuxserver.io\" \
424+
--label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
425+
--label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
426+
--label \"org.opencontainers.image.title=Mariadb\" \
427+
--label \"org.opencontainers.image.description=[Mariadb](https://mariadb.org/) is one of the most popular database servers. Made by the original developers of MySQL.\" \
428+
--no-cache --pull -t ${IMAGE}:amd64-${META_TAG} \
429+
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
402430
}
403431
}
404432
stage('Build ARMHF') {
@@ -411,8 +439,21 @@ pipeline {
411439
sh '''#! /bin/bash
412440
echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
413441
'''
414-
sh "docker build --no-cache --pull -f Dockerfile.armhf -t ${IMAGE}:arm32v7-${META_TAG} \
415-
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
442+
sh "docker build \
443+
--label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
444+
--label \"org.opencontainers.image.authors=linuxserver.io\" \
445+
--label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-mariadb/packages\" \
446+
--label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-mariadb\" \
447+
--label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-mariadb\" \
448+
--label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
449+
--label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
450+
--label \"org.opencontainers.image.vendor=linuxserver.io\" \
451+
--label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
452+
--label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
453+
--label \"org.opencontainers.image.title=Mariadb\" \
454+
--label \"org.opencontainers.image.description=[Mariadb](https://mariadb.org/) is one of the most popular database servers. Made by the original developers of MySQL.\" \
455+
--no-cache --pull -f Dockerfile.armhf -t ${IMAGE}:arm32v7-${META_TAG} \
456+
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
416457
sh "docker tag ${IMAGE}:arm32v7-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER}"
417458
retry(5) {
418459
sh "docker push ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER}"
@@ -432,8 +473,21 @@ pipeline {
432473
sh '''#! /bin/bash
433474
echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
434475
'''
435-
sh "docker build --no-cache --pull -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} \
436-
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
476+
sh "docker build \
477+
--label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
478+
--label \"org.opencontainers.image.authors=linuxserver.io\" \
479+
--label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-mariadb/packages\" \
480+
--label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-mariadb\" \
481+
--label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-mariadb\" \
482+
--label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
483+
--label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
484+
--label \"org.opencontainers.image.vendor=linuxserver.io\" \
485+
--label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
486+
--label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
487+
--label \"org.opencontainers.image.title=Mariadb\" \
488+
--label \"org.opencontainers.image.description=[Mariadb](https://mariadb.org/) is one of the most popular database servers. Made by the original developers of MySQL.\" \
489+
--no-cache --pull -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} \
490+
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
437491
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
438492
retry(5) {
439493
sh "docker push ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
@@ -744,7 +798,7 @@ pipeline {
744798
echo '{"tag_name":"'${META_TAG}'",\
745799
"target_commitish": "alpine",\
746800
"name": "'${META_TAG}'",\
747-
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**Repo Changes:**\\n\\n' > start
801+
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Repo Changes:**\\n\\n' > start
748802
printf '","draft": false,"prerelease": true}' >> releasebody.json
749803
paste -d'\\0' start releasebody.json > releasebody.json.done
750804
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
@@ -769,7 +823,7 @@ pipeline {
769823
set -e
770824
TEMPDIR=$(mktemp -d)
771825
docker pull ghcr.io/linuxserver/jenkins-builder:latest
772-
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH="${BRANCH_NAME}" -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
826+
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH="${BRANCH_NAME}" -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
773827
docker pull ghcr.io/linuxserver/readme-sync
774828
docker run --rm=true \
775829
-e DOCKERHUB_USERNAME=$DOCKERUSER \

0 commit comments

Comments
 (0)