Skip to content

Commit 5925aed

Browse files
authored
Merge pull request #14 from linuxserver/trigger
fix external trigger
2 parents e357465 + c0f4e91 commit 5925aed

File tree

5 files changed

+28
-16
lines changed

5 files changed

+28
-16
lines changed

.editorconfig

100755100644
File mode changed.

.github/workflows/external_trigger.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
2727
echo "> External trigger running off of main branch. To disable this trigger, add \`mullvad-browser_main\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY
2828
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
29-
EXT_RELEASE=$(curl -u ${{ secrets.CR_USER }}:${{ secrets.CR_PAT }} -sX GET "https://api.github.com/repos/mullvad/mullvad-browser/releases/latest" | jq -r .name | awk -F ' ' '{print $3}')
30-
echo "Type is \`custom_version_command\`" >> $GITHUB_STEP_SUMMARY
29+
EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/mullvad/mullvad-browser/releases/latest" | jq -r '. | .tag_name')
30+
echo "Type is \`github_stable\`" >> $GITHUB_STEP_SUMMARY
3131
if grep -q "^mullvad-browser_main_${EXT_RELEASE}" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
3232
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
3333
echo "> Github organizational variable \`SKIP_EXTERNAL_TRIGGER\` matches current external release; skipping trigger." >> $GITHUB_STEP_SUMMARY

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ RUN \
5151
mkdir -p /app && \
5252
if [ -z ${MULLVAD_VERSION+x} ]; then \
5353
MULLVAD_VERSION=$(curl -sX GET "https://api.github.com/repos/mullvad/mullvad-browser/releases/latest" \
54-
| jq -r .name | awk -F ' ' '{print $3}'); \
54+
| jq -r .tag_name); \
5555
fi && \
5656
curl -s -o \
5757
/tmp/mullvad.tar.xz -L \

Jenkinsfile

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ pipeline {
1919
DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat')
2020
QUAYIO_API_TOKEN=credentials('quayio-repo-api-token')
2121
GIT_SIGNING_KEY=credentials('484fbca6-9a4f-455e-b9e3-97ac98785f5f')
22+
EXT_GIT_BRANCH = 'main'
23+
EXT_USER = 'mullvad'
24+
EXT_REPO = 'mullvad-browser'
2225
BUILD_VERSION_ARG = 'MULLVAD_VERSION'
2326
LS_USER = 'linuxserver'
2427
LS_REPO = 'docker-mullvad-browser'
@@ -138,16 +141,23 @@ pipeline {
138141
/* ########################
139142
External Release Tagging
140143
######################## */
141-
// If this is a custom command to determine version use that command
142-
stage("Set tag custom bash"){
143-
steps{
144-
script{
145-
env.EXT_RELEASE = sh(
146-
script: ''' curl -sX GET "https://api.github.com/repos/mullvad/mullvad-browser/releases/latest" | jq -r .name | awk -F ' ' '{print $3}' ''',
147-
returnStdout: true).trim()
148-
env.RELEASE_LINK = 'custom_command'
149-
}
150-
}
144+
// If this is a stable github release use the latest endpoint from github to determine the ext tag
145+
stage("Set ENV github_stable"){
146+
steps{
147+
script{
148+
env.EXT_RELEASE = sh(
149+
script: '''curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''',
150+
returnStdout: true).trim()
151+
}
152+
}
153+
}
154+
// If this is a stable or devel github release generate the link for the build message
155+
stage("Set ENV github_link"){
156+
steps{
157+
script{
158+
env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE
159+
}
160+
}
151161
}
152162
// Sanitize the release tag and strip illegal docker or github characters
153163
stage("Sanitize tag"){
@@ -983,7 +993,7 @@ pipeline {
983993
"tagger": {"name": "LinuxServer-CI","email": "[email protected]","date": "'${GITHUB_DATE}'"}}' '''
984994
echo "Pushing New release for Tag"
985995
sh '''#! /bin/bash
986-
echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json
996+
curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq '. |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json
987997
echo '{"tag_name":"'${META_TAG}'",\
988998
"target_commitish": "main",\
989999
"name": "'${META_TAG}'",\

jenkins-vars.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
# jenkins variables
44
project_name: docker-mullvad-browser
5-
external_type: na
6-
custom_version_command: "curl -sX GET \"https://api.github.com/repos/mullvad/mullvad-browser/releases/latest\" | jq -r .name | awk -F ' ' '{print $3}'"
5+
external_type: github_stable
76
release_type: stable
87
release_tag: latest
98
ls_branch: main
109
build_armhf: false
1110
repo_vars:
11+
- EXT_GIT_BRANCH = 'main'
12+
- EXT_USER = 'mullvad'
13+
- EXT_REPO = 'mullvad-browser'
1214
- BUILD_VERSION_ARG = 'MULLVAD_VERSION'
1315
- LS_USER = 'linuxserver'
1416
- LS_REPO = 'docker-mullvad-browser'

0 commit comments

Comments
 (0)