Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor (and re-apply) generate-repo-stub-readme.sh #2502

Closed
yosifkit opened this issue Nov 19, 2024 · 1 comment · Fixed by #2503
Closed

Refactor (and re-apply) generate-repo-stub-readme.sh #2502

yosifkit opened this issue Nov 19, 2024 · 1 comment · Fixed by #2503

Comments

@yosifkit
Copy link
Member

The migration of the new "meta" jobs out of "work-in-progress" (docker-library/meta-scripts#94 docker-library/meta-scripts#95) has reminded me that we need to finally delete the multiarch jobs on Jenkins. And once we do that, then the badges will stop working. They are currently not providing value since the multiarch jobs are unused. We do not have a 1 for 1 replacement since the new jobs are not per-repo, but strictly per-arch only. I guess the put-shared badge will still be correct for now.

So, this issue is to make a choice with the code in generate-repo-stub-readme.sh and then apply it to all of our image-specific repos:

badges=()
n=$'\n'
t=$'\t'
branch='master'
toTest=(
# "image badge URL"
# "image badge link/href"
# "badge test URL (to determine whether badge applies)"
"https://img.shields.io/github/actions/workflow/status/$githubRepoName/ci.yml?branch=$branch&label=GitHub%20CI"
"https://github.com/$githubRepoName/actions?query=workflow%3A%22GitHub+CI%22+branch%3A$branch"
"https://github.com/$githubRepoName/blob/$branch/.github/workflows/ci.yml"
"https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/$repo.svg?label=Automated%20update.sh"
"https://doi-janky.infosiftr.net/job/update.sh/job/$repo/"
"https://doi-janky.infosiftr.net/job/update.sh/job/$repo/"
)
_wget_spider() {
wget -q -o /dev/null -O /dev/null --spider "$@"
}
set -- "${toTest[@]}"
while [ "$#" -gt 0 ]; do
image="$1"; shift
url="$1"; shift
testUrl="$1"; shift
if _wget_spider "$testUrl"; then
badges+=( "-${t}[![build status badge]($image)]($url)" )
fi
done
arches="$(bashbrew cat --format '{{ range .Entries }}{{ join "\n" .Architectures }}{{ "\n" }}{{ end }}' "https://github.com/docker-library/official-images/raw/master/library/$repo" | sort -u)"
if [ -n "$arches" ]; then
archTable=
i=0
for arch in $arches put-shared; do
if [ "$arch" = 'put-shared' ]; then
jenkinsJob="job/put-shared/job/light/job/$repo"
if ! _wget_spider "https://doi-janky.infosiftr.net/$jenkinsJob/"; then
jenkinsJob='job/put-shared/job/heavy'
fi
else
jenkinsJob="job/multiarch/job/$arch/job/$repo"
fi
jenkinsLink="https://doi-janky.infosiftr.net/$jenkinsJob/"
jenkinsImage="https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/$jenkinsJob.svg?label=$arch"
if _wget_spider "$jenkinsLink"; then
archTable="${archTable:-|} [![$arch build status badge]($jenkinsImage)]($jenkinsLink) |"
(( i = (i + 1) % 4 )) || : # modulo here needs to match the number of colums used below
if [ "$i" = 0 ]; then
archTable+="${n}|"
fi
fi
done
if [ -n "$archTable" ]; then
if [ "${#badges[@]}" -gt 0 ]; then
badges+=( '' )
fi
badges+=( "| Build | Status | Badges | (per-arch) |${n}|:-:|:-:|:-:|:-:|${n}${archTable%${n}|}" )
fi
fi
if [ "${#badges[@]}" -gt 0 ]; then
IFS=$'\n'
cat <<-EOREADME
---
${badges[*]}
EOREADME
unset IFS
fi

@tianon
Copy link
Member

tianon commented Nov 20, 2024

IMO we should just remove all of these -- the GitHub ones give a false sense of "status" (they're only useful to maintainers/contributors), and the rest don't have a direct analog in the new system. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants