Skip to content

Commit e78aa4b

Browse files
committed
Update release check
1 parent 270ae4e commit e78aa4b

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

.github/workflows/external_trigger.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
echo "**** External trigger running off of development branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_OMBI_DEVELOPMENT\". ****"
2121
echo "External trigger running off of development branch. To disable this trigger, set a Github secret named \`PAUSE_EXTERNAL_TRIGGER_OMBI_DEVELOPMENT\`" >> $GITHUB_STEP_SUMMARY
2222
echo "**** Retrieving external version ****"
23-
EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/Ombi-app/ombi/releases" | jq -r '. | first(.[] | select(.prerelease == true)) | .tag_name')
23+
EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/Ombi-app/Ombi/releases" | jq -r '.[0] | .tag_name')
2424
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
2525
echo "**** Can't retrieve external version, exiting ****"
2626
FAILURE_REASON="Can't retrieve external version for ombi branch development"

Jenkinsfile

+21-14
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ pipeline {
1717
GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0')
1818
GITLAB_NAMESPACE=credentials('gitlab-namespace-id')
1919
DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat')
20-
JSON_URL = 'https://api.github.com/repos/Ombi-app/ombi/releases'
21-
JSON_PATH = 'first(.[] | select(.prerelease == true)) | .tag_name'
20+
EXT_USER = 'Ombi-app'
21+
EXT_REPO = 'Ombi'
2222
CONTAINER_NAME = 'ombi'
2323
BUILD_VERSION_ARG = 'OMBI_RELEASE'
2424
LS_USER = 'linuxserver'
@@ -113,16 +113,23 @@ pipeline {
113113
/* ########################
114114
External Release Tagging
115115
######################## */
116-
// If this is a custom json endpoint parse the return to get external tag
117-
stage("Set ENV custom_json"){
118-
steps{
119-
script{
120-
env.EXT_RELEASE = sh(
121-
script: '''curl -s ${JSON_URL} | jq -r ". | ${JSON_PATH}" ''',
122-
returnStdout: true).trim()
123-
env.RELEASE_LINK = env.JSON_URL
124-
}
125-
}
116+
// If this is a devel github release use the first in an array from github to determine the ext tag
117+
stage("Set ENV github_devel"){
118+
steps{
119+
script{
120+
env.EXT_RELEASE = sh(
121+
script: '''curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases | jq -r '.[0] | .tag_name' ''',
122+
returnStdout: true).trim()
123+
}
124+
}
125+
}
126+
// If this is a stable or devel github release generate the link for the build message
127+
stage("Set ENV github_link"){
128+
steps{
129+
script{
130+
env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE
131+
}
132+
}
126133
}
127134
// Sanitize the release tag and strip illegal docker or github characters
128135
stage("Sanitize tag"){
@@ -855,11 +862,11 @@ pipeline {
855862
"tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' '''
856863
echo "Pushing New release for Tag"
857864
sh '''#! /bin/bash
858-
echo "Data change at JSON endpoint ${JSON_URL}" > releasebody.json
865+
curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases | jq '.[0] |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json
859866
echo '{"tag_name":"'${META_TAG}'",\
860867
"target_commitish": "development",\
861868
"name": "'${META_TAG}'",\
862-
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Remote Changes:**\\n\\n' > start
869+
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**'${EXT_REPO}' Changes:**\\n\\n' > start
863870
printf '","draft": false,"prerelease": true}' >> releasebody.json
864871
paste -d'\\0' start releasebody.json > releasebody.json.done
865872
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''

jenkins-vars.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
# jenkins variables
33
project_name: docker-ombi
4-
external_type: custom_json
4+
external_type: github_devel
55
release_type: prerelease
66
release_tag: development
77
ls_branch: development
88
repo_vars:
9-
- JSON_URL = 'https://api.github.com/repos/Ombi-app/ombi/releases'
10-
- JSON_PATH = 'first(.[] | select(.prerelease == true)) | .tag_name'
9+
- EXT_USER = 'Ombi-app'
10+
- EXT_REPO = 'Ombi'
1111
- CONTAINER_NAME = 'ombi'
1212
- BUILD_VERSION_ARG = 'OMBI_RELEASE'
1313
- LS_USER = 'linuxserver'
@@ -16,7 +16,6 @@ repo_vars:
1616
- DEV_DOCKERHUB_IMAGE = 'lsiodev/ombi'
1717
- PR_DOCKERHUB_IMAGE = 'lspipepr/ombi'
1818
- DIST_IMAGE = 'ubuntu'
19-
- DIST_TAG = 'bionic'
2019
- MULTIARCH='true'
2120
- CI='true'
2221
- CI_WEB='true'

0 commit comments

Comments
 (0)