From 814c80d47cf9bc08a41f24614e2a7bc94248f57b Mon Sep 17 00:00:00 2001 From: aptalca Date: Sat, 13 Mar 2021 22:42:17 -0500 Subject: [PATCH] build pre-releases instead of commits --- .github/workflows/external_trigger.yml | 2 +- Dockerfile | 5 ++-- Dockerfile.aarch64 | 5 ++-- Dockerfile.armhf | 5 ++-- Jenkinsfile | 36 ++++++++++++-------------- README.md | 1 + jenkins-vars.yml | 4 +-- readme-vars.yml | 1 + 8 files changed, 30 insertions(+), 29 deletions(-) diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index 1d3b0d2..d183e70 100755 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -18,7 +18,7 @@ jobs: fi echo "**** External trigger running off of development branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_BAZARR_DEVELOPMENT\". ****" echo "**** Retrieving external version ****" - EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/morpheus65535/bazarr/commits/development" | jq -r '. | .sha' | cut -c1-8) + EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/morpheus65535/bazarr/releases" | jq -r '.[0] | .tag_name') if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then echo "**** Can't retrieve external version, exiting ****" FAILURE_REASON="Can't retrieve external version for bazarr branch development" diff --git a/Dockerfile b/Dockerfile index 4784baa..b87bd29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN \ apk add --no-cache --virtual=build-dependencies \ g++ \ gcc \ + jq \ libxml2-dev \ libxslt-dev \ py3-pip \ @@ -29,8 +30,8 @@ RUN \ unzip && \ echo "**** install bazarr ****" && \ if [ -z ${BAZARR_VERSION+x} ]; then \ - BAZARR_VERSION=$(curl -sX GET https://api.github.com/repos/morpheus65535/bazarr/commits/development \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ + BAZARR_VERSION=$(curl -sX GET https://api.github.com/repos/morpheus65535/bazarr/releases \ + | jq -r '.[0] | .tag_name'); \ fi && \ curl -o \ /tmp/bazarr.tar.gz -L \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 5df045d..66a89dd 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -14,6 +14,7 @@ RUN \ apk add --no-cache --virtual=build-dependencies \ g++ \ gcc \ + jq \ libxml2-dev \ libxslt-dev \ py3-pip \ @@ -29,8 +30,8 @@ RUN \ unzip && \ echo "**** install bazarr ****" && \ if [ -z ${BAZARR_VERSION+x} ]; then \ - BAZARR_VERSION=$(curl -sX GET https://api.github.com/repos/morpheus65535/bazarr/commits/development \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ + BAZARR_VERSION=$(curl -sX GET https://api.github.com/repos/morpheus65535/bazarr/releases \ + | jq -r '.[0] | .tag_name'); \ fi && \ curl -o \ /tmp/bazarr.tar.gz -L \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 1e48225..c1360b0 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -14,6 +14,7 @@ RUN \ apk add --no-cache --virtual=build-dependencies \ g++ \ gcc \ + jq \ libxml2-dev \ libxslt-dev \ py3-pip \ @@ -29,8 +30,8 @@ RUN \ unzip && \ echo "**** install bazarr ****" && \ if [ -z ${BAZARR_VERSION+x} ]; then \ - BAZARR_VERSION=$(curl -sX GET https://api.github.com/repos/morpheus65535/bazarr/commits/development \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ + BAZARR_VERSION=$(curl -sX GET https://api.github.com/repos/morpheus65535/bazarr/releases \ + | jq -r '.[0] | .tag_name'); \ fi && \ curl -o \ /tmp/bazarr.tar.gz -L \ diff --git a/Jenkinsfile b/Jenkinsfile index d85c286..0923e0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,8 +27,6 @@ pipeline { DEV_DOCKERHUB_IMAGE = 'lsiodev/bazarr' PR_DOCKERHUB_IMAGE = 'lspipepr/bazarr' DIST_IMAGE = 'alpine' - DIST_TAG = '3.8' - DIST_PACKAGES = 'none' MULTIARCH='true' CI='true' CI_WEB='true' @@ -103,23 +101,23 @@ pipeline { /* ######################## External Release Tagging ######################## */ - // If this is a github commit trigger determine the current commit at head - stage("Set ENV github_commit"){ - steps{ - script{ - env.EXT_RELEASE = sh( - script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/commits/${EXT_GIT_BRANCH} | jq -r '. | .sha' | cut -c1-8 ''', - returnStdout: true).trim() - } - } + // If this is a devel github release use the first in an array from github to determine the ext tag + stage("Set ENV github_devel"){ + steps{ + script{ + env.EXT_RELEASE = sh( + script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases | jq -r '.[0] | .tag_name' ''', + returnStdout: true).trim() + } + } } - // If this is a github commit trigger Set the external release link - stage("Set ENV commit_link"){ - steps{ - script{ - env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/commit/' + env.EXT_RELEASE - } - } + // If this is a stable or devel github release generate the link for the build message + stage("Set ENV github_link"){ + steps{ + script{ + env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE + } + } } // Sanitize the release tag and strip illegal docker or github characters stage("Sanitize tag"){ @@ -748,7 +746,7 @@ pipeline { "tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' echo "Pushing New release for Tag" sh '''#! /bin/bash - curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/commits/${EXT_GIT_BRANCH} | jq '. | .commit.message' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json + curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases | jq '.[0] |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json echo '{"tag_name":"'${META_TAG}'",\ "target_commitish": "development",\ "name": "'${META_TAG}'",\ diff --git a/README.md b/README.md index 9c5f29b..2410f33 100644 --- a/README.md +++ b/README.md @@ -230,6 +230,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **13.03.21:** - Build from Github pre-releases. * **23.01.21:** - Rebasing to alpine 3.13. * **23.01.21:** - Deprecate `UMASK_SET` in favor of UMASK in baseimage, see above for more information. * **19.12.19:** - Rebasing to alpine 3.12. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index e1366fc..5bc4f08 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -2,7 +2,7 @@ # jenkins variables project_name: docker-bazarr -external_type: github_commit +external_type: github_devel release_type: prerelease release_tag: development ls_branch: development @@ -18,8 +18,6 @@ repo_vars: - DEV_DOCKERHUB_IMAGE = 'lsiodev/bazarr' - PR_DOCKERHUB_IMAGE = 'lspipepr/bazarr' - DIST_IMAGE = 'alpine' - - DIST_TAG = '3.8' - - DIST_PACKAGES = 'none' - MULTIARCH='true' - CI='true' - CI_WEB='true' diff --git a/readme-vars.yml b/readme-vars.yml index f96e721..b239eae 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -46,6 +46,7 @@ app_setup_block: | # changelog changelogs: + - { date: "13.03.21:", desc: "Build from Github pre-releases." } - { date: "23.01.21:", desc: "Rebasing to alpine 3.13." } - { date: "23.01.21:", desc: "Deprecate `UMASK_SET` in favor of UMASK in baseimage, see above for more information." } - { date: "19.12.19:", desc: "Rebasing to alpine 3.12." }