@@ -243,9 +243,11 @@ pipeline {
243243 -v ${WORKSPACE}:/mnt \
244244 -e AWS_ACCESS_KEY_ID=\" ${S3_KEY}\" \
245245 -e AWS_SECRET_ACCESS_KEY=\" ${S3_SECRET}\" \
246- ghcr.io/linuxserver/baseimage-alpine:3.17 s6-envdir -fn -- /var/run/s6/container_environment /bin/bash -c "\
247- apk add --no-cache py3-pip && \
248- pip install s3cmd && \
246+ ghcr.io/linuxserver/baseimage-alpine:3.19 s6-envdir -fn -- /var/run/s6/container_environment /bin/bash -c "\
247+ apk add --no-cache python3 && \
248+ python3 -m venv /lsiopy && \
249+ pip install --no-cache-dir -U pip && \
250+ pip install --no-cache-dir s3cmd && \
249251 s3cmd put --no-preserve --acl-public -m text/xml /mnt/shellcheck-result.xml s3://ci-tests.linuxserver.io/${IMAGE}/${META_TAG}/shellcheck-result.xml" || :'''
250252 }
251253 }
@@ -260,125 +262,120 @@ pipeline {
260262 }
261263 }
262264 steps {
263- withCredentials([
264- [
265- $class : ' UsernamePasswordMultiBinding' ,
266- credentialsId : ' 3f9ba4d5-100d-45b0-a3c4-633fd6061207' ,
267- usernameVariable : ' DOCKERUSER' ,
268- passwordVariable : ' DOCKERPASS'
269- ]
270- ]) {
271- sh ''' #! /bin/bash
272- set -e
273- TEMPDIR=$(mktemp -d)
274- docker pull ghcr.io/linuxserver/jenkins-builder:latest
275- docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=bullseye -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
276- # Stage 1 - Jenkinsfile update
277- if [[ "$(md5sum Jenkinsfile | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile | awk '{ print $1 }')" ]]; then
278- mkdir -p ${TEMPDIR}/repo
279- git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
280- cd ${TEMPDIR}/repo/${LS_REPO}
281- git checkout -f bullseye
282- cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/
283- git add Jenkinsfile
284- git commit -m 'Bot Updating Templated Files'
285- git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
286- git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
287- echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
288- echo "Updating Jenkinsfile"
289- rm -Rf ${TEMPDIR}
290- exit 0
291- else
292- echo "Jenkinsfile is up to date."
265+ sh ''' #! /bin/bash
266+ set -e
267+ TEMPDIR=$(mktemp -d)
268+ docker pull ghcr.io/linuxserver/jenkins-builder:latest
269+ docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=bullseye -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
270+ # Stage 1 - Jenkinsfile update
271+ if [[ "$(md5sum Jenkinsfile | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile | awk '{ print $1 }')" ]]; then
272+ mkdir -p ${TEMPDIR}/repo
273+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
274+ cd ${TEMPDIR}/repo/${LS_REPO}
275+ git checkout -f bullseye
276+ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/
277+ git add Jenkinsfile
278+ git commit -m 'Bot Updating Templated Files'
279+ git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
280+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
281+ echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
282+ echo "Updating Jenkinsfile"
283+ rm -Rf ${TEMPDIR}
284+ exit 0
285+ else
286+ echo "Jenkinsfile is up to date."
287+ fi
288+ # Stage 2 - Delete old templates
289+ 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"
290+ for i in ${OLD_TEMPLATES}; do
291+ if [[ -f "${i}" ]]; then
292+ TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
293293 fi
294- # Stage 2 - Delete old templates
295- 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"
296- for i in ${OLD_TEMPLATES}; do
297- if [[ -f "${i}" ]]; then
298- TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
299- fi
294+ done
295+ if [[ -n "${TEMPLATES_TO_DELETE}" ]]; then
296+ mkdir -p ${TEMPDIR}/repo
297+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
298+ cd ${TEMPDIR}/repo/${LS_REPO}
299+ git checkout -f bullseye
300+ for i in ${TEMPLATES_TO_DELETE}; do
301+ git rm "${i}"
300302 done
301- if [[ -n "${TEMPLATES_TO_DELETE}" ]]; then
302- mkdir -p ${TEMPDIR}/repo
303- git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
304- cd ${TEMPDIR}/repo/${LS_REPO}
305- git checkout -f bullseye
306- for i in ${TEMPLATES_TO_DELETE}; do
307- git rm "${i}"
308- done
309- git commit -m 'Bot Updating Templated Files'
310- git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
311- git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
312- echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
313- echo "Deleting old and deprecated templates"
314- rm -Rf ${TEMPDIR}
315- exit 0
316- else
317- echo "No templates to delete"
318- fi
319- # Stage 3 - Update templates
320- CURRENTHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
303+ git commit -m 'Bot Updating Templated Files'
304+ git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
305+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
306+ echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
307+ echo "Deleting old and deprecated templates"
308+ rm -Rf ${TEMPDIR}
309+ exit 0
310+ else
311+ echo "No templates to delete"
312+ fi
313+ # Stage 3 - Update templates
314+ CURRENTHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
315+ cd ${TEMPDIR}/docker-${CONTAINER_NAME}
316+ NEWHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
317+ if [[ "${CURRENTHASH}" != "${NEWHASH}" ]] || ! grep -q '.jenkins-external' "${WORKSPACE}/.gitignore" 2>/dev/null; then
318+ mkdir -p ${TEMPDIR}/repo
319+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
320+ cd ${TEMPDIR}/repo/${LS_REPO}
321+ git checkout -f bullseye
321322 cd ${TEMPDIR}/docker-${CONTAINER_NAME}
322- NEWHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
323- if [[ "${CURRENTHASH}" != "${NEWHASH}" ]] || ! grep -q '.jenkins-external' "${WORKSPACE}/.gitignore" 2>/dev/null; then
324- mkdir -p ${TEMPDIR}/repo
325- git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
326- cd ${TEMPDIR}/repo/${LS_REPO}
327- git checkout -f bullseye
328- cd ${TEMPDIR}/docker-${CONTAINER_NAME}
329- mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
330- mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
331- cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
332- cp --parents readme-vars.yml ${TEMPDIR}/repo/${LS_REPO}/ || :
333- cd ${TEMPDIR}/repo/${LS_REPO}/
334- if ! grep -q '.jenkins-external' .gitignore 2>/dev/null; then
335- echo ".jenkins-external" >> .gitignore
336- git add .gitignore
337- fi
338- git add readme-vars.yml ${TEMPLATED_FILES}
339- git commit -m 'Bot Updating Templated Files'
340- git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
341- git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
342- echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
343- else
344- echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
345- fi
346- mkdir -p ${TEMPDIR}/docs
347- git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/docs/docker-documentation
348- if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]] && [[ (! -f ${TEMPDIR}/docs/docker-documentation/docs/images/docker-${CONTAINER_NAME}.md) || ("$(md5sum ${TEMPDIR}/docs/docker-documentation/docs/images/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then
349- cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/docs/docker-documentation/docs/images/
350- cd ${TEMPDIR}/docs/docker-documentation
351- GH_DOCS_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||')
352- git add docs/images/docker-${CONTAINER_NAME}.md
353- git commit -m 'Bot Updating Documentation'
354- git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH}
355- git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH}
323+ mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
324+ mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
325+ cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
326+ cp --parents readme-vars.yml ${TEMPDIR}/repo/${LS_REPO}/ || :
327+ cd ${TEMPDIR}/repo/${LS_REPO}/
328+ if ! grep -q '.jenkins-external' .gitignore 2>/dev/null; then
329+ echo ".jenkins-external" >> .gitignore
330+ git add .gitignore
356331 fi
357- # Stage 4 - Sync Readme to Docker Hub
358- if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]]; then
359- if [[ $(cat ${TEMPDIR}/docker-${CONTAINER_NAME}/README.md | wc -m) > 25000 ]]; then
360- echo "Readme is longer than 25,000 characters. Syncing the lite version to Docker Hub"
361- DH_README_SYNC_PATH="${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/README.lite"
362- else
363- echo "Syncing readme to Docker Hub"
364- DH_README_SYNC_PATH="${TEMPDIR}/docker-${CONTAINER_NAME}/README.md"
365- fi
366- DH_TOKEN=$(curl -d '{"username":"'${DOCKERUSER}'", "password":"'${DOCKERHUB_TOKEN}'"}' -H "Content-Type: application/json" -X POST https://hub.docker.com/v2/users/login | jq -r '.token')
367- curl -s \
368- -H "Authorization: JWT ${DH_TOKEN}" \
369- -H "Content-Type: application/json" \
370- -X PATCH \
371- -d "{\\ "full_description\\ ":$(jq -Rsa . ${DH_README_SYNC_PATH})}" \
372- https://hub.docker.com/v2/repositories/${DOCKERHUB_IMAGE} || :
332+ git add readme-vars.yml ${TEMPLATED_FILES}
333+ git commit -m 'Bot Updating Templated Files'
334+ git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
335+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git bullseye
336+ echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
337+ else
338+ echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
339+ fi
340+ mkdir -p ${TEMPDIR}/docs
341+ git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/docs/docker-documentation
342+ if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]] && [[ (! -f ${TEMPDIR}/docs/docker-documentation/docs/images/docker-${CONTAINER_NAME}.md) || ("$(md5sum ${TEMPDIR}/docs/docker-documentation/docs/images/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then
343+ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/docs/docker-documentation/docs/images/
344+ cd ${TEMPDIR}/docs/docker-documentation
345+ GH_DOCS_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||')
346+ git add docs/images/docker-${CONTAINER_NAME}.md
347+ git commit -m 'Bot Updating Documentation'
348+ git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase
349+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} || \
350+ (MAXWAIT="10" && echo "Push to docs failed, trying again in ${MAXWAIT} seconds" && \
351+ sleep $((RANDOM % MAXWAIT)) && \
352+ git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase && \
353+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH})
354+ fi
355+ # Stage 4 - Sync Readme to Docker Hub
356+ if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]]; then
357+ if [[ $(cat ${TEMPDIR}/docker-${CONTAINER_NAME}/README.md | wc -m) > 25000 ]]; then
358+ echo "Readme is longer than 25,000 characters. Syncing the lite version to Docker Hub"
359+ DH_README_SYNC_PATH="${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/README.lite"
373360 else
374- echo "Not the default Github branch. Skipping readme sync to Docker Hub."
361+ echo "Syncing readme to Docker Hub"
362+ DH_README_SYNC_PATH="${TEMPDIR}/docker-${CONTAINER_NAME}/README.md"
375363 fi
376- rm -Rf ${TEMPDIR}'''
377- script{
378- env. FILES_UPDATED = sh(
379- script : ''' cat /tmp/${COMMIT_SHA}-${BUILD_NUMBER}''' ,
380- returnStdout : true ). trim()
381- }
364+ DH_TOKEN=$(curl -d '{"username":"linuxserverci", "password":"'${DOCKERHUB_TOKEN}'"}' -H "Content-Type: application/json" -X POST https://hub.docker.com/v2/users/login | jq -r '.token')
365+ curl -s \
366+ -H "Authorization: JWT ${DH_TOKEN}" \
367+ -H "Content-Type: application/json" \
368+ -X PATCH \
369+ -d "{\\ "full_description\\ ":$(jq -Rsa . ${DH_README_SYNC_PATH})}" \
370+ https://hub.docker.com/v2/repositories/${DOCKERHUB_IMAGE} || :
371+ else
372+ echo "Not the default Github branch. Skipping readme sync to Docker Hub."
373+ fi
374+ rm -Rf ${TEMPDIR}'''
375+ script{
376+ env. FILES_UPDATED = sh(
377+ script : ''' cat /tmp/${COMMIT_SHA}-${BUILD_NUMBER}''' ,
378+ returnStdout : true ). trim()
382379 }
383380 }
384381 }
@@ -673,12 +670,6 @@ pipeline {
673670 }
674671 steps {
675672 withCredentials([
676- [
677- $class : ' UsernamePasswordMultiBinding' ,
678- credentialsId : ' 3f9ba4d5-100d-45b0-a3c4-633fd6061207' ,
679- usernameVariable : ' DOCKERUSER' ,
680- passwordVariable : ' DOCKERPASS'
681- ],
682673 [
683674 $class : ' UsernamePasswordMultiBinding' ,
684675 credentialsId : ' Quay.io-Robot' ,
@@ -689,7 +680,7 @@ pipeline {
689680 retry(5 ) {
690681 sh ''' #! /bin/bash
691682 set -e
692- echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
683+ echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin
693684 echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
694685 echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin
695686 echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin
@@ -720,12 +711,6 @@ pipeline {
720711 }
721712 steps {
722713 withCredentials([
723- [
724- $class : ' UsernamePasswordMultiBinding' ,
725- credentialsId : ' 3f9ba4d5-100d-45b0-a3c4-633fd6061207' ,
726- usernameVariable : ' DOCKERUSER' ,
727- passwordVariable : ' DOCKERPASS'
728- ],
729714 [
730715 $class : ' UsernamePasswordMultiBinding' ,
731716 credentialsId : ' Quay.io-Robot' ,
@@ -736,7 +721,7 @@ pipeline {
736721 retry(5 ) {
737722 sh ''' #! /bin/bash
738723 set -e
739- echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
724+ echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin
740725 echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
741726 echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin
742727 echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin
0 commit comments