hack: add tarball release

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-10-10 23:46:34 -07:00
parent 106834d708
commit fb5324c609
5 changed files with 49 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
bin
.tmp
release-out

View File

@ -5,6 +5,7 @@ install:
- docker run --name buildkit --rm -d --privileged -p 1234:1234 tonistiigi/buildkit --addr tcp://0.0.0.0:1234
- sudo docker cp buildkit:/usr/bin/buildctl /usr/bin/
- export BUILDKIT_HOST=tcp://0.0.0.0:1234
- git fetch --tags --unshallow
env:
global:
@ -24,7 +25,17 @@ deploy:
repo: moby/buildkit
branch: master
- provider: script
script: ./hack/release $TRAVIS_TAG tonistiigi/buildkit push
script: ./hack/release $TRAVIS_TAG tonistiigi/buildkit push && PLATFORMS="${PLATFORMS},darwin/amd64,windows/amd64" ./hack/release-tar $TRAVIS_TAG release-out
on:
repo: moby/buildkit
tags: true
condition: $TRAVIS_TAG =~ ^v[0-9]
- provider: releases
api_key:
secure: "hA0L2F6O1MLEJEbUDzxokpO6F6QrAIkltmVG3g0tTAoVj1xtCOXSmH3cAnVbFYyOz9q8pa/85tbpyEEIHVlqvWk2a5/QS16QaBW6XxH+FiZ3oQ44JbtpsjpmBFxdhfeFs8Ca6Nj29AOtDx21HHWsZKlBZFvC4Ubc05AM1rgZpJyZVDvYsjZIunc8/CPCbvAAp6RLnLHxAYXF+TQ7mAZP2SewsW/61nPjPIp2P4d93CduA9kUSxtC/1ewmU2T9Ak2X1Nw2ecPTonGjO51xNa6Ebo1hsbsRt5Krd1IR5rSkgXqLrhQO+19J3sUrQr2p8su6hCTKXR5TQz9L5C9VG8T3yOLbA7/FKBndWgBCm7EB7SezhFkm91e3Phkd/Hi5PF4ZKUSKyOYORHpoeg7ggBXaQF5r0OolqvNjxe7EhE+zlUIqnk5eprVrXT8H1QDF0Jg7pfdqVV9AIZO6i+e+1wOVDaP6K6tiWGdkRFH0wahcucZ/8xVoa8JVNZKke2mMCuLGsNWcN4DeLhkxa6giw3tkqbnY+eTYcW/PyVFMAVsZ8rOjQu4u4mm82FYBI7UywWQJTReD1LO2ibxHk74nwtyauX7KsCPFh2CA27DKlsQ1/xkjaCpE6vduzKzPj2DSHp6tKjxn2edPWRI+/4JxLD6KUFX1f1KqD0pKy/qVsZhEPI="
file: release-out/**/*
skip_cleanup: true
file_glob: true
on:
repo: moby/buildkit
tags: true

View File

@ -71,7 +71,7 @@ WORKDIR /go/src/github.com/moby/buildkit
# scan the version/revision info
FROM buildkit-base AS buildkit-version
RUN --mount=target=. \
PKG=github.com/moby/buildkit VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always) REVISION=$(git rev-parse HEAD)$(if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi); \
PKG=github.com/moby/buildkit VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags) REVISION=$(git rev-parse HEAD)$(if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi); \
echo "-X ${PKG}/version.Version=${VERSION} -X ${PKG}/version.Revision=${REVISION} -X ${PKG}/version.Package=${PKG}" | tee /tmp/.ldflags; \
echo -n "${VERSION}" | tee /tmp/.version;

View File

@ -14,7 +14,7 @@ if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"
usage() {
echo "usage: ./hack/test <tag> <repo> [push]"
echo "usage: ./hack/release <tag> <repo> [push]"
exit 1
}

33
hack/release-tar Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
TAG=$1
OUT=$2
set -eu -o pipefail
: ${PLATFORMS=linux/amd64}
: ${CONTINUOUS_INTEGRATION=}
progressFlag=""
if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"; fi
usage() {
echo "usage: ./hack/release-tar <tag> <out>"
exit 1
}
if [ -z "$TAG" ] || [ -z "$OUT" ]; then
usage
fi
set -x
buildctl build $progressFlag --frontend=dockerfile.v0 \
--local context=. --local dockerfile=. \
--frontend-opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \
--frontend-opt target=release \
--frontend-opt platform=$PLATFORMS \
--exporter local \
--exporter-opt output=$OUT