From 6e2567a39537341c1efed9847531c920bc4bc814 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Thu, 3 Oct 2024 10:45:27 -0400 Subject: [PATCH] update external trigger --- .github/workflows/external_trigger.yml | 4 ++-- Jenkinsfile | 24 +++++++++++------------- jenkins-vars.yml | 5 ++--- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index a27b9f2..1264c68 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 alpine319 branch. To disable this trigger, add \`python_alpine319\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY - EXT_RELEASE=$(curl -s "https://endoflife.date/api/python.json" | jq -r '. | .[0].latest') - echo "Type is \`custom_json\`" >> $GITHUB_STEP_SUMMARY + EXT_RELEASE=$(curl -u ${{ secrets.CR_USER }}:${{ secrets.CR_PAT }} -sX GET https://github.com/repos/python/cpython/tags | jq -r '.[] | select(.name | contains("rc") or contains("a") or contains("b") | not) | .name' | sed 's|^v||g' | sort -rV | head -1) + echo "Type is \`custom_version_command\`" >> $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 99d0ef4..addb14a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,8 +19,6 @@ pipeline { DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat') QUAYIO_API_TOKEN=credentials('quayio-repo-api-token') GIT_SIGNING_KEY=credentials('484fbca6-9a4f-455e-b9e3-97ac98785f5f') - JSON_URL = 'https://endoflife.date/api/python.json' - JSON_PATH = '.[0].latest' BUILD_VERSION_ARG = 'PYTHON_VERSION' LS_USER = 'linuxserver' LS_REPO = 'docker-python' @@ -128,16 +126,16 @@ pipeline { /* ######################## External Release Tagging ######################## */ - // If this is a custom json endpoint parse the return to get external tag - stage("Set ENV custom_json"){ - steps{ - script{ - env.EXT_RELEASE = sh( - script: '''curl -s ${JSON_URL} | jq -r ". | ${JSON_PATH}" ''', - returnStdout: true).trim() - env.RELEASE_LINK = env.JSON_URL - } - } + // If this is a custom command to determine version use that command + stage("Set tag custom bash"){ + steps{ + script{ + env.EXT_RELEASE = sh( + script: ''' curl -sX GET https://github.com/repos/python/cpython/tags | jq -r '.[] | select(.name | contains("rc") or contains("a") or contains("b") | not) | .name' | sed 's|^v||g' | sort -rV | head -1 ''', + returnStdout: true).trim() + env.RELEASE_LINK = 'custom_command' + } + } } // Sanitize the release tag and strip illegal docker or github characters stage("Sanitize tag"){ @@ -768,7 +766,7 @@ pipeline { "tagger": {"name": "LinuxServer-CI","email": "ci@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' echo "Pushing New release for Tag" sh '''#! /bin/bash - echo "Data change at JSON endpoint ${JSON_URL}" > releasebody.json + echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json echo '{"tag_name":"'${META_TAG}'",\ "target_commitish": "alpine319",\ "name": "'${META_TAG}'",\ diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 771c886..b207cf0 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -2,7 +2,8 @@ # jenkins variables project_name: docker-python -external_type: custom_json +external_type: na +custom_version_command: "curl -sX GET https://github.com/repos/python/cpython/tags | jq -r '.[] | select(.name | contains(\"rc\") or contains(\"a\") or contains(\"b\") | not) | .name' | sed 's|^v||g' | sort -rV | head -1" release_type: prerelease release_tag: alpine319 ls_branch: alpine319 @@ -10,8 +11,6 @@ skip_package_check: true unraid_template_sync: false unraid_template: false repo_vars: - - JSON_URL = 'https://endoflife.date/api/python.json' - - JSON_PATH = '.[0].latest' - BUILD_VERSION_ARG = 'PYTHON_VERSION' - LS_USER = 'linuxserver' - LS_REPO = 'docker-python'