Skip to content

Commit 083f86a

Browse files
Bot Updating Templated Files
1 parent 426fd95 commit 083f86a

File tree

4 files changed

+58
-16
lines changed

4 files changed

+58
-16
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Read, and fill the Pull Request template
77
* If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR
88
* If the PR is addressing an existing issue include, closes #\<issue number>, in the body of the PR commit message
9-
* If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://discord.gg/YWrKVTn)
9+
* If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://linuxserver.io/discord)
1010

1111
## Common files
1212

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: Discord chat support
4-
url: https://discord.gg/YWrKVTn
4+
url: https://linuxserver.io/discord
55
about: Realtime support / chat with the community and the team.
66

77
- name: Discourse discussion forum

.github/workflows/external_trigger.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ jobs:
1515
SKIP_EXTERNAL_TRIGGER: ${{ vars.SKIP_EXTERNAL_TRIGGER }}
1616
run: |
1717
printf "# External trigger for docker-python\n\n" >> $GITHUB_STEP_SUMMARY
18-
if grep -q "^python_alpine319" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
18+
if grep -q "^python_alpine319_" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
19+
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
20+
echo "> Github organizational variable \`SKIP_EXTERNAL_TRIGGER\` contains \`python_alpine319_\`; will skip trigger if version matches." >> $GITHUB_STEP_SUMMARY
21+
elif grep -q "^python_alpine319" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
1922
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
2023
echo "> Github organizational variable \`SKIP_EXTERNAL_TRIGGER\` contains \`python_alpine319\`; skipping trigger." >> $GITHUB_STEP_SUMMARY
2124
exit 0
@@ -25,6 +28,11 @@ jobs:
2528
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
2629
EXT_RELEASE=$(curl -u ${{ secrets.CR_USER }}:${{ secrets.CR_PAT }} -sX GET https://api.github.com/repos/python/cpython/tags | jq -r '.[] | select(.name | contains("rc") or contains("a") or contains("b") | not) | .name' | sed 's|^v||g' | sort -rV | head -1)
2730
echo "Type is \`custom_version_command\`" >> $GITHUB_STEP_SUMMARY
31+
if grep -q "^python_alpine319_${EXT_RELEASE}" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
32+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
33+
echo "> Github organizational variable \`SKIP_EXTERNAL_TRIGGER\` matches current external release; skipping trigger." >> $GITHUB_STEP_SUMMARY
34+
exit 0
35+
fi
2836
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
2937
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
3038
echo "> Can't retrieve external version, exiting" >> $GITHUB_STEP_SUMMARY
@@ -48,13 +56,30 @@ jobs:
4856
--header "Accept: application/vnd.oci.image.index.v1+json" \
4957
--header "Authorization: Bearer ${token}" \
5058
"https://ghcr.io/v2/${image}/manifests/${tag}")
51-
multidigest=$(jq -r ".manifests[] | select(.platform.architecture == \"amd64\").digest?" <<< "${multidigest}")
52-
digest=$(curl -s \
53-
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
54-
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
55-
--header "Authorization: Bearer ${token}" \
56-
"https://ghcr.io/v2/${image}/manifests/${multidigest}" \
57-
| jq -r '.config.digest')
59+
if jq -e '.layers // empty' <<< "${multidigest}" >/dev/null 2>&1; then
60+
# If there's a layer element it's a single-arch manifest so just get that digest
61+
digest=$(jq -r '.config.digest' <<< "${multidigest}")
62+
else
63+
# Otherwise it's multi-arch or has manifest annotations
64+
if jq -e '.manifests[]?.annotations // empty' <<< "${multidigest}" >/dev/null 2>&1; then
65+
# Check for manifest annotations and delete if found
66+
multidigest=$(jq 'del(.manifests[] | select(.annotations))' <<< "${multidigest}")
67+
fi
68+
if [[ $(jq '.manifests | length' <<< "${multidigest}") -gt 1 ]]; then
69+
# If there's still more than one digest, it's multi-arch
70+
multidigest=$(jq -r ".manifests[] | select(.platform.architecture == \"amd64\").digest?" <<< "${multidigest}")
71+
else
72+
# Otherwise it's single arch
73+
multidigest=$(jq -r ".manifests[].digest?" <<< "${multidigest}")
74+
fi
75+
if digest=$(curl -s \
76+
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
77+
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
78+
--header "Authorization: Bearer ${token}" \
79+
"https://ghcr.io/v2/${image}/manifests/${multidigest}"); then
80+
digest=$(jq -r '.config.digest' <<< "${digest}");
81+
fi
82+
fi
5883
image_info=$(curl -sL \
5984
--header "Authorization: Bearer ${token}" \
6085
"https://ghcr.io/v2/${image}/blobs/${digest}")
@@ -92,7 +117,7 @@ jobs:
92117
else
93118
printf "\n## Trigger new build\n\n" >> $GITHUB_STEP_SUMMARY
94119
echo "New version \`${EXT_RELEASE}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
95-
if "${artifacts_found}" == "true" ]]; then
120+
if [[ "${artifacts_found}" == "true" ]]; then
96121
echo "All artifacts seem to be uploaded." >> $GITHUB_STEP_SUMMARY
97122
fi
98123
response=$(curl -iX POST \

.github/workflows/package_trigger_scheduler.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,26 @@ jobs:
2727
fi
2828
printf "\n## Evaluating \`%s\`\n\n" ${br} >> $GITHUB_STEP_SUMMARY
2929
JENKINS_VARS=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-python/${br}/jenkins-vars.yml)
30-
if [[ "${br}" == $(yq -r '.ls_branch' <<< "${JENKINS_VARS}") ]]; then
30+
if ! curl -sfX GET https://raw.githubusercontent.com/linuxserver/docker-python/${br}/Jenkinsfile >/dev/null 2>&1; then
31+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
32+
echo "> No Jenkinsfile found. Branch is either deprecated or is an early dev branch." >> $GITHUB_STEP_SUMMARY
33+
skipped_branches="${skipped_branches}${br} "
34+
elif [[ "${br}" == $(yq -r '.ls_branch' <<< "${JENKINS_VARS}") ]]; then
3135
echo "Branch appears to be live; checking workflow." >> $GITHUB_STEP_SUMMARY
32-
if [[ $(yq -r '.skip_package_check' <<< "${JENKINS_VARS}") == "true" ]]; then
36+
README_VARS=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-python/${br}/readme-vars.yml)
37+
if [[ $(yq -r '.project_deprecation_status' <<< "${README_VARS}") == "true" ]]; then
38+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
39+
echo "> Branch appears to be deprecated; skipping trigger." >> $GITHUB_STEP_SUMMARY
40+
skipped_branches="${skipped_branches}${br} "
41+
elif [[ $(yq -r '.skip_package_check' <<< "${JENKINS_VARS}") == "true" ]]; then
3342
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
3443
echo "> Skipping branch ${br} due to \`skip_package_check\` being set in \`jenkins-vars.yml\`." >> $GITHUB_STEP_SUMMARY
3544
skipped_branches="${skipped_branches}${br} "
3645
elif grep -q "^python_${br}" <<< "${SKIP_PACKAGE_TRIGGER}"; then
3746
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
3847
echo "> Github organizational variable \`SKIP_PACKAGE_TRIGGER\` contains \`python_${br}\`; skipping trigger." >> $GITHUB_STEP_SUMMARY
3948
skipped_branches="${skipped_branches}${br} "
40-
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-python/job/${br}/lastBuild/api/json | jq -r '.building') == "true" ]; then
49+
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-python/job/${br}/lastBuild/api/json | jq -r '.building' 2>/dev/null) == "true" ]; then
4150
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
4251
echo "> There already seems to be an active build on Jenkins; skipping package trigger for ${br}" >> $GITHUB_STEP_SUMMARY
4352
skipped_branches="${skipped_branches}${br} "
@@ -49,18 +58,26 @@ jobs:
4958
response=$(curl -iX POST \
5059
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-python/job/${br}/buildWithParameters?PACKAGE_CHECK=true \
5160
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
61+
if [[ -z "${response}" ]]; then
62+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
63+
echo "> Jenkins build could not be triggered. Skipping branch."
64+
continue
65+
fi
5266
echo "Jenkins [job queue url](${response%$'\r'})" >> $GITHUB_STEP_SUMMARY
5367
echo "Sleeping 10 seconds until job starts" >> $GITHUB_STEP_SUMMARY
5468
sleep 10
5569
buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
5670
buildurl="${buildurl%$'\r'}"
5771
echo "Jenkins job [build url](${buildurl})" >> $GITHUB_STEP_SUMMARY
5872
echo "Attempting to change the Jenkins job description" >> $GITHUB_STEP_SUMMARY
59-
curl -iX POST \
73+
if ! curl -ifX POST \
6074
"${buildurl}submitDescription" \
6175
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
6276
--data-urlencode "description=GHA package trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
63-
--data-urlencode "Submit=Submit"
77+
--data-urlencode "Submit=Submit"; then
78+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
79+
echo "> Unable to change the Jenkins job description."
80+
fi
6481
sleep 20
6582
fi
6683
else

0 commit comments

Comments
 (0)