Skip to content

Commit 504632a

Browse files
Bot Updating Templated Files
1 parent 7cf17b0 commit 504632a

3 files changed

Lines changed: 91 additions & 44 deletions

File tree

.github/workflows/external_trigger.yml

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ jobs:
1111

1212
- name: External Trigger
1313
if: github.ref == 'refs/heads/development'
14+
env:
15+
SKIP_EXTERNAL_TRIGGER: ${{ vars.SKIP_EXTERNAL_TRIGGER }}
1416
run: |
1517
printf "# External trigger for docker-ombi\n\n" >> $GITHUB_STEP_SUMMARY
16-
if [ -n "${{ secrets.PAUSE_EXTERNAL_TRIGGER_OMBI_DEVELOPMENT }}" ]; then
18+
if grep -q "^ombi_development" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
1719
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
18-
echo "> Github secret \`PAUSE_EXTERNAL_TRIGGER_OMBI_DEVELOPMENT\` is set; skipping trigger." >> $GITHUB_STEP_SUMMARY
20+
echo "> Github organizational variable \`SKIP_EXTERNAL_TRIGGER\` contains \`ombi_development\`; skipping trigger." >> $GITHUB_STEP_SUMMARY
1921
exit 0
2022
fi
2123
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
22-
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
24+
echo "> External trigger running off of development branch. To disable this trigger, add \`ombi_development\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY
2325
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
2426
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')
2527
echo "Type is \`github_devel\`" >> $GITHUB_STEP_SUMMARY
@@ -78,26 +80,38 @@ jobs:
7880
echo "New version \`${EXT_RELEASE}\` found; but there already seems to be an active build on Jenkins; exiting" >> $GITHUB_STEP_SUMMARY
7981
exit 0
8082
else
81-
printf "\n## Trigger new build\n\n" >> $GITHUB_STEP_SUMMARY
82-
echo "New version \`${EXT_RELEASE}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
83-
response=$(curl -iX POST \
84-
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-ombi/job/development/buildWithParameters?PACKAGE_CHECK=false \
85-
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
86-
echo "Jenkins [job queue url](${response%$'\r'})" >> $GITHUB_STEP_SUMMARY
87-
echo "Sleeping 10 seconds until job starts" >> $GITHUB_STEP_SUMMARY
88-
sleep 10
89-
buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
90-
buildurl="${buildurl%$'\r'}"
91-
echo "Jenkins job [build url](${buildurl})" >> $GITHUB_STEP_SUMMARY
92-
echo "Attempting to change the Jenkins job description" >> $GITHUB_STEP_SUMMARY
93-
curl -iX POST \
94-
"${buildurl}submitDescription" \
95-
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
96-
--data-urlencode "description=GHA external trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
97-
--data-urlencode "Submit=Submit"
98-
echo "**** Notifying Discord ****"
99-
TRIGGER_REASON="A version change was detected for ombi tag development. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE}"
100-
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
101-
"description": "**Build Triggered** \n**Reason:** '"${TRIGGER_REASON}"' \n**Build URL:** '"${buildurl}display/redirect"' \n"}],
102-
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
83+
if [[ "${artifacts_found}" == "false" ]]; then
84+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
85+
echo "> New version detected, but not all artifacts are published yet; skipping trigger" >> $GITHUB_STEP_SUMMARY
86+
FAILURE_REASON="New version ${EXT_RELEASE} for ombi tag development is detected, however not all artifacts are uploaded to upstream release yet. Will try again later."
87+
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
88+
"description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n"}],
89+
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
90+
else
91+
printf "\n## Trigger new build\n\n" >> $GITHUB_STEP_SUMMARY
92+
echo "New version \`${EXT_RELEASE}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
93+
if "${artifacts_found}" == "true" ]]; then
94+
echo "All artifacts seem to be uploaded." >> $GITHUB_STEP_SUMMARY
95+
fi
96+
response=$(curl -iX POST \
97+
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-ombi/job/development/buildWithParameters?PACKAGE_CHECK=false \
98+
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
99+
echo "Jenkins [job queue url](${response%$'\r'})" >> $GITHUB_STEP_SUMMARY
100+
echo "Sleeping 10 seconds until job starts" >> $GITHUB_STEP_SUMMARY
101+
sleep 10
102+
buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
103+
buildurl="${buildurl%$'\r'}"
104+
echo "Jenkins job [build url](${buildurl})" >> $GITHUB_STEP_SUMMARY
105+
echo "Attempting to change the Jenkins job description" >> $GITHUB_STEP_SUMMARY
106+
curl -iX POST \
107+
"${buildurl}submitDescription" \
108+
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
109+
--data-urlencode "description=GHA external trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
110+
--data-urlencode "Submit=Submit"
111+
echo "**** Notifying Discord ****"
112+
TRIGGER_REASON="A version change was detected for ombi tag development. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE}"
113+
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
114+
"description": "**Build Triggered** \n**Reason:** '"${TRIGGER_REASON}"' \n**Build URL:** '"${buildurl}display/redirect"' \n"}],
115+
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
116+
fi
103117
fi

