diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index 6a2cd94..f197e43 100644 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -29,7 +29,7 @@ jobs: echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY echo "> External trigger running off of main branch. To disable this trigger, add \`unifi-network-application_main\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY - EXT_RELEASE=$(curl -sX GET 'https://fw-update.ubnt.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release' | jq -r '._embedded.firmware[].version' | awk -F '+' '{print $1}') + EXT_RELEASE=$(curl -sX GET 'https://fw-update.ubnt.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release' | jq -r '._embedded.firmware[].version' | awk -F '+' '{print $1}' | tr -d 'v') echo "Type is \`custom_version_command\`" >> $GITHUB_STEP_SUMMARY if grep -q "^unifi-network-application_main_${EXT_RELEASE}" <<< "${SKIP_EXTERNAL_TRIGGER}"; then echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY diff --git a/Dockerfile b/Dockerfile index 676cee2..a763308 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,10 +24,11 @@ RUN \ if [ -z ${UNIFI_VERSION+x} ]; then \ UNIFI_VERSION=$(curl -sX GET "https://fw-update.ubnt.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release" \ | jq -r '._embedded.firmware[].version' \ - | awk -F '+' '{print $1}'); \ + | awk -F '+' '{print $1}' \ + | tr -d 'v'); \ fi && \ UNIFI_DOWNLOAD=$(curl -sX GET "https://fw-update.ubnt.com/api/firmware?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release&sort=-version" \ - | jq -r "._embedded.firmware[] | select(.version | test(\"${UNIFI_VERSION}\")) | ._links.data.href") && \ + | jq -r "._embedded.firmware[] | select(.version | test(\"v${UNIFI_VERSION}\")) | ._links.data.href") && \ mkdir -p /app && \ curl -o \ /tmp/unifi.zip -L \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index b1fedef..737a07b 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -24,10 +24,11 @@ RUN \ if [ -z ${UNIFI_VERSION+x} ]; then \ UNIFI_VERSION=$(curl -sX GET "https://fw-update.ubnt.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release" \ | jq -r '._embedded.firmware[].version' \ - | awk -F '+' '{print $1}'); \ + | awk -F '+' '{print $1}' \ + | tr -d 'v'); \ fi && \ UNIFI_DOWNLOAD=$(curl -sX GET "https://fw-update.ubnt.com/api/firmware?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release&sort=-version" \ - | jq -r "._embedded.firmware[] | select(.version | test(\"${UNIFI_VERSION}\")) | ._links.data.href") && \ + | jq -r "._embedded.firmware[] | select(.version | test(\"v${UNIFI_VERSION}\")) | ._links.data.href") && \ mkdir -p /app && \ curl -o \ /tmp/unifi.zip -L \ diff --git a/Jenkinsfile b/Jenkinsfile index 3ae5cc6..8946f28 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -147,7 +147,7 @@ pipeline { steps{ script{ env.EXT_RELEASE = sh( - script: ''' curl -sX GET 'https://fw-update.ubnt.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release' | jq -r '._embedded.firmware[].version' | awk -F '+' '{print $1}' ''', + script: ''' curl -sX GET 'https://fw-update.ubnt.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release' | jq -r '._embedded.firmware[].version' | awk -F '+' '{print $1}' | tr -d 'v' ''', returnStdout: true).trim() env.RELEASE_LINK = 'custom_command' } diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 86449a7..eab02f0 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -3,7 +3,7 @@ # jenkins variables project_name: unifi-network-application external_type: na -custom_version_command: "curl -sX GET 'https://fw-update.ubnt.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release' | jq -r '._embedded.firmware[].version' | awk -F '+' '{print $1}'" +custom_version_command: "curl -sX GET 'https://fw-update.ubnt.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release' | jq -r '._embedded.firmware[].version' | awk -F '+' '{print $1}' | tr -d 'v'" release_type: stable release_tag: latest ls_branch: main