From ecc16600daedb55e14c659a71c988e731316cc35 Mon Sep 17 00:00:00 2001
From: thelamer <ryankuba@gmail.com>
Date: Fri, 15 Mar 2019 23:54:02 -0700
Subject: [PATCH] shifting to os type and hard coding overlay version to avoid
 tag collision

---
 Dockerfile         |  6 +-----
 Dockerfile.aarch64 |  6 +-----
 Dockerfile.armhf   |  6 +-----
 Jenkinsfile        | 34 +++++++++++-----------------------
 jenkins-vars.yml   |  7 ++-----
 5 files changed, 16 insertions(+), 43 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index c702f56..eed4969 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -29,7 +29,7 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
 LABEL MAINTAINER="sparkyballs,TheLamer"
 
 # set version for s6 overlay
-ARG OVERLAY_VERSION
+ARG OVERLAY_VERSION="v1.22.0.0"
 ARG OVERLAY_ARCH="amd64"
 
 # set environment variables
@@ -87,10 +87,6 @@ RUN \
  echo "**** generate locale ****" && \
  locale-gen en_US.UTF-8 && \
  echo "**** add s6 overlay ****" && \
- if [ -z ${OVERLAY_VERSION+x} ]; then \
-        OVERLAY_VERSION=$(curl -sX GET "https://api.github.com/repos/just-containers/s6-overlay/releases/latest" \
-        | awk '/tag_name/{print $4;exit}' FS='[""]'); \
- fi && \
  curl -o \
  /tmp/s6-overlay.tar.gz -L \
 	"https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}.tar.gz" && \
diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64
index ad0db09..d8f44b1 100644
--- a/Dockerfile.aarch64
+++ b/Dockerfile.aarch64
@@ -31,7 +31,7 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
 LABEL MAINTAINER="sparkyballs,TheLamer"
 
 # set version for s6 overlay
-ARG OVERLAY_VERSION
+ARG OVERLAY_VERSION="v1.22.0.0"
 ARG OVERLAY_ARCH="aarch64"
 
 # set environment variables
@@ -89,10 +89,6 @@ RUN \
  echo "**** generate locale ****" && \
  locale-gen en_US.UTF-8 && \
  echo "**** add s6 overlay ****" && \
- if [ -z ${OVERLAY_VERSION+x} ]; then \
-        OVERLAY_VERSION=$(curl -sX GET "https://api.github.com/repos/just-containers/s6-overlay/releases/latest" \
-        | awk '/tag_name/{print $4;exit}' FS='[""]'); \
- fi && \
  curl -o \
  /tmp/s6-overlay.tar.gz -L \
 	"https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}.tar.gz" && \
diff --git a/Dockerfile.armhf b/Dockerfile.armhf
index 7e3554c..c8b3cb4 100644
--- a/Dockerfile.armhf
+++ b/Dockerfile.armhf
@@ -31,7 +31,7 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
 LABEL MAINTAINER="sparkyballs,TheLamer"
 
 # set version for s6 overlay
-ARG OVERLAY_VERSION
+ARG OVERLAY_VERSION="v1.22.0.0"
 ARG OVERLAY_ARCH="arm"
 
 # set environment variables
@@ -89,10 +89,6 @@ RUN \
  echo "**** generate locale ****" && \
  locale-gen en_US.UTF-8 && \
  echo "**** add s6 overlay ****" && \
- if [ -z ${OVERLAY_VERSION+x} ]; then \
-        OVERLAY_VERSION=$(curl -sX GET "https://api.github.com/repos/just-containers/s6-overlay/releases/latest" \
-        | awk '/tag_name/{print $4;exit}' FS='[""]'); \
- fi && \
  curl -o \
  /tmp/s6-overlay.tar.gz -L \
 	"https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}.tar.gz" && \
diff --git a/Jenkinsfile b/Jenkinsfile
index bc4c08c..5f14679 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -10,10 +10,7 @@ pipeline {
   environment {
     BUILDS_DISCORD=credentials('build_webhook_url')
     GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab')
-    EXT_GIT_BRANCH = 'master'
-    EXT_USER = 'just-containers'
-    EXT_REPO = 's6-overlay'
-    BUILD_VERSION_ARG = 'OVERLAY_VERSION'
+    BUILD_VERSION_ARG = 'OS'
     LS_USER = 'linuxserver'
     LS_REPO = 'docker-baseimage-ubuntu'
     CONTAINER_NAME = 'baseimage-ubuntu'
@@ -94,23 +91,14 @@ pipeline {
     /* ########################
        External Release Tagging
        ######################## */
-    // 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 -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''',
-           returnStdout: true).trim()
-       }
-     }
-    }
-    // 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
-       }
-     }
+    // If this is an os release set release type to none to indicate no external release
+    stage("Set ENV os"){
+      steps{
+        script{
+          env.EXT_RELEASE = env.PACKAGE_TAG
+          env.RELEASE_LINK = 'none'
+        }
+      }
     }
     // Sanitize the release tag and strip illegal docker or github characters
     stage("Sanitize tag"){
@@ -533,11 +521,11 @@ pipeline {
              "tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' '''
         echo "Pushing New release for Tag"
         sh '''#! /bin/bash
-              curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq '. |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json
+              echo "Updating base packages to ${PACKAGE_TAG}" > releasebody.json
               echo '{"tag_name":"'${EXT_RELEASE_CLEAN}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\
                      "target_commitish": "bionic",\
                      "name": "'${EXT_RELEASE_CLEAN}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\
-                     "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**'${EXT_REPO}' Changes:**\\n\\n' > start
+                     "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**OS Changes:**\\n\\n' > start
               printf '","draft": false,"prerelease": false}' >> 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/jenkins-vars.yml b/jenkins-vars.yml
index d404706..661c553 100644
--- a/jenkins-vars.yml
+++ b/jenkins-vars.yml
@@ -2,15 +2,12 @@
 
 # jenkins variables
 project_name: docker-baseimage-ubuntu
-external_type: github_stable
+external_type: os
 release_type: stable
 release_tag: bionic
 ls_branch: bionic
 repo_vars:
-  - EXT_GIT_BRANCH = 'master'
-  - EXT_USER = 'just-containers'
-  - EXT_REPO = 's6-overlay'
-  - BUILD_VERSION_ARG = 'OVERLAY_VERSION'
+  - BUILD_VERSION_ARG = 'OS'
   - LS_USER = 'linuxserver'
   - LS_REPO = 'docker-baseimage-ubuntu'
   - CONTAINER_NAME = 'baseimage-ubuntu'
-- 
GitLab