.github/workflows/package_trigger_scheduler.yml

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
fetch-depth: '0'
1515

1616
- name: Package Trigger Scheduler
17+
env:
18+
SKIP_PACKAGE_TRIGGER: ${{ vars.SKIP_PACKAGE_TRIGGER }}
1719
run: |
1820
printf "# Package trigger scheduler for docker-ombi\n\n" >> $GITHUB_STEP_SUMMARY
1921
printf "Found the branches:\n\n%s\n" "$(git for-each-ref --format='- %(refname:lstrip=3)' refs/remotes)" >> $GITHUB_STEP_SUMMARY
@@ -24,27 +26,57 @@ jobs:
2426
continue
2527
fi
2628
printf "\n## Evaluating \`%s\`\n\n" ${br} >> $GITHUB_STEP_SUMMARY
27-
ls_branch=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-ombi/${br}/jenkins-vars.yml | yq -r '.ls_branch')
28-
if [ "${br}" == "${ls_branch}" ]; then
29+
JENKINS_VARS=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-ombi/${br}/jenkins-vars.yml)
30+
if [[ "${br}" == $(yq -r '.ls_branch' <<< "${JENKINS_VARS}") ]]; then
2931
echo "Branch appears to be live; checking workflow." >> $GITHUB_STEP_SUMMARY
30-
if curl -sfX GET https://raw.githubusercontent.com/linuxserver/docker-ombi/${br}/.github/workflows/package_trigger.yml > /dev/null 2>&1; then
31-
echo "Triggering package trigger workflow for branch ${br}" >> $GITHUB_STEP_SUMMARY
32+
if [[ $(yq -r '.skip_package_check' <<< "${JENKINS_VARS}") == "true" ]]; then
33+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
34+
echo "> Skipping branch ${br} due to \`skip_package_check\` being set in \`jenkins-vars.yml\`." >> $GITHUB_STEP_SUMMARY
35+
skipped_branches="${skipped_branches}${br} "
36+
elif grep -q "^ombi_${br}" <<< "${SKIP_PACKAGE_TRIGGER}"; then
37+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
38+
echo "> Github organizational variable \`SKIP_PACKAGE_TRIGGER\` contains \`ombi_${br}\`; skipping trigger." >> $GITHUB_STEP_SUMMARY
39+
skipped_branches="${skipped_branches}${br} "
40+
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-ombi/job/${br}/lastBuild/api/json | jq -r '.building') == "true" ]; then
41+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
42+
echo "> There already seems to be an active build on Jenkins; skipping package trigger for ${br}" >> $GITHUB_STEP_SUMMARY
43+
skipped_branches="${skipped_branches}${br} "
44+
else
45+
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
46+
echo "> Triggering package trigger for branch ${br}" >> $GITHUB_STEP_SUMMARY
47+
printf "> To disable, add \`ombi_%s\` into the Github organizational variable \`SKIP_PACKAGE_TRIGGER\`.\n\n" "${br}" >> $GITHUB_STEP_SUMMARY
3248
triggered_branches="${triggered_branches}${br} "
49+
response=$(curl -iX POST \
50+
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-ombi/job/${br}/buildWithParameters?PACKAGE_CHECK=true \
51+
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
52+
echo "Jenkins [job queue url](${response%$'\r'})" >> $GITHUB_STEP_SUMMARY
53+
echo "Sleeping 10 seconds until job starts" >> $GITHUB_STEP_SUMMARY
54+
sleep 10
55+
buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
56+
buildurl="${buildurl%$'\r'}"
57+
echo "Jenkins job [build url](${buildurl})" >> $GITHUB_STEP_SUMMARY
58+
echo "Attempting to change the Jenkins job description" >> $GITHUB_STEP_SUMMARY
3359
curl -iX POST \
34-
-H "Authorization: token ${{ secrets.CR_PAT }}" \
35-
-H "Accept: application/vnd.github.v3+json" \
36-
-d "{\"ref\":\"refs/heads/${br}\"}" \
37-
https://api.github.com/repos/linuxserver/docker-ombi/actions/workflows/package_trigger.yml/dispatches
38-
sleep 30
39-
else
40-
echo "Skipping branch ${br} due to no package trigger workflow present." >> $GITHUB_STEP_SUMMARY
60+
"${buildurl}submitDescription" \
61+
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
62+
--data-urlencode "description=GHA package trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
63+
--data-urlencode "Submit=Submit"
64+
sleep 20
4165
fi
4266
else
4367
echo "Skipping branch ${br} due to being detected as dev branch." >> $GITHUB_STEP_SUMMARY
4468
fi
4569
done
46-
echo "**** Package check build(s) triggered for branch(es): ${triggered_branches} ****"
47-
echo "**** Notifying Discord ****"
48-
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
49-
"description": "**Package Check Build(s) Triggered for ombi** \n**Branch(es):** '"${triggered_branches}"' \n**Build URL:** '"https://ci.linuxserver.io/blue/organizations/jenkins/Docker-Pipeline-Builders%2Fdocker-ombi/activity/"' \n"}],
50-
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
70+
if [[ -n "${triggered_branches}" ]] || [[ -n "${skipped_branches}" ]]; then
71+
if [[ -n "${triggered_branches}" ]]; then
72+
NOTIFY_BRANCHES="**Triggered:** ${triggered_branches} \n"
73+
fi
74+
if [[ -n "${skipped_branches}" ]]; then
75+
NOTIFY_BRANCHES="${NOTIFY_BRANCHES}**Skipped:** ${skipped_branches} \n"
76+
fi
77+
echo "**** Package check build(s) triggered for branch(es): ${triggered_branches} ****"
78+
echo "**** Notifying Discord ****"
79+
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
80+
"description": "**Package Check Build(s) Triggered for ombi** \n'"${NOTIFY_BRANCHES}"'**Build URL:** '"https://ci.linuxserver.io/blue/organizations/jenkins/Docker-Pipeline-Builders%2Fdocker-ombi/activity/"' \n"}],
81+
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
82+
fi

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Find us at:
3737
[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/ombi.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=pulls&logo=docker)](https://hub.docker.com/r/linuxserver/ombi)
3838
[![Docker Stars](https://img.shields.io/docker/stars/linuxserver/ombi.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=stars&logo=docker)](https://hub.docker.com/r/linuxserver/ombi)
3939
[![Jenkins Build](https://img.shields.io/jenkins/build?labelColor=555555&logoColor=ffffff&style=for-the-badge&jobUrl=https%3A%2F%2Fci.linuxserver.io%2Fjob%2FDocker-Pipeline-Builders%2Fjob%2Fdocker-ombi%2Fjob%2Fdevelopment%2F&logo=jenkins)](https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-ombi/job/development/)
40-
[![LSIO CI](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=CI&query=CI&url=https%3A%2F%2Fci-tests.linuxserver.io%2Flinuxserver%2Fombi%2Flatest%2Fci-status.yml)](https://ci-tests.linuxserver.io/linuxserver/ombi/latest/index.html)
40+
[![LSIO CI](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=CI&query=CI&url=https%3A%2F%2Fci-tests.linuxserver.io%2Flinuxserver%2Fombi%2Fdevelopment%2Fci-status.yml)](https://ci-tests.linuxserver.io/linuxserver/ombi/development/index.html)
4141

4242
[Ombi](https://ombi.io) allows you to host your own Plex Request and user management system.
4343
If you are sharing your Plex server with other users, allow them to request new content using an easy to manage interface!
@@ -79,8 +79,8 @@ Access the webui at `<your-ip>:3579`. Follow the setup wizard on initial install
7979
This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/).
8080

8181
### Caveats
82-
* `BASE_URL` cannot be changed from `/`
8382

83+
* `BASE_URL` cannot be changed from `/`
8484

8585
## Usage
8686

@@ -271,7 +271,8 @@ Below are the instructions for updating containers:
271271

272272
### Image Update Notifications - Diun (Docker Image Update Notifier)
273273

274-
**tip**: We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported.
274+
>[!TIP]
275+
>We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported.
275276

276277
## Building locally
277278

0 commit comments

Comments
 (0)