diff --git a/Dockerfile b/Dockerfile index fa773f4..924882e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ RUN \ echo "**** install plex ****" && \ if [ -z ${PLEX_RELEASE+x} ]; then \ PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \ - | jq -r 'first(.[] | .Linux.version)'); \ + | jq -r '.computer.Linux.version'); \ fi && \ curl -o \ /tmp/plexmediaserver.deb -L \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 7a987dc..961d8e1 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -35,8 +35,8 @@ RUN \ chmod +x /sbin/udevadm && \ echo "**** install plex ****" && \ if [ -z ${PLEX_RELEASE+x} ]; then \ - PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \ - | jq -r 'first(.[] | .Linux.version)'); \ + PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \ + | jq -r '.computer.Linux.version'); \ fi && \ curl -o \ /tmp/plexmediaserver.deb -L \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index f11fd6d..0e8036d 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -35,8 +35,8 @@ RUN \ chmod +x /sbin/udevadm && \ echo "**** install plex ****" && \ if [ -z ${PLEX_RELEASE+x} ]; then \ - PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \ - | jq -r 'first(.[] | .Linux.version)'); \ + PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \ + | jq -r '.computer.Linux.version'); \ fi && \ curl -o \ /tmp/plexmediaserver.deb -L \ diff --git a/Jenkinsfile b/Jenkinsfile index bc549d7..762977c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,6 +10,8 @@ pipeline { environment { BUILDS_DISCORD=credentials('build_webhook_url') GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab') + JSON_URL = 'https://plex.tv/api/downloads/5.json' + JSON_PATH = '.computer.Linux.version' BUILD_VERSION_ARG = 'PLEX_RELEASE' LS_USER = 'linuxserver' LS_REPO = 'docker-plex' @@ -91,16 +93,16 @@ pipeline { /* ######################## External Release Tagging ######################## */ - // 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 -s 'https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&distro=ubuntu' |grep -oP 'version="\\K[^"]+' | tail -n 1 ''', - returnStdout: true).trim() - env.RELEASE_LINK = 'custom_command' - } - } + // 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 + } + } } // Sanitize the release tag and strip illegal docker or github characters stage("Sanitize tag"){ @@ -558,7 +560,7 @@ pipeline { "tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' echo "Pushing New release for Tag" sh '''#! /bin/bash - echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json + echo "Data change at JSON endpoint ${JSON_URL}" > releasebody.json echo '{"tag_name":"'${EXT_RELEASE_CLEAN}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\ "target_commitish": "master",\ "name": "'${EXT_RELEASE_CLEAN}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\ diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 4be41fa..555e6bd 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -2,12 +2,13 @@ # jenkins variables project_name: docker-plex -external_type: na -custom_version_command: curl -s 'https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&distro=ubuntu' |grep -oP 'version="\\K[^"]+' | tail -n 1 +external_type: custom_json release_type: stable release_tag: latest ls_branch: master repo_vars: + - JSON_URL = 'https://plex.tv/api/downloads/5.json' + - JSON_PATH = '.computer.Linux.version' - BUILD_VERSION_ARG = 'PLEX_RELEASE' - LS_USER = 'linuxserver' - LS_REPO = 'docker-plex' diff --git a/root/etc/cont-init.d/60-plex-update b/root/etc/cont-init.d/60-plex-update index 4397579..2c942d3 100755 --- a/root/etc/cont-init.d/60-plex-update +++ b/root/etc/cont-init.d/60-plex-update @@ -100,7 +100,7 @@ if [[ "${VERSION,,}" = latest ]] || [[ "${VERSION,,}" = plexpass ]] || [[ "$PLEX fi REMOTE_VERSION=$(curl -s "https://plex.tv/downloads/details/5?distro=debian&build=linux-${PLEX_URL_ARCH}&channel=8&X-Plex-Token=$PLEX_TOKEN"| grep -oP 'version="\K[^"]+' | tail -n 1 ) elif [[ "${VERSION,,}" = public ]]; then -REMOTE_VERSION=curl -sX GET 'https://plex.tv/api/downloads/5.json' | jq -r 'first(.[] | .Linux.version)' +REMOTE_VERSION=curl -sX GET 'https://plex.tv/api/downloads/5.json' | jq -r '.computer.Linux.version' else REMOTE_VERSION="${VERSION}" fi