mirror of
				https://github.com/linuxserver/docker-jellyfin.git
				synced 2025-10-31 13:07:38 +09:00 
			
		
		
		
	Bot Updating Templated Files
This commit is contained in:
		
							
								
								
									
										62
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										62
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							| @@ -17,6 +17,8 @@ pipeline { | |||||||
|     GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0') |     GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0') | ||||||
|     GITLAB_NAMESPACE=credentials('gitlab-namespace-id') |     GITLAB_NAMESPACE=credentials('gitlab-namespace-id') | ||||||
|     DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat') |     DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat') | ||||||
|  |     QUAYIO_API_TOKEN=credentials('quayio-repo-api-token') | ||||||
|  |     GIT_SIGNING_KEY=credentials('484fbca6-9a4f-455e-b9e3-97ac98785f5f') | ||||||
|     BUILD_VERSION_ARG = 'JELLYFIN_RELEASE' |     BUILD_VERSION_ARG = 'JELLYFIN_RELEASE' | ||||||
|     LS_USER = 'linuxserver' |     LS_USER = 'linuxserver' | ||||||
|     LS_REPO = 'docker-jellyfin' |     LS_REPO = 'docker-jellyfin' | ||||||
| @@ -36,9 +38,23 @@ pipeline { | |||||||
|     CI_WEBPATH='' |     CI_WEBPATH='' | ||||||
|   } |   } | ||||||
|   stages { |   stages { | ||||||
|  |     stage("Set git config"){ | ||||||
|  |       steps{ | ||||||
|  |         sh '''#!/bin/bash | ||||||
|  |               cat ${GIT_SIGNING_KEY} > /config/.ssh/id_sign | ||||||
|  |               chmod 600 /config/.ssh/id_sign | ||||||
|  |               ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub | ||||||
|  |               echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" | ||||||
|  |               git config --global gpg.format ssh | ||||||
|  |               git config --global user.signingkey /config/.ssh/id_sign | ||||||
|  |               git config --global commit.gpgsign true | ||||||
|  |         ''' | ||||||
|  |       } | ||||||
|  |     } | ||||||
|     // Setup all the basic environment variables needed for the build |     // Setup all the basic environment variables needed for the build | ||||||
|     stage("Set ENV Variables base"){ |     stage("Set ENV Variables base"){ | ||||||
|       steps{ |       steps{ | ||||||
|  |         echo "Running on node: ${NODE_NAME}" | ||||||
|         sh '''#! /bin/bash |         sh '''#! /bin/bash | ||||||
|               containers=$(docker ps -aq) |               containers=$(docker ps -aq) | ||||||
|               if [[ -n "${containers}" ]]; then |               if [[ -n "${containers}" ]]; then | ||||||
| @@ -381,9 +397,9 @@ pipeline { | |||||||
|                 echo "Updating Unraid template" |                 echo "Updating Unraid template" | ||||||
|                 cd ${TEMPDIR}/unraid/templates/ |                 cd ${TEMPDIR}/unraid/templates/ | ||||||
|                 GH_TEMPLATES_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||') |                 GH_TEMPLATES_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||') | ||||||
|                 if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list && [[ -f ${TEMPDIR}/unraid/templates/unraid/deprecated/${CONTAINER_NAME}.xml ]]; then |                 if grep -wq "^${CONTAINER_NAME}$" ${TEMPDIR}/unraid/templates/unraid/ignore.list && [[ -f ${TEMPDIR}/unraid/templates/unraid/deprecated/${CONTAINER_NAME}.xml ]]; then | ||||||
|                   echo "Image is on the ignore list, and already in the deprecation folder." |                   echo "Image is on the ignore list, and already in the deprecation folder." | ||||||
|                 elif grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then |                 elif grep -wq "^${CONTAINER_NAME}$" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then | ||||||
|                   echo "Image is on the ignore list, marking Unraid template as deprecated" |                   echo "Image is on the ignore list, marking Unraid template as deprecated" | ||||||
|                   cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ |                   cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ | ||||||
|                   git add -u unraid/${CONTAINER_NAME}.xml |                   git add -u unraid/${CONTAINER_NAME}.xml | ||||||
| @@ -476,10 +492,10 @@ pipeline { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     /* ####################### |     /* ####################### | ||||||
|            GitLab Mirroring |        GitLab Mirroring and Quay.io Repo Visibility | ||||||
|        ####################### */ |        ####################### */ | ||||||
|     // Ping into Gitlab to mirror this repo and have a registry endpoint |     // Ping into Gitlab to mirror this repo and have a registry endpoint & mark this repo on Quay.io as public | ||||||
|     stage("GitLab Mirror"){ |     stage("GitLab Mirror and Quay.io Visibility"){ | ||||||
|       when { |       when { | ||||||
|         environment name: 'EXIT_STATUS', value: '' |         environment name: 'EXIT_STATUS', value: '' | ||||||
|       } |       } | ||||||
| @@ -495,6 +511,8 @@ pipeline { | |||||||
|             "visibility":"public"}' ''' |             "visibility":"public"}' ''' | ||||||
|         sh '''curl -H "Private-Token: ${GITLAB_TOKEN}" -X PUT "https://gitlab.com/api/v4/projects/Linuxserver.io%2F${LS_REPO}" \ |         sh '''curl -H "Private-Token: ${GITLAB_TOKEN}" -X PUT "https://gitlab.com/api/v4/projects/Linuxserver.io%2F${LS_REPO}" \ | ||||||
|           -d "mirror=true&import_url=https://github.com/linuxserver/${LS_REPO}.git" ''' |           -d "mirror=true&import_url=https://github.com/linuxserver/${LS_REPO}.git" ''' | ||||||
|  |         sh '''curl -H "Content-Type: application/json" -H "Authorization: Bearer ${QUAYIO_API_TOKEN}" -X POST "https://quay.io/api/v1/repository${QUAYIMAGE/quay.io/}/changevisibility" \ | ||||||
|  |           -d '{"visibility":"public"}' ||: ''' | ||||||
|       }  |       }  | ||||||
|     } |     } | ||||||
|     /* ############### |     /* ############### | ||||||
| @@ -589,7 +607,7 @@ pipeline { | |||||||
|               --provenance=false --sbom=false \ |               --provenance=false --sbom=false \ | ||||||
|               --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." |               --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." | ||||||
|             sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}" |             sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}" | ||||||
|             retry(5) { |             retry_backoff(5,5) { | ||||||
|               sh "docker push ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}" |               sh "docker push ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}" | ||||||
|             } |             } | ||||||
|             sh '''#! /bin/bash |             sh '''#! /bin/bash | ||||||
| @@ -745,7 +763,7 @@ pipeline { | |||||||
|             passwordVariable: 'QUAYPASS' |             passwordVariable: 'QUAYPASS' | ||||||
|           ] |           ] | ||||||
|         ]) { |         ]) { | ||||||
|           retry(5) { |           retry_backoff(5,5) { | ||||||
|             sh '''#! /bin/bash |             sh '''#! /bin/bash | ||||||
|                   set -e |                   set -e | ||||||
|                   echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin |                   echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin | ||||||
| @@ -763,7 +781,7 @@ pipeline { | |||||||
|                     docker push ${PUSHIMAGE}:${META_TAG} |                     docker push ${PUSHIMAGE}:${META_TAG} | ||||||
|                     docker push ${PUSHIMAGE}:${EXT_RELEASE_TAG} |                     docker push ${PUSHIMAGE}:${EXT_RELEASE_TAG} | ||||||
|                     if [ -n "${SEMVER}" ]; then |                     if [ -n "${SEMVER}" ]; then | ||||||
|                      docker push ${PUSHIMAGE}:${SEMVER} |                       docker push ${PUSHIMAGE}:${SEMVER} | ||||||
|                     fi |                     fi | ||||||
|                   done |                   done | ||||||
|                ''' |                ''' | ||||||
| @@ -786,7 +804,7 @@ pipeline { | |||||||
|             passwordVariable: 'QUAYPASS' |             passwordVariable: 'QUAYPASS' | ||||||
|           ] |           ] | ||||||
|         ]) { |         ]) { | ||||||
|           retry(5) { |           retry_backoff(5,5) { | ||||||
|             sh '''#! /bin/bash |             sh '''#! /bin/bash | ||||||
|                   set -e |                   set -e | ||||||
|                   echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin |                   echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin | ||||||
| @@ -849,7 +867,7 @@ pipeline { | |||||||
|              "object": "'${COMMIT_SHA}'",\ |              "object": "'${COMMIT_SHA}'",\ | ||||||
|              "message": "Tagging Release '${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}' to nightly",\ |              "message": "Tagging Release '${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}' to nightly",\ | ||||||
|              "type": "commit",\ |              "type": "commit",\ | ||||||
|              "tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' |              "tagger": {"name": "LinuxServer-CI","email": "ci@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' | ||||||
|         echo "Pushing New release for Tag" |         echo "Pushing New release for Tag" | ||||||
|         sh '''#! /bin/bash |         sh '''#! /bin/bash | ||||||
|               echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json |               echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json | ||||||
| @@ -981,6 +999,13 @@ EOF | |||||||
|      ###################### */ |      ###################### */ | ||||||
|   post { |   post { | ||||||
|     always { |     always { | ||||||
|  |       sh '''#!/bin/bash | ||||||
|  |             rm -rf /config/.ssh/id_sign | ||||||
|  |             rm -rf /config/.ssh/id_sign.pub | ||||||
|  |             git config --global --unset gpg.format | ||||||
|  |             git config --global --unset user.signingkey | ||||||
|  |             git config --global --unset commit.gpgsign | ||||||
|  |         ''' | ||||||
|       script{ |       script{ | ||||||
|         if (env.EXIT_STATUS == "ABORTED"){ |         if (env.EXIT_STATUS == "ABORTED"){ | ||||||
|           sh 'echo "build aborted"' |           sh 'echo "build aborted"' | ||||||
| @@ -1010,3 +1035,20 @@ EOF | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | def retry_backoff(int max_attempts, int power_base, Closure c) { | ||||||
|  |   int n = 0 | ||||||
|  |   while (n < max_attempts) { | ||||||
|  |     try { | ||||||
|  |       c() | ||||||
|  |       return | ||||||
|  |     } catch (err) { | ||||||
|  |       if ((n + 1) >= max_attempts) { | ||||||
|  |         throw err | ||||||
|  |       } | ||||||
|  |       sleep(power_base ** n) | ||||||
|  |       n++ | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   return | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user