From aadd7496b88e4a1e1067b9f583fa67d65749b59c Mon Sep 17 00:00:00 2001 From: thelamer Date: Mon, 13 Jan 2020 14:45:23 -0800 Subject: [PATCH] pull assets from github repo and drop netcore app chowning --- Dockerfile | 16 ++++++++++------ Dockerfile.aarch64 | 32 ++++++++++++++++++-------------- Dockerfile.armhf | 32 ++++++++++++++++++-------------- Jenkinsfile | 22 ++++++++++++++++------ README.md | 1 + jenkins-vars.yml | 6 ++++-- readme-vars.yml | 1 + root/etc/cont-init.d/30-config | 1 - 8 files changed, 68 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index 40bb52e..bd58ff9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG BUILD_DATE ARG VERSION ARG OMBI_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="aptalca" # environment settings ENV HOME="/config" @@ -15,20 +15,24 @@ RUN \ apt-get install -y \ jq \ libicu60 \ - libssl1.0 && \ + libssl1.0 \ + unzip && \ echo "**** install ombi ****" && \ mkdir -p \ /opt/ombi && \ if [ -z ${OMBI_RELEASE+x} ]; then \ - OMBI_RELEASE=$(curl -sL GET https://ci.appveyor.com/api/projects/tidusjar/requestplex/history?recordsNumber=100 | jq -r '. | first(.builds[] | select(.status == "success") | select(.branch =="feature/v4") | select(.pullRequestId == null)) | .version'); \ + OMBI_RELEASE=$(curl -sX GET "https://api.github.com/repos/tidusjar/Ombi.Releases/releases" \ + | jq -r '.[0] | .tag_name'); \ fi && \ - OMBI_JOBID=$(curl -s "https://ci.appveyor.com/api/projects/tidusjar/requestplex/build/${OMBI_RELEASE}" | jq -jr '. | .build.jobs[0].jobId') \ - OMBI_DURL="https://ci.appveyor.com/api/buildjobs/${OMBI_JOBID}/artifacts/linux.tar.gz"; \ + OMBI_DURL=$(curl -s https://api.github.com/repos/tidusjar/Ombi.Releases/releases/tags/"${OMBI_RELEASE}" \ + |jq -r '.assets[].browser_download_url' |grep 'linux-x64-') && \ curl -o \ /tmp/ombi-src.tar.gz -L \ "${OMBI_DURL}" && \ tar xzf /tmp/ombi-src.tar.gz -C \ - /opt/ombi/ && \ + /tmp/ && \ + unzip /tmp/linux-64/Ombi.zip \ + -d /opt/ombi/ && \ chmod +x /opt/ombi/Ombi && \ echo "**** clean up ****" && \ rm -rf \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index f9dac1b..691e86e 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -5,7 +5,7 @@ ARG BUILD_DATE ARG VERSION ARG OMBI_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="aptalca" # environment settings ENV HOME="/config" @@ -13,28 +13,32 @@ ENV HOME="/config" RUN \ apt-get update && \ apt-get install -y \ - jq \ - libicu60 \ - libssl1.0 && \ + jq \ + libicu60 \ + libssl1.0 \ + unzip && \ echo "**** install ombi ****" && \ mkdir -p \ - /opt/ombi && \ + /opt/ombi && \ if [ -z ${OMBI_RELEASE+x} ]; then \ - OMBI_RELEASE=$(curl -sL GET https://ci.appveyor.com/api/projects/tidusjar/requestplex/history?recordsNumber=100 | jq -r '. | first(.builds[] | select(.status == "success") | select(.branch =="feature/v4") | select(.pullRequestId == null)) | .version'); \ + OMBI_RELEASE=$(curl -sX GET "https://api.github.com/repos/tidusjar/Ombi.Releases/releases" \ + | jq -r '.[0] | .tag_name'); \ fi && \ - OMBI_JOBID=$(curl -s "https://ci.appveyor.com/api/projects/tidusjar/requestplex/build/${OMBI_RELEASE}" | jq -jr '. | .build.jobs[0].jobId') \ - OMBI_DURL="https://ci.appveyor.com/api/buildjobs/${OMBI_JOBID}/artifacts/linux-arm64.tar.gz"; \ + OMBI_DURL=$(curl -s https://api.github.com/repos/tidusjar/Ombi.Releases/releases/tags/"${OMBI_RELEASE}" \ + |jq -r '.assets[].browser_download_url' |grep 'linux-arm64-') && \ curl -o \ - /tmp/ombi-src.tar.gz -L \ - "${OMBI_DURL}" && \ + /tmp/ombi-src.tar.gz -L \ + "${OMBI_DURL}" && \ tar xzf /tmp/ombi-src.tar.gz -C \ - /opt/ombi/ && \ + /tmp/ && \ + unzip /tmp/linux-arm64/Ombi.zip \ + -d /opt/ombi/ && \ chmod +x /opt/ombi/Ombi && \ echo "**** clean up ****" && \ rm -rf \ - /tmp/* \ - /var/lib/apt/lists/* \ - /var/tmp/* + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* # add local files COPY /root / diff --git a/Dockerfile.armhf b/Dockerfile.armhf index de19084..25351ae 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -5,7 +5,7 @@ ARG BUILD_DATE ARG VERSION ARG OMBI_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="aptalca" # environment settings ENV HOME="/config" @@ -13,28 +13,32 @@ ENV HOME="/config" RUN \ apt-get update && \ apt-get install -y \ - jq \ - libicu60 \ - libssl1.0 && \ + jq \ + libicu60 \ + libssl1.0 \ + unzip && \ echo "**** install ombi ****" && \ mkdir -p \ - /opt/ombi && \ + /opt/ombi && \ if [ -z ${OMBI_RELEASE+x} ]; then \ - OMBI_RELEASE=$(curl -sL GET https://ci.appveyor.com/api/projects/tidusjar/requestplex/history?recordsNumber=100 | jq -r '. | first(.builds[] | select(.status == "success") | select(.branch =="feature/v4") | select(.pullRequestId == null)) | .version'); \ + OMBI_RELEASE=$(curl -sX GET "https://api.github.com/repos/tidusjar/Ombi.Releases/releases" \ + | jq -r '.[0] | .tag_name'); \ fi && \ - OMBI_JOBID=$(curl -s "https://ci.appveyor.com/api/projects/tidusjar/requestplex/build/${OMBI_RELEASE}" | jq -jr '. | .build.jobs[0].jobId') \ - OMBI_DURL="https://ci.appveyor.com/api/buildjobs/${OMBI_JOBID}/artifacts/linux-arm.tar.gz"; \ + OMBI_DURL=$(curl -s https://api.github.com/repos/tidusjar/Ombi.Releases/releases/tags/"${OMBI_RELEASE}" \ + |jq -r '.assets[].browser_download_url' |grep 'linux-arm-') && \ curl -o \ - /tmp/ombi-src.tar.gz -L \ - "${OMBI_DURL}" && \ + /tmp/ombi-src.tar.gz -L \ + "${OMBI_DURL}" && \ tar xzf /tmp/ombi-src.tar.gz -C \ - /opt/ombi/ && \ + /tmp/ && \ + unzip /tmp/linux-arm/Ombi.zip \ + -d /opt/ombi/ && \ chmod +x /opt/ombi/Ombi && \ echo "**** clean up ****" && \ rm -rf \ - /tmp/* \ - /var/lib/apt/lists/* \ - /var/tmp/* + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* # add local files COPY /root / diff --git a/Jenkinsfile b/Jenkinsfile index c930ad3..de58196 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,6 +16,9 @@ pipeline { GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab') GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0') GITLAB_NAMESPACE=credentials('gitlab-namespace-id') + EXT_GIT_BRANCH = 'master' + EXT_USER = 'tidusjar' + EXT_REPO = 'Ombi.Releases' CONTAINER_NAME = 'ombi' BUILD_VERSION_ARG = 'OMBI_RELEASE' LS_USER = 'linuxserver' @@ -99,14 +102,21 @@ pipeline { /* ######################## External Release Tagging ######################## */ - // If this is a custom command to determine version use that command - stage("Set tag custom bash"){ + // 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 -sL GET https://ci.appveyor.com/api/projects/tidusjar/requestplex/history?recordsNumber=100 | jq -r '. | first(.builds[] | select(.status == "success") | select(.branch =="feature/v4") | select(.pullRequestId == null)) | .version' ''', + script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases | jq -r '.[0] | .tag_name' ''', returnStdout: true).trim() - env.RELEASE_LINK = 'custom_command' + } + } + } + // 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 } } } @@ -672,11 +682,11 @@ 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 + curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases | jq '.[0] |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json echo '{"tag_name":"'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\ "target_commitish": "v4-preview",\ "name": "'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\ - "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**Remote Changes:**\\n\\n' > start + "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**'${EXT_REPO}' Changes:**\\n\\n' > start printf '","draft": false,"prerelease": true}' >> releasebody.json paste -d'\\0' start releasebody.json > releasebody.json.done curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done''' diff --git a/README.md b/README.md index d2b0525..34403a0 100644 --- a/README.md +++ b/README.md @@ -214,6 +214,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **13.01.20:** - Ingest the preview assets from a github release repo. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. * **22.02.19:** - Clarify info on tags and development builds. * **25.01.19:** - Add info on tags and development builds. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 256a9bc..fb86aba 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -2,12 +2,14 @@ # jenkins variables project_name: docker-ombi -external_type: na -custom_version_command: curl -sL GET https://ci.appveyor.com/api/projects/tidusjar/requestplex/history?recordsNumber=100 | jq -r '. | first(.builds[] | select(.status == "success") | select(.branch =="feature/v4") | select(.pullRequestId == null)) | .version' +external_type: github_devel release_type: prerelease release_tag: v4-preview ls_branch: v4-preview repo_vars: + - EXT_GIT_BRANCH = 'master' + - EXT_USER = 'tidusjar' + - EXT_REPO = 'Ombi.Releases' - CONTAINER_NAME = 'ombi' - BUILD_VERSION_ARG = 'OMBI_RELEASE' - LS_USER = 'linuxserver' diff --git a/readme-vars.yml b/readme-vars.yml index ee1cbf9..e10d578 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -47,6 +47,7 @@ app_setup_block: | Access the webui at `:3579`. Follow the setup wizard on initial install. Then configure the required services. # changelog changelogs: + - { date: "13.01.20:", desc: "Ingest the preview assets from a github release repo." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } - { date: "22.02.19:", desc: "Clarify info on tags and development builds." } - { date: "25.01.19:", desc: "Add info on tags and development builds." } diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config index e40dfd5..4a5264a 100644 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/cont-init.d/30-config @@ -2,5 +2,4 @@ # permissions chown -R abc:abc \ - /opt/ombi \ /config