Add back windows checksums - #578
Conversation
| if checksums="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums.txt")"; then | ||
| buildx="$(jq <<<"$checksums" -csR --arg version "$buildxVersion" ' | ||
| rtrimstr("\n") | split("\n") | ||
| | map( | ||
| split(" [ *]?"; "") | ||
| checksums+=$'\n' # add back trailing newline to separate the two checksums files | ||
| if checksums+="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums-signed.txt")"; then |
There was a problem hiding this comment.
I don't love how deeply nested this makes everything -- why not capture both, with an echo in between if necessary?
| if checksums="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums.txt")"; then | |
| buildx="$(jq <<<"$checksums" -csR --arg version "$buildxVersion" ' | |
| rtrimstr("\n") | split("\n") | |
| | map( | |
| split(" [ *]?"; "") | |
| checksums+=$'\n' # add back trailing newline to separate the two checksums files | |
| if checksums+="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums-signed.txt")"; then | |
| if checksums="$( | |
| set -Eeuo pipefail | |
| _curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums.txt" | |
| echo | |
| _curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums-signed.txt" | |
| )"; then |
There was a problem hiding this comment.
I wanted to make sure that either file not existing would fail so that we don't end up in the partial state again with missing windows urls. Even with set -Eeuo pipefail in the subshell, it doesn't fail early and still runs every command in it.
if checksums="$(set -x -Eeuo pipefail
_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums.txt"
_curl 'http://github.com/something-that-doesnt-exist'
_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums-signed.txt")"; then++ _curl https://github.com/docker/buildx/releases/download/v0.36.0/checksums.txt
++ exec
++ local code
+++ curl --silent --location -o /dev/fd/42 --write-out '%{http_code}' https://github.com/docker/buildx/releases/download/v0.36.0/checksums.txt
++ code=200
++ case "$code" in
++ return 0
++ _curl http://github.com/something-that-doesnt-exist
++ exec
++ local code
+++ curl --silent --location -o /dev/fd/42 --write-out '%{http_code}' http://github.com/something-that-doesnt-exist
++ code=404
++ case "$code" in
++ return 1
++ _curl https://github.com/docker/buildx/releases/download/v0.36.0/checksums-signed.txt
++ exec
++ local code
+++ curl --silent --location -o /dev/fd/42 --write-out '%{http_code}' https://github.com/docker/buildx/releases/download/v0.36.0/checksums-signed.txt
++ code=200
++ case "$code" in
++ return 0
jq: error (at <stdin>:56): failed to parse os-arch from filename: Found8a75be22ecf40f633fe0a0199be48fa304c0446a0d7fa8a53d7c71b1d0093028There was a problem hiding this comment.
I think this would work for a single if.
if checksums="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums.txt")" \
&& checksums+=$'\n'"$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums-signed.txt")"; thenEdit: I am unsure how to make nice whitespace with it.
There was a problem hiding this comment.
Oh, that's probably the set -e propagation (or rather, lack thereof) inside our function -- I think it needs || return 1 on curl 🤔
$ bash -Eeuo pipefail -xc 'foo="$( echo yes; false; echo no )"; echo "$foo"'
++ echo yes
++ false
++ echo no
+ foo='yes
no'
+ echo 'yes
no'
yes
no
$ bash -Eeuo pipefail -xc 'foo="$( set -Eeuo pipefail; echo yes; false; echo no )"; echo "$foo"'
++ set -Eeuo pipefail
++ echo yes
++ false
+ foo=yes
$ # we fail on `foo=` because the whole line ends up returning `false`There was a problem hiding this comment.
$ bash -Eeuo pipefail -xc 'if foo="$( set -Eeuo pipefail; echo yes; false; echo no )"; then echo "$foo"; fi'
++ set -Eeuo pipefail
++ echo yes
++ false
++ echo no
+ foo='yes
no'
+ echo 'yes
no'
yes
no😢 😭
There was a problem hiding this comment.
oof; here's how I'd probably handle the whitespace in your suggested two-parter:
| if checksums="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums.txt")"; then | |
| buildx="$(jq <<<"$checksums" -csR --arg version "$buildxVersion" ' | |
| rtrimstr("\n") | split("\n") | |
| | map( | |
| split(" [ *]?"; "") | |
| checksums+=$'\n' # add back trailing newline to separate the two checksums files | |
| if checksums+="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums-signed.txt")"; then | |
| if \ | |
| checksums="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums.txt")" \ | |
| && checksums+=$'\n' \ | |
| && checksums+="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums-signed.txt")" \ | |
| ; then |
Changes: - docker-library/docker@bb87f1b: Merge pull request docker-library/docker#578 from infosiftr/windows-fix - docker-library/docker@6e14e9f: Add back windows checksums - docker-library/docker@5145971: Update 29-rc - docker-library/docker@1be6a77: Update 29 to 29.7.0 - docker-library/docker@b0d5cfc: Update 29-rc to buildx 0.36.0 - docker-library/docker@0ddcd31: Update 29 to buildx 0.36.0
Changes: - docker-library/docker@bb87f1b: Merge pull request docker-library/docker#578 from infosiftr/windows-fix - docker-library/docker@6e14e9f: Add back windows checksums - docker-library/docker@5145971: Update 29-rc - docker-library/docker@1be6a77: Update 29 to 29.7.0 - docker-library/docker@b0d5cfc: Update 29-rc to buildx 0.36.0 - docker-library/docker@0ddcd31: Update 29 to buildx 0.36.0 Co-authored-by: Docker Library Bot <doi+docker-library-bot@docker.com>
With the
0.36.0buildx release, the Windows builds moved to a separate checksums file (with darwin). Most of the change toversions.shis whitespace.ref docker/buildx#3978