This repository was archived by the owner on Aug 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-25
lines changed Expand file tree Collapse file tree 3 files changed +28
-25
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ : " ${BUILDKIT_VERSION=} "
4
+ : " ${CACHE_FROM=} "
5
+ : " ${CACHE_TO=} "
6
+
3
7
dockerCmd () {
4
8
(set -x ; docker " $@ " )
5
9
}
6
10
7
- : ${CACHE_FROM=}
8
- : ${CACHE_TO=}
9
-
10
- buildkitPkg=github.com/moby/buildkit
11
- # FIXME: Doesn't seem to be possible to use a ref from a pseudo-ver in go.mod as build context so we need to use a hardcoded one for now.
12
- buildkitVersion=ffe2301031c8f8bfb8d5fc5034e5e509c5624913
13
- # Returns buildkit ref from go.mod (can be v0.9.3 or ffe2301031c8 for pseudo-ver)
14
- # buildkitVersion=$(go list -mod=readonly -u -m -f '{{.Version}}' $buildkitPkg)
15
- # if [[ "${buildkitVersion}" == *-*-* ]]; then
16
- # # if a pseudo-version, figure out just the SHA
17
- # buildkitVersion=$(echo "${buildkitVersion}" | awk -F"-" '{print $NF}' | awk 'BEGIN{FIELDWIDTHS="7"} {print $1}')
18
- # fi
19
- buildkitRef=" https://${buildkitPkg} .git#${buildkitVersion} "
20
-
21
11
cacheFromFlag=" "
22
12
cacheToFlag=" "
23
13
if [ -n " $CACHE_FROM " ]; then
26
16
if [ -n " $CACHE_TO " ]; then
27
17
cacheToFlag=" --cache-to=$CACHE_TO "
28
18
fi
19
+
20
+ if [ -z " $BUILDKIT_VERSION " ]; then
21
+ # resolve BuildKit version from go.mod if not provided
22
+ BUILDKIT_VERSION=$( go list -mod=readonly -u -m -f ' {{.Version}}' github.com/moby/buildkit)
23
+ if [[ " ${BUILDKIT_VERSION} " == * -* -* ]]; then
24
+ # if pseudo-version, figure out just the uncommon sha (https://github.com/golang/go/issues/34745)
25
+ BUILDKIT_VERSION=$( echo " ${BUILDKIT_VERSION} " | awk -F" -" ' {print $NF}' | awk ' BEGIN{FIELDWIDTHS="7"} {print $1}' )
26
+ # use github api to return full sha to be able to use it as ref for git remote context
27
+ BUILDKIT_VERSION=$( curl -s " https://api.github.com/repos/moby/buildkit/commits/${BUILDKIT_VERSION} " | jq -r .sha)
28
+ fi
29
+ fi
30
+
31
+ buildkitRef=" https://github.com/moby/buildkit.git#${BUILDKIT_VERSION} "
Original file line number Diff line number Diff line change 2
2
3
3
OUTPUT=$1
4
4
5
- . $( dirname $0 ) / _util
5
+ . _util
6
6
set -eu -o pipefail
7
7
8
8
outputFlag=" --output=$OUTPUT "
9
9
if [ -z " $OUTPUT " ]; then
10
10
outputFlag=" --output=type=cacheonly"
11
11
fi
12
12
13
- # build buildkit integration test base from buildkit ref
13
+ # build buildkit " integration tests base" from buildkit ref
14
14
# https://github.com/moby/buildkit/blob/ffe2301031c8f8bfb8d5fc5034e5e509c5624913/Dockerfile#L228
15
15
dockerCmd buildx build $cacheFromFlag $cacheToFlag $outputFlag \
16
16
--target " integration-tests-base" \
17
- $buildkitRef
17
+ " $buildkitRef "
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- . $( dirname $0 ) / _util
3
+ . _util
4
4
set -eu -o pipefail
5
5
6
- : ${CHANNEL=mainline}
6
+ : " ${CHANNEL=mainline} "
7
7
8
- : ${TEST_INTEGRATION=}
9
- : ${TEST_DOCKERFILE=}
10
- : ${TEST_DOCKERD=}
11
- : ${TEST_DOCKERD_BINARY=$(which dockerd)}
12
- : ${TEST_COVERAGE=}
13
- : ${TEST_KEEP_CACHE=}
8
+ : " ${TEST_INTEGRATION=} "
9
+ : " ${TEST_DOCKERFILE=} "
10
+ : " ${TEST_DOCKERD=} "
11
+ : " ${TEST_DOCKERD_BINARY=$(which dockerd)} "
12
+ : " ${TEST_COVERAGE=} "
13
+ : " ${TEST_KEEP_CACHE=} "
14
14
15
15
if [ " $TEST_DOCKERD " == " 1" ] && ! file $TEST_DOCKERD_BINARY | grep " statically linked" > /dev/null; then
16
16
echo " dockerd binary needs to be statically linked"
You can’t perform that action at this time.
0 commit comments