@@ -79,14 +79,10 @@ pipeline {
7979 script{
8080 env. PACKAGE_TAG = sh(
8181 script : ''' #!/bin/bash
82- http_code=$(curl --write-out %{http_code} -s -o /dev/null \
83- https://raw.githubusercontent.com/${LS_USER}/${LS_REPO}/master/package_versions.txt)
84- if [[ "${http_code}" -ne 200 ]] ; then
85- echo none
82+ if [ -e package_versions.txt ] ; then
83+ cat package_versions.txt | md5sum | cut -c1-8
8684 else
87- curl -s \
88- https://raw.githubusercontent.com/${LS_USER}/${LS_REPO}/master/package_versions.txt \
89- | md5sum | cut -c1-8
85+ echo none
9086 fi''' ,
9187 returnStdout : true ). trim()
9288 }
@@ -109,7 +105,7 @@ pipeline {
109105 steps{
110106 script{
111107 env. EXT_RELEASE_CLEAN = sh(
112- script : ''' echo ${EXT_RELEASE} | sed 's/[~,%@+;:]//g' ''' ,
108+ script : ''' echo ${EXT_RELEASE} | sed 's/[~,%@+;:/ ]//g' ''' ,
113109 returnStdout : true ). trim()
114110 }
115111 }
@@ -330,20 +326,25 @@ pipeline {
330326 chmod 777 /tmp/package_versions.txt'
331327 elif [ "${DIST_IMAGE}" == "ubuntu" ]; then
332328 docker run --rm --entrypoint '/bin/sh' -v ${TEMPDIR}:/tmp ${LOCAL_CONTAINER} -c '\
333- apt -qq list --installed | awk "{print \$ 1, \$ 2}" > /tmp/package_versions.txt && \
329+ apt list -qq --installed > /tmp/package_versions.txt && \
334330 chmod 777 /tmp/package_versions.txt'
335331 fi
336- if [ "$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )" != "${PACKAGE_TAG}" ]; then
332+ NEW_PACKAGE_TAG=$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )
333+ echo "Package tag sha from current packages in buit container is ${NEW_PACKAGE_TAG} comparing to old ${PACKAGE_TAG} from github"
334+ if [ "${NEW_PACKAGE_TAG}" != "${PACKAGE_TAG}" ]; then
337335 git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/${LS_REPO}
338336 git --git-dir ${TEMPDIR}/${LS_REPO}/.git checkout -f master
339337 cp ${TEMPDIR}/package_versions.txt ${TEMPDIR}/${LS_REPO}/
340338 cd ${TEMPDIR}/${LS_REPO}/
341- git --git-dir ${TEMPDIR}/${LS_REPO}/.git add package_versions.txt
342- git --git-dir ${TEMPDIR}/${LS_REPO}/.git commit -m 'Bot Updating Package Versions'
343- git --git-dir ${TEMPDIR}/${LS_REPO}/.git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
339+ wait
340+ git add package_versions.txt
341+ git commit -m 'Bot Updating Package Versions'
342+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
344343 echo "true" > /tmp/packages-${COMMIT_SHA}-${BUILD_NUMBER}
344+ echo "Package tag updated, stopping build process"
345345 else
346346 echo "false" > /tmp/packages-${COMMIT_SHA}-${BUILD_NUMBER}
347+ echo "Package tag is same as previous continue with build process"
347348 fi
348349 rm -Rf ${TEMPDIR}'''
349350 script{
0 commit comments