From 1dce2b6b1b08662360997c05c5a85b77fe9fbcec Mon Sep 17 00:00:00 2001 From: thespad Date: Tue, 3 Dec 2024 20:31:36 +0000 Subject: [PATCH 1/2] Switch from commits to releases --- Dockerfile | 4 ++-- Dockerfile.aarch64 | 4 ++-- jenkins-vars.yml | 8 ++++---- readme-vars.yml | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index f50d07e..5e61249 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,8 +40,8 @@ RUN \ echo "**** install mastodon ****" && \ mkdir -p /app/www && \ if [ -z ${MASTODON_VERSION+x} ]; then \ - MASTODON_VERSION=$(curl -sX GET https://api.github.com/repos/glitch-soc/mastodon/commits/main \ - | jq -r '. | .sha'); \ + MASTODON_VERSION=$(curl -sX GET "https://api.github.com/repos/glitch-soc/mastodon/commits/main" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ curl -s -o \ /tmp/mastodon.tar.gz -L \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 5be3d61..1b29104 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -42,8 +42,8 @@ RUN \ echo "**** install mastodon ****" && \ mkdir -p /app/www && \ if [ -z ${MASTODON_VERSION+x} ]; then \ - MASTODON_VERSION=$(curl -sX GET https://api.github.com/repos/glitch-soc/mastodon/commits/main \ - | jq -r '. | .sha'); \ + MASTODON_VERSION=$(curl -sX GET "https://api.github.com/repos/glitch-soc/mastodon/commits/main" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ curl -s -o \ /tmp/mastodon.tar.gz -L \ diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 24e0875..2c2e5a1 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -2,11 +2,12 @@ # jenkins variables project_name: docker-mastodon -external_type: github_commit +external_type: github_stable release_type: prerelease release_tag: glitch ls_branch: glitch -build_armhf: false +image_sbom: true +image_provenance: true repo_vars: - EXT_GIT_BRANCH = 'main' - EXT_USER = 'glitch-soc' @@ -25,7 +26,6 @@ repo_vars: - CI_PORT='80' - CI_SSL='false' - CI_DELAY='120' - - CI_DOCKERENV='TZ=US/Pacific' + - CI_DOCKERENV='' - CI_AUTH='' - CI_WEBPATH='' - \ No newline at end of file diff --git a/readme-vars.yml b/readme-vars.yml index 103d4dc..263072f 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -169,6 +169,7 @@ init_diagram: | "mastodon:glitch" <- Base Images # changelog changelogs: + - {date: "03.12.24:", desc: "Switch from commit builds to releases to match upstream changes."} - {date: "27.05.24:", desc: "Existing users should update their nginx confs to avoid http2 deprecation warnings."} - {date: "23.05.24:", desc: "Rebase to Alpine 3.20."} - {date: "02.05.24:", desc: "Rebase to Alpine 3.19, enable [Active Record Encryption](https://github.com/mastodon/mastodon/pull/29831/files)."} From b98734dcfd0d88d9ecc6e8a5d51b63fd4e82785a Mon Sep 17 00:00:00 2001 From: thespad Date: Wed, 4 Dec 2024 16:21:50 +0000 Subject: [PATCH 2/2] Use default builder --- .github/workflows/external_trigger.yml | 4 ++-- Jenkinsfile | 22 +++++++++++----------- README.md | 1 + jenkins-vars.yml | 5 +++-- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index 6719feb..c4fee76 100644 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -23,8 +23,8 @@ jobs: echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY echo "> External trigger running off of glitch branch. To disable this trigger, add \`mastodon_glitch\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY - EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/glitch-soc/mastodon/commits/main" | jq -r '. | .sha' | cut -c1-8) - echo "Type is \`github_commit\`" >> $GITHUB_STEP_SUMMARY + EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/glitch-soc/mastodon/releases/latest" | jq -r '. | .tag_name') + echo "Type is \`github_stable\`" >> $GITHUB_STEP_SUMMARY if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY echo "> Can't retrieve external version, exiting" >> $GITHUB_STEP_SUMMARY diff --git a/Jenkinsfile b/Jenkinsfile index 22c5118..d3b56eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ pipeline { CI_PORT='80' CI_SSL='false' CI_DELAY='120' - CI_DOCKERENV='TZ=US/Pacific' + CI_DOCKERENV='' CI_AUTH='' CI_WEBPATH='' } @@ -129,21 +129,21 @@ pipeline { /* ######################## External Release Tagging ######################## */ - // If this is a github commit trigger determine the current commit at head - stage("Set ENV github_commit"){ + // If this is a stable github release use the latest endpoint from github to determine the ext tag + stage("Set ENV github_stable"){ steps{ script{ env.EXT_RELEASE = sh( - script: '''curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/commits/${EXT_GIT_BRANCH} | jq -r '. | .sha' | cut -c1-8 ''', + script: '''curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''', returnStdout: true).trim() } } } - // If this is a github commit trigger Set the external release link - stage("Set ENV commit_link"){ + // 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 + '/commit/' + env.EXT_RELEASE + env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE } } } @@ -585,7 +585,7 @@ pipeline { --label \"org.opencontainers.image.title=Mastodon\" \ --label \"org.opencontainers.image.description=[Mastodon](https://github.com/mastodon/mastodon/) is a free, open-source social network server based on ActivityPub where users can follow friends and discover new ones.. \" \ --no-cache --pull -t ${IMAGE}:${META_TAG} --platform=linux/amd64 \ - --provenance=false --sbom=false --builder=container --load \ + --provenance=false --sbom=false --builder=default --load \ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." sh '''#! /bin/bash set -e @@ -649,7 +649,7 @@ pipeline { --label \"org.opencontainers.image.title=Mastodon\" \ --label \"org.opencontainers.image.description=[Mastodon](https://github.com/mastodon/mastodon/) is a free, open-source social network server based on ActivityPub where users can follow friends and discover new ones.. \" \ --no-cache --pull -t ${IMAGE}:amd64-${META_TAG} --platform=linux/amd64 \ - --provenance=false --sbom=false --builder=container --load \ + --provenance=false --sbom=false --builder=default --load \ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." sh '''#! /bin/bash set -e @@ -706,7 +706,7 @@ pipeline { --label \"org.opencontainers.image.title=Mastodon\" \ --label \"org.opencontainers.image.description=[Mastodon](https://github.com/mastodon/mastodon/) is a free, open-source social network server based on ActivityPub where users can follow friends and discover new ones.. \" \ --no-cache --pull -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} --platform=linux/arm64 \ - --provenance=false --sbom=false --builder=container --load \ + --provenance=false --sbom=false --builder=default --load \ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." sh '''#! /bin/bash set -e @@ -974,7 +974,7 @@ pipeline { "tagger": {"name": "LinuxServer-CI","email": "ci@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' echo "Pushing New release for Tag" sh '''#! /bin/bash - curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/commits/${EXT_RELEASE_CLEAN} | jq '.commit.message' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json + curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq '. |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json echo '{"tag_name":"'${META_TAG}'",\ "target_commitish": "glitch",\ "name": "'${META_TAG}'",\ diff --git a/README.md b/README.md index 6665b07..180c39c 100644 --- a/README.md +++ b/README.md @@ -432,6 +432,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **03.12.24:** - Switch from commit builds to releases to match upstream changes. * **27.05.24:** - Existing users should update their nginx confs to avoid http2 deprecation warnings. * **23.05.24:** - Rebase to Alpine 3.20. * **02.05.24:** - Rebase to Alpine 3.19, enable [Active Record Encryption](https://github.com/mastodon/mastodon/pull/29831/files). diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 2c2e5a1..1724b4a 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -6,8 +6,9 @@ external_type: github_stable release_type: prerelease release_tag: glitch ls_branch: glitch -image_sbom: true -image_provenance: true +image_provenance: false +image_sbom: false +image_builder: default repo_vars: - EXT_GIT_BRANCH = 'main' - EXT_USER = 'glitch-soc'