Skip to content

Commit

Permalink
Merge branch 'master' into remove-travis
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max authored Nov 30, 2020
2 parents 0057037 + 1bf8ef9 commit 9ed0d25
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 41 deletions.
63 changes: 46 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,23 @@ jobs:
run: |
./hack/build_ci_first_pass binaries
env:
CACHE_DIR: /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }}
CACHEDIR_FROM: /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }}
CACHEDIR_TO: /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }}-new
-
name: Build ${{ env.CACHEKEY_INTEGRATION_TESTS }}
run: |
./hack/build_ci_first_pass integration-tests
env:
CACHE_DIR: /tmp/.buildkit-cache/${{ env.CACHEKEY_INTEGRATION_TESTS }}
CACHEDIR_FROM: /tmp/.buildkit-cache/${{ env.CACHEKEY_INTEGRATION_TESTS }}
CACHEDIR_TO: /tmp/.buildkit-cache/${{ env.CACHEKEY_INTEGRATION_TESTS }}-new
-
# FIXME: Temp fix for https://github.com/moby/buildkit/issues/1850
name: Move cache
run: |
rm -rf /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }}
mv /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }}-new /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }}
rm -rf /tmp/.buildkit-cache/${{ env.CACHEKEY_INTEGRATION_TESTS }}
mv /tmp/.buildkit-cache/${{ env.CACHEKEY_INTEGRATION_TESTS }}-new /tmp/.buildkit-cache/${{ env.CACHEKEY_INTEGRATION_TESTS }}
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -131,7 +141,7 @@ jobs:
TESTPKGS: ${{ matrix.pkg }}
TESTFLAGS: -v --parallel=6 --timeout=20m
SKIP_INTEGRATION_TESTS: ${{ matrix.skip-integration-tests }}
CACHE_DIR: /tmp/.buildkit-cache/${{ env.CACHEKEY_INTEGRATION_TESTS }} /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }}
CACHEDIR_FROM: /tmp/.buildkit-cache/${{ env.CACHEKEY_INTEGRATION_TESTS }} /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }}
-
name: Upload coverage file
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -244,7 +254,14 @@ jobs:
env:
PLATFORMS: ${{ env.PLATFORMS }},darwin/amd64,windows/amd64
RUNC_PLATFORMS: ${{ env.PLATFORMS }}
CACHE_DIR: /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }}
CACHEDIR_FROM: /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }}
CACHEDIR_TO: /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }}-new
-
# FIXME: Temp fix for https://github.com/moby/buildkit/issues/1850
name: Move cache
run: |
rm -rf /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }}
mv /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }}-new /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }}
release-base:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -276,12 +293,12 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- target-stage: ''
- target-stage: rootless
target-stage:
- ''
- rootless
steps:
-
name: Checkout${{ env.CACHEKEY_BINARIES }}
name: Checkout
uses: actions/checkout@v2
-
name: Cache image${{ matrix.target-stage }}
Expand Down Expand Up @@ -320,7 +337,14 @@ jobs:
./hack/images "${{ needs.release-base.outputs.tag }}" "$REPO_SLUG_TARGET" "${{ needs.release-base.outputs.push }}"
env:
TARGET: ${{ matrix.target-stage }}
CACHE_DIR: /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }} /tmp/.buildkit-cache/image${{ matrix.target-stage }}
CACHEDIR_FROM: /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }} /tmp/.buildkit-cache/image${{ matrix.target-stage }}
CACHEDIR_TO: /tmp/.buildkit-cache/image${{ matrix.target-stage }}-new
-
# FIXME: Temp fix for https://github.com/moby/buildkit/issues/1850
name: Move cache
run: |
rm -rf /tmp/.buildkit-cache/image${{ matrix.target-stage }}
mv /tmp/.buildkit-cache/image${{ matrix.target-stage }}-new /tmp/.buildkit-cache/image${{ matrix.target-stage }}
binaries:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -359,7 +383,7 @@ jobs:
./hack/release-tar "${{ needs.release-base.outputs.tag }}" release-out
env:
PLATFORMS: ${{ env.PLATFORMS }},darwin/amd64,windows/amd64
CACHE_DIR: /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }} /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }}
CACHEDIR_FROM: /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }} /tmp/.buildkit-cache/${{ env.CACHEKEY_CROSS }}
-
name: Move artifacts
run: |
Expand All @@ -384,6 +408,7 @@ jobs:

frontend-base:
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
outputs:
typ: ${{ steps.prep.outputs.typ }}
tag: ${{ steps.prep.outputs.tag }}
Expand All @@ -396,11 +421,7 @@ jobs:
TYP=master
TAG=mainline
PUSH=false
if [ "${{ github.event_name }}" = "schedule" ]; then
TYP=daily
TAG=_
PUSH=push
elif [[ $GITHUB_REF == refs/tags/dockerfile/* ]]; then
if [[ $GITHUB_REF == refs/tags/dockerfile/* ]]; then
TYP=tag
TAG=${GITHUB_REF#refs/tags/}
PUSH=push
Expand All @@ -413,6 +434,7 @@ jobs:
frontend-image:
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
needs: [frontend-base, test]
steps:
-
Expand Down Expand Up @@ -446,11 +468,18 @@ jobs:
run: |
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.frontend-base.outputs.typ }}" "${{ needs.frontend-base.outputs.tag }}" "$DF_REPO_SLUG_TARGET" "${{ needs.frontend-base.outputs.push }}"
env:
CACHE_DIR: /tmp/.buildkit-cache/frontend-${{ needs.frontend-base.outputs.typ }}
CACHEDIR_FROM: /tmp/.buildkit-cache/frontend-${{ needs.frontend-base.outputs.typ }}
CACHEDIR_TO: /tmp/.buildkit-cache/frontend-${{ needs.frontend-base.outputs.typ }}-new
-
name: Build ${{ needs.frontend-base.outputs.typ }}/labs
if: needs.frontend-base.outputs.typ == 'master'
run: |
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.frontend-base.outputs.typ }}" labs "$DF_REPO_SLUG_TARGET" "${{ needs.frontend-base.outputs.push }}"
env:
CACHE_DIR: /tmp/.buildkit-cache/frontend-${{ needs.frontend-base.outputs.typ }}
CACHEDIR_FROM: /tmp/.buildkit-cache/frontend-${{ needs.frontend-base.outputs.typ }}
-
# FIXME: Temp fix for https://github.com/moby/buildkit/issues/1850
name: Move cache
run: |
rm -rf /tmp/.buildkit-cache/frontend-${{ needs.frontend-base.outputs.typ }}
mv /tmp/.buildkit-cache/frontend-${{ needs.frontend-base.outputs.typ }}-new /tmp/.buildkit-cache/frontend-${{ needs.frontend-base.outputs.typ }}
8 changes: 5 additions & 3 deletions frontend/dockerfile/cmd/dockerfile-frontend/hack/release
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ fi
importCacheFlags=""
exportCacheFlags=""
if [ "$GITHUB_ACTIONS" = "true" ]; then
if [ -n "$cacheref" ]; then
importCacheFlags="--cache-from=type=local,src=$cacheref"
exportCacheFlags="--cache-to=type=local,dest=$cacheref"
if [ -n "$cacheRefFrom" ]; then
importCacheFlags="--cache-from=type=local,src=$cacheRefFrom"
fi
if [ -n "$cacheRefTo" ]; then
exportCacheFlags="--cache-to=type=local,dest=$cacheRefTo"
fi
fi

Expand Down
8 changes: 5 additions & 3 deletions hack/build_ci_first_pass
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ fi
importCacheFlags=""
exportCacheFlags=""
if [ "$GITHUB_ACTIONS" = "true" ]; then
if [ -n "$cacheref" ]; then
importCacheFlags="--cache-from=type=local,src=$cacheref"
exportCacheFlags="--cache-to=type=local,dest=$cacheref"
if [ -n "$cacheRefFrom" ]; then
importCacheFlags="--cache-from=type=local,src=$cacheRefFrom"
fi
if [ -n "$cacheRefTo" ]; then
exportCacheFlags="--cache-to=type=local,dest=$cacheRefTo"
fi
fi

Expand Down
8 changes: 5 additions & 3 deletions hack/cross
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ set -e
importCacheFlags=""
exportCacheFlags=""
if [ "$GITHUB_ACTIONS" = "true" ]; then
if [ -n "$cacheref" ]; then
importCacheFlags="--cache-from=type=local,src=$cacheref"
exportCacheFlags="--cache-to=type=local,dest=$cacheref"
if [ -n "$cacheRefFrom" ]; then
importCacheFlags="--cache-from=type=local,src=$cacheRefFrom"
fi
if [ -n "$cacheRefTo" ]; then
exportCacheFlags="--cache-to=type=local,dest=$cacheRefTo"
fi
fi

Expand Down
10 changes: 6 additions & 4 deletions hack/images
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ if [[ "$versionTag" == "$TAG" ]]; then
fi

importCacheFlags="--cache-from=type=registry,ref=$tagMain$tagLatest "
if [[ -n "$cacheref" ]] && [[ "$cachetype" = "local" ]]; then
for ref in $cacheref; do
if [[ -n "$cacheRefFrom" ]] && [[ "$cacheType" = "local" ]]; then
for ref in $cacheRefFrom; do
importCacheFlags="$importCacheFlags--cache-from=type=local,src=$ref "
done
fi
Expand All @@ -77,8 +77,10 @@ if [ -n "$localmode" ]; then
fi

exportCacheFlags=""
if [ "$PUSH" = "push" ]; then
exportCacheFlags="--cache-to=type=inline "
if [[ -n "$cacheRefTo" ]] && [[ "$cacheType" = "local" ]]; then
exportCacheFlags="--cache-to=type=local,dest=$cacheRefTo "
elif [ "$PUSH" = "push" ]; then
exportCacheFlags="$exportCacheFlags--cache-to=type=inline "
fi

buildxCmd build $targetFlag $importCacheFlags $exportCacheFlags $outputFlag \
Expand Down
4 changes: 2 additions & 2 deletions hack/release-tar
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ if [ -z "$TAG" ] || [ -z "$OUT" ]; then
fi

importCacheFlags=""
if [[ -n "$cacheref" ]] && [[ "$cachetype" = "local" ]]; then
for ref in $cacheref; do
if [[ -n "$cacheRefFrom" ]] && [[ "$cacheType" = "local" ]]; then
for ref in $cacheRefFrom; do
importCacheFlags="$importCacheFlags--cache-from=type=local,src=$ref "
done
fi
Expand Down
8 changes: 4 additions & 4 deletions hack/test
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ if [ "$TEST_DOCKERD" == "1" ] && ! file $TEST_DOCKERD_BINARY | grep "statically
fi

importCacheFlags=""
if [ -n "$cacheref" ]; then
if [ "$cachetype" = "local" ]; then
for ref in $cacheref; do
if [ -n "$cacheRefFrom" ]; then
if [ "$cacheType" = "local" ]; then
for ref in $cacheRefFrom; do
importCacheFlags="$importCacheFlags--cache-from=type=local,src=$ref "
done
else
importCacheFlags="--cache-from=type=registry,ref=$cacheref:integration-tests "
importCacheFlags="--cache-from=type=registry,ref=$cacheRefFrom:integration-tests "
fi
fi

Expand Down
13 changes: 8 additions & 5 deletions hack/util
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export BUILDX_NO_DEFAULT_LOAD=true
: ${PREFER_LEGACY=}
: ${CI=}
: ${GITHUB_ACTIONS=}
: ${CACHE_DIR=}
: ${CACHEDIR_FROM=}
: ${CACHEDIR_TO=}

if [ "$PREFER_BUILDCTL" = "1" ]; then
echo >&2 "WARNING: PREFER_BUILDCTL is no longer supported. Ignoring."
Expand Down Expand Up @@ -36,13 +37,15 @@ buildxCmd() {
fi
}

cachetype=""
cacheref=""
cacheType=""
cacheRefFrom=""
cacheRefTo=""
currentref=""
if [ "$GITHUB_ACTIONS" = "true" ]; then
currentref="git://github.com/$GITHUB_REPOSITORY#$GITHUB_REF"
cachetype="local"
cacheref="$CACHE_DIR"
cacheType="local"
cacheRefFrom="$CACHEDIR_FROM"
cacheRefTo="$CACHEDIR_TO"
fi

currentcontext="."
Expand Down

0 comments on commit 9ed0d25

Please sign in to comment.