ci: extract buildkit version correctly with replace-d modules
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit f8c0d92a22
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
f860ed7c77
commit
e995191780
2 changed files with 7 additions and 3 deletions
2
.github/workflows/buildkit.yml
vendored
2
.github/workflows/buildkit.yml
vendored
|
@ -69,7 +69,7 @@ jobs:
|
|||
-
|
||||
name: BuildKit ref
|
||||
run: |
|
||||
echo "BUILDKIT_REF=$(./hack/buildkit-ref)" >> $GITHUB_ENV
|
||||
echo "$(./hack/buildkit-ref)" >> $GITHUB_ENV
|
||||
working-directory: moby
|
||||
-
|
||||
name: Checkout BuildKit ${{ env.BUILDKIT_REF }}
|
||||
|
|
|
@ -10,7 +10,10 @@ if [ -n "$BUILDKIT_REF" ]; then
|
|||
fi
|
||||
|
||||
# get buildkit version from vendor.mod
|
||||
BUILDKIT_REF=$(./hack/with-go-mod.sh go list -mod=mod -modfile=vendor.mod -u -m -f '{{.Version}}' "github.com/${BUILDKIT_REPO}")
|
||||
BUILDKIT_REF=$(./hack/with-go-mod.sh go list -mod=mod -modfile=vendor.mod -u -m -f '{{if .Replace}}{{.Replace.Version}}{{else}}{{.Version}}{{end}}' "github.com/${BUILDKIT_REPO}")
|
||||
BUILDKIT_REPO=$(./hack/with-go-mod.sh go list -mod=mod -modfile=vendor.mod -u -m -f '{{if .Replace}}{{.Replace.Path}}{{else}}{{.Path}}{{end}}' "github.com/${BUILDKIT_REPO}")
|
||||
BUILDKIT_REPO=${BUILDKIT_REPO#github.com/}
|
||||
|
||||
if [[ "${BUILDKIT_REF}" == *-*-* ]]; then
|
||||
# if pseudo-version, figure out just the uncommon sha (https://github.com/golang/go/issues/34745)
|
||||
BUILDKIT_REF=$(echo "${BUILDKIT_REF}" | awk -F"-" '{print $NF}' | awk 'BEGIN{FIELDWIDTHS="7"} {print $1}')
|
||||
|
@ -18,4 +21,5 @@ if [[ "${BUILDKIT_REF}" == *-*-* ]]; then
|
|||
BUILDKIT_REF=$(curl -s "https://api.github.com/repos/${BUILDKIT_REPO}/commits/${BUILDKIT_REF}" | jq -r .sha)
|
||||
fi
|
||||
|
||||
echo "$BUILDKIT_REF"
|
||||
echo "BUILDKIT_REPO=$BUILDKIT_REPO"
|
||||
echo "BUILDKIT_REF=$BUILDKIT_REF"
|
||||
|
|
Loading…
Reference in a new issue