Skip to content
This repository was archived by the owner on Jul 28, 2019. It is now read-only.

Commit 596f7d0

Browse files
authored
Merge pull request #273 from ivan4th/k8s-1.13-and-releases
Add support for k8s 1.13 and introduce releases
2 parents 3cde766 + 9579fca commit 596f7d0

30 files changed

+1183
-13202
lines changed

.circleci/config.yml

Lines changed: 354 additions & 600 deletions
Large diffs are not rendered by default.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ services: docker
33
language: minimal
44

55
env:
6-
- TEST_CASE=1.9
76
- TEST_CASE=1.10
87
- TEST_CASE=1.11
98
- TEST_CASE=1.12
9+
- TEST_CASE=1.13
1010

1111
before_install:
1212
- sudo apt-get -qq update

Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM mirantis/kubeadm-dind-cluster:bare-v4
22

3+
LABEL mirantis.kubeadm_dind_cluster_final=1
4+
35
# the following args should be set for derived images
46

57
#Todo: download prebuilt hyperkube (not kubectl!) & kubeadm into /k8s
@@ -8,6 +10,11 @@ ARG KUBEADM_URL
810
ARG KUBEADM_SHA1
911
ARG HYPERKUBE_URL
1012
ARG HYPERKUBE_SHA1
13+
ARG KUBECTL_VERSION
14+
ARG KUBECTL_LINUX_URL
15+
ARG KUBECTL_LINUX_SHA1
16+
ARG KUBECTL_DARWIN_URL
17+
ARG KUBECTL_DARWIN_SHA1
1118

1219
RUN if [ -n "${KUBEADM_URL}" ]; then \
1320
mkdir -p /k8s && \
@@ -19,7 +26,12 @@ RUN if [ -n "${KUBEADM_URL}" ]; then \
1926
curl -sSL "${HYPERKUBE_URL}" > /k8s/hyperkube && \
2027
if [ -n "${HYPERKUBE_SHA1}" ]; then echo "${HYPERKUBE_SHA1} /k8s/hyperkube" | sha1sum -c; fi && \
2128
chmod +x /k8s/hyperkube; \
22-
fi
29+
fi && \
30+
( echo "export KUBECTL_VERSION=${KUBECTL_VERSION}" && \
31+
echo "export KUBECTL_LINUX_SHA1=${KUBECTL_LINUX_SHA1}" && \
32+
echo "export KUBECTL_LINUX_URL=${KUBECTL_LINUX_URL}" && \
33+
echo "export KUBECTL_DARWIN_SHA1=${KUBECTL_DARWIN_SHA1}" && \
34+
echo "export KUBECTL_DARWIN_URL=${KUBECTL_DARWIN_URL}" ) >/dind-env
2335
COPY save.tar.lz4 /
2436

2537
ENTRYPOINT ["/sbin/dind_init"]

README.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ Docker 1.12+ is recommended. If you're not using one of the
1919
preconfigured scripts (see below) and not building from source, it's
2020
better to have `kubectl` executable in your path matching the
2121
version of k8s binaries you're using (i.e. for example better don't
22-
use `kubectl` 1.10.x with `hyperkube` 1.9.x).
22+
use `kubectl` 1.13.x with `hyperkube` 1.12.x). As an alternative,
23+
you can set `DOWNLOAD_KUBECTL` to a non-empty string in your
24+
config.sh so `kubeadm-dind-cluster` will download it for you.
2325

24-
`kubeadm-dind-cluster` supports k8s versions 1.9.x through 1.12.x.
26+
`kubeadm-dind-cluster` supports k8s versions 1.10.x through 1.13.x.
2527

2628
**As of now, running `kubeadm-dind-cluster` on Docker with `btrfs`
2729
storage driver is not supported.**
@@ -49,39 +51,44 @@ IPv6 and thus clusters cannot be formed using IPv6 addresses.
4951

5052
## Using preconfigured scripts
5153
`kubeadm-dind-cluster` currently provides preconfigured scripts for
52-
Kubernetes versions 1.9 through 1.12. This may be convenient for use with
53-
projects that extend or use Kubernetes. For example, you can start
54-
Kubernetes 1.12 like this:
54+
Kubernetes versions 1.10 through 1.13 published as part of GitHub
55+
releases. Each preconfigured script is pinned to the corresponding
56+
image tag and SHA256 digest, so it will not be broken by changes
57+
in kubeadm-dind-cluster master branch.
58+
59+
The preconfigured scripts are convenient for use with projects that
60+
extend or use Kubernetes. For example, you can start Kubernetes 1.13
61+
like this:
5562

5663
```shell
57-
$ wget https://cdn.rawgit.com/kubernetes-sigs/kubeadm-dind-cluster/master/fixed/dind-cluster-v1.12.sh
58-
$ chmod +x dind-cluster-v1.12.sh
64+
$ wget https://github.com/kubernetes-sigs/kubeadm-dind-cluster/releases/download/v0.1.0/dind-cluster-v1.13.sh
65+
$ chmod +x dind-cluster-v1.13.sh
5966

6067
$ # start the cluster
61-
$ ./dind-cluster-v1.12.sh up
68+
$ ./dind-cluster-v1.13.sh up
6269

6370
$ # add kubectl directory to PATH
6471
$ export PATH="$HOME/.kubeadm-dind-cluster:$PATH"
6572

6673
$ kubectl get nodes
6774
NAME STATUS ROLES AGE VERSION
68-
kube-master Ready master 4m v1.12.1
69-
kube-node-1 Ready <none> 2m v1.12.1
70-
kube-node-2 Ready <none> 2m v1.12.1
75+
kube-master Ready master 4m v1.13.0
76+
kube-node-1 Ready <none> 2m v1.13.0
77+
kube-node-2 Ready <none> 2m v1.13.0
7178

7279
$ # k8s dashboard available at http://localhost:8080/api/v1/namespaces/kube-system/services/kubernetes-dashboard:/proxy
7380

7481
$ # restart the cluster, this should happen much quicker than initial startup
75-
$ ./dind-cluster-v1.12.sh up
82+
$ ./dind-cluster-v1.13.sh up
7683

7784
$ # stop the cluster
78-
$ ./dind-cluster-v1.12.sh down
85+
$ ./dind-cluster-v1.13.sh down
7986

8087
$ # remove DIND containers and volumes
81-
$ ./dind-cluster-v1.12.sh clean
88+
$ ./dind-cluster-v1.13.sh clean
8289
```
8390

84-
Replace 1.12 with 1.9 .. 1.11 to use other Kubernetes versions.
91+
Replace 1.13 with 1.10 .. 1.12 to use other Kubernetes versions.
8592
**Important note:** you need to do `./dind-cluster....sh clean` when
8693
you switch between Kubernetes versions (but no need to do this between
8794
rebuilds if you use `BUILD_HYPERKUBE=y` like described below).
@@ -196,8 +203,8 @@ To use kube-router, set the CNI_PLUGIN environment variable to "kube-router".
196203
NOTE: Currently pinning kube-router to v0.2.0, because of issue seen with
197204
cleanup, when using newer (latest) kube-router.
198205

199-
NOTE: This has only been tested with Kubernetes 1.11, and currently fails,
200-
when using Kuberentes 1.12 (alpha).
206+
NOTE: This has only been tested with Kubernetes 1.11, and currently fails
207+
when using Kuberentes 1.12+
201208

202209
## IPv6 Mode
203210
To run Kubernetes in IPv6 only mode, set the environment variable IP_MODE
@@ -509,6 +516,8 @@ case also locally, by just calling the script:
509516
$ DIND_ALLOW_AAAA_USE='true' TEST_K8S_VER='v1.10' ./test/test-ipv6-only.sh
510517
```
511518

519+
CircleCI config can be re-generated using `build/update-test-matrix.sh`
520+
512521
#### TravisCI, `./test.sh`
513522

514523
There are some tests in `./test.sh`, those will run on TravisCI.
@@ -534,7 +543,7 @@ that we have IPv6 available for the test cases. Note, that while internal IPv6
534543
is configured, external IPv6 is not available.
535544

536545
There are two slightly different kind of tests which run for all version
537-
starting from `v1.9`:
546+
starting from `v1.10`:
538547

539548
#### `TEST_K8S_VER='1.x' ./test/test-ipv6-only.sh`
540549

build/build-all.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
# Copyright 2018 Mirantis
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -o errexit
17+
set -o nounset
18+
set -o pipefail
19+
set -o errtrace
20+
21+
save_to_dir="${1:-}"
22+
23+
DIND_ROOT=$(dirname "${BASH_SOURCE}")/..
24+
source "$DIND_ROOT/build/funcs.sh"
25+
26+
dind::build-base
27+
images_to_save=(${BARE_IMAGE_NAME})
28+
for v in ${K8S_VERSIONS}; do
29+
version="${v//./_}"
30+
eval "HYPERKUBE_URL=\${HYPERKUBE_URL_${version}}"
31+
eval "HYPERKUBE_SHA1=\${HYPERKUBE_SHA1_${version}}"
32+
eval "KUBEADM_URL=\${KUBEADM_URL_${version}}"
33+
eval "KUBEADM_SHA1=\${KUBEADM_SHA1_${version}}"
34+
eval "KUBECTL_LINUX_URL=\${KUBECTL_LINUX_URL_${version}}"
35+
eval "KUBECTL_LINUX_SHA1=\${KUBECTL_LINUX_SHA1_${version}}"
36+
eval "KUBECTL_DARWIN_URL=\${KUBECTL_DARWIN_URL_${version}}"
37+
eval "KUBECTL_DARWIN_SHA1=\${KUBECTL_DARWIN_SHA1_${version}}"
38+
commit="$(git rev-parse HEAD)"
39+
tag="${commit}-v${v}"
40+
cur_image="${IMAGE_NAME}:${tag}"
41+
dind::build-image "${cur_image}"
42+
images_to_save+=("${cur_image}")
43+
done
44+
if [[ ${save_to_dir} ]]; then
45+
mkdir -p _save
46+
docker save "${images_to_save[@]}" >_save/images.tar
47+
else
48+
echo "${images_to_save[*]}"
49+
fi

build/build-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright 2017 Mirantis
2+
# Copyright 2018 Mirantis
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

build/buildconf.sh

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,51 @@
1-
# Version 1.9.11
2-
KUBEADM_URL_1_9='https://storage.googleapis.com/kubernetes-release/release/v1.9.11/bin/linux/amd64/kubeadm'
3-
KUBEADM_SHA1_1_9=152e1dd6261f5e1aeda982fb3a5d17255860a830
4-
HYPERKUBE_URL_1_9='https://storage.googleapis.com/kubernetes-release/release/v1.9.11/bin/linux/amd64/hyperkube'
5-
HYPERKUBE_SHA1_1_9=d23dc80fa2cd5f845912721afffba0e8fd9b1780
6-
KUBECTL_URL_1_9='https://storage.googleapis.com/kubernetes-release/release/v1.9.11/bin/linux/amd64/kubectl'
7-
KUBECTL_SHA1_1_9=3dedd41a077be12668c2ee322958dd3e9e554861
8-
KUBECTL_DARWIN_URL_1_9='https://storage.googleapis.com/kubernetes-release/release/v1.9.11/bin/darwin/amd64/kubectl'
9-
KUBECTL_DARWIN_SHA1_1_9=3b436f60ff0399b3f521d549044513358487ce20
1+
# Version 1.10.11
2+
KUBEADM_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.11/bin/linux/amd64/kubeadm'
3+
KUBEADM_SHA1_1_10=d80c4d591ae61f60fb8c22dca2a9ef7dd6412dd9
4+
HYPERKUBE_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.11/bin/linux/amd64/hyperkube'
5+
HYPERKUBE_SHA1_1_10=13a9ebddd89332d5937cc9215bd1c446d4e663af
6+
KUBECTL_LINUX_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.11/bin/linux/amd64/kubectl'
7+
KUBECTL_LINUX_SHA1_1_10=9ee2f78491cbf8dc76d644c23cfc8c955c34d55d
8+
KUBECTL_DARWIN_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.11/bin/darwin/amd64/kubectl'
9+
KUBECTL_DARWIN_SHA1_1_10=1cfafe21222e7f5f809ba4e3e7a1471421998d37
1010

11-
# Version 1.10.9
12-
KUBEADM_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.9/bin/linux/amd64/kubeadm'
13-
KUBEADM_SHA1_1_10=5d300647b0512cc724248431211df92a4b6f987f
14-
HYPERKUBE_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.9/bin/linux/amd64/hyperkube'
15-
HYPERKUBE_SHA1_1_10=a1899c421d3192f647ee6fa3927207bffdffbb6b
16-
KUBECTL_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.9/bin/linux/amd64/kubectl'
17-
KUBECTL_SHA1_1_10=bf3914630fe45b4f9ec1bc5e56f10fb30047f958
18-
KUBECTL_DARWIN_URL_1_10='https://storage.googleapis.com/kubernetes-release/release/v1.10.9/bin/darwin/amd64/kubectl'
19-
KUBECTL_DARWIN_SHA1_1_10=6833874e0b24fa1857925423e4dc8aeaa322b7b3
11+
# Version 1.11.5
12+
KUBEADM_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.5/bin/linux/amd64/kubeadm'
13+
KUBEADM_SHA1_1_11=daec1f0ddd654ab2b7553312548e545623037366
14+
HYPERKUBE_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.5/bin/linux/amd64/hyperkube'
15+
HYPERKUBE_SHA1_1_11=ddeddb33dfc581bdc3e101d7b17dc1dd2279657f
16+
KUBECTL_LINUX_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.5/bin/linux/amd64/kubectl'
17+
KUBECTL_LINUX_SHA1_1_11=feebec8e5649223e586fc45850d8659274c87797
18+
KUBECTL_DARWIN_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.5/bin/darwin/amd64/kubectl'
19+
KUBECTL_DARWIN_SHA1_1_11=450e6e17fe65e9d24cbbe39702ad7aa9103662d7
2020

21-
# Version 1.11.3
22-
KUBEADM_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/linux/amd64/kubeadm'
23-
KUBEADM_SHA1_1_11=f127dccad906ee914af8b889bb60c07f402ed025
24-
HYPERKUBE_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/linux/amd64/hyperkube'
25-
HYPERKUBE_SHA1_1_11=4510415132722eed1add98c3352d7fa171667739
26-
KUBECTL_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/linux/amd64/kubectl'
27-
KUBECTL_SHA1_1_11=5a336ea470a0053b1893fda89a538b6197566137
28-
KUBECTL_DARWIN_URL_1_11='https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/darwin/amd64/kubectl'
29-
KUBECTL_DARWIN_SHA1_1_11=4f519f6c225f2dd663a26c5c2390849324a577cb
21+
# Version 1.12.3
22+
KUBEADM_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.3/bin/linux/amd64/kubeadm'
23+
KUBEADM_SHA1_1_12=24d78afbd6bb3dc90cd048a1925eccc7cb4b05db
24+
HYPERKUBE_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.3/bin/linux/amd64/hyperkube'
25+
HYPERKUBE_SHA1_1_12=c7ba79dff169b49beff3e8d2943a58adb6bcd7d1
26+
KUBECTL_LINUX_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.3/bin/linux/amd64/kubectl'
27+
KUBECTL_LINUX_SHA1_1_12=4248b9e621af7e902c9d23bf772a2ee8e50146c5
28+
KUBECTL_DARWIN_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.3/bin/darwin/amd64/kubectl'
29+
KUBECTL_DARWIN_SHA1_1_12=c7d4086fbdc58d81419f7643304de0bf356e11df
3030

31-
# Version 1.12.1
32-
KUBEADM_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/linux/amd64/kubeadm'
33-
KUBEADM_SHA1_1_12=8f7de5a0236614bb89217b110368974dc19c78ec
34-
HYPERKUBE_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/linux/amd64/hyperkube'
35-
HYPERKUBE_SHA1_1_12=2212a4ab6091cdd4205c9b716886619d79eb8daf
36-
KUBECTL_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/linux/amd64/kubectl'
37-
KUBECTL_SHA1_1_12=2135356e8e205816829f612062e1b5b4e1c81a17
38-
KUBECTL_DARWIN_URL_1_12='https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/darwin/amd64/kubectl'
39-
KUBECTL_DARWIN_SHA1_1_12=a99adb19c1fa0334ab9be37b3918e5de84436acd
31+
# Version 1.13.0
32+
KUBEADM_URL_1_13='https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubeadm'
33+
KUBEADM_SHA1_1_13=c40dccc3d6fd0b7a903b0663c7ecd84f37105a2f
34+
HYPERKUBE_URL_1_13='https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/hyperkube'
35+
HYPERKUBE_SHA1_1_13=ce1d5c8a0d0f3afa506f624db7337452ac4c562f
36+
KUBECTL_LINUX_URL_1_13='https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl'
37+
KUBECTL_LINUX_SHA1_1_13=5c619006fa45afce6efc51db819aff7d5ba7ef0e
38+
KUBECTL_DARWIN_URL_1_13='https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/darwin/amd64/kubectl'
39+
KUBECTL_DARWIN_SHA1_1_13=264df4722e8f70301dd150d455baeae4a855d2fc
4040

4141
# url and sha1sum of hyperkube binary -- only used for prebuilt hyperkube
42-
KUBEADM_URL=${KUBEADM_URL:-${KUBEADM_URL_1_12}}
43-
KUBEADM_SHA1=${KUBEADM_SHA1:-${KUBEADM_SHA1_1_12}}
44-
HYPERKUBE_URL=${HYPERKUBE_URL:-${HYPERKUBE_URL_1_12}}
45-
HYPERKUBE_SHA1=${HYPERKUBE_SHA1:-${HYPERKUBE_SHA1_1_12}}
42+
KUBEADM_URL=${KUBEADM_URL:-${KUBEADM_URL_1_13}}
43+
KUBEADM_SHA1=${KUBEADM_SHA1:-${KUBEADM_SHA1_1_13}}
44+
HYPERKUBE_URL=${HYPERKUBE_URL:-${HYPERKUBE_URL_1_13}}
45+
HYPERKUBE_SHA1=${HYPERKUBE_SHA1:-${HYPERKUBE_SHA1_1_13}}
46+
KUBECTL_LINUX_URL=${KUBECTL_LINUX_URL:-${KUBECTL_LINUX_URL_1_13}}
47+
KUBECTL_LINUX_SHA1=${KUBECTL_LINUX_SHA1:-${KUBECTL_LINUX_SHA1_1_13}}
48+
KUBECTL_DARWIN_URL=${KUBECTL_DARWIN_URL:-${KUBECTL_DARWIN_URL_1_13}}
49+
KUBECTL_DARWIN_SHA1=${KUBECTL_DARWIN_SHA1:-${KUBECTL_DARWIN_SHA1_1_13}}
50+
51+
K8S_VERSIONS="1.10 1.11 1.12 1.13"

build/funcs.sh

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright 2017 Mirantis
2+
# Copyright 2018 Mirantis
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -16,11 +16,15 @@
1616
source "${DIND_ROOT}/build/buildconf.sh"
1717

1818
IMAGE_CACHE_DIR="${IMAGE_CACHE_DIR:-}"
19+
IMAGE_NAME="${IMAGE_NAME:-mirantis/kubeadm-dind-cluster}"
1920

2021
KUBEADM_URL="${KUBEADM_URL:-}"
2122
HYPERKUBE_URL="${HYPERKUBE_URL:-}"
2223
KUBEADM_SHA1=${KUBEADM_SHA1:-}
2324
HYPERKUBE_SHA1=${HYPERKUBE_SHA1:-}
25+
GH_RELEASE_USER="kubernetes-sigs"
26+
GH_REPO="kubeadm-dind-cluster"
27+
GH_RELEASE_TEST_USER="ivan4th"
2428

2529
# FIXME: use k8s version specific list of images to pre-pull
2630
# prepull_images=(gcr.io/google_containers/etcd-amd64:3.0.17
@@ -109,11 +113,64 @@ function dind::build-image {
109113
dind::build-hypokube
110114
images+=("${hypokube_base_image}")
111115

116+
if [[ ${KUBECTL_LINUX_URL} =~ /(v[0-9.]*)/ ]]; then
117+
kubectl_version="${BASH_REMATCH[1]}"
118+
else
119+
echo >&2 "can't get kubectl version from url: ${KUBECTL_LINUX_URL}"
120+
exit 1
121+
fi
122+
112123
dind::copy-saved-images save.tar.lz4 "${images[@]}"
113124
docker build -t "${name}" \
114125
--build-arg KUBEADM_URL="${KUBEADM_URL}" \
115126
--build-arg KUBEADM_SHA1="${KUBEADM_SHA1}" \
116127
--build-arg HYPERKUBE_URL="${HYPERKUBE_URL}" \
117128
--build-arg HYPERKUBE_SHA1="${HYPERKUBE_SHA1}" \
129+
--build-arg KUBECTL_VERSION=${kubectl_version} \
130+
--build-arg KUBECTL_LINUX_SHA1="${KUBECTL_LINUX_SHA1}" \
131+
--build-arg KUBECTL_LINUX_URL="${KUBECTL_LINUX_URL}" \
132+
--build-arg KUBECTL_DARWIN_SHA1="${KUBECTL_DARWIN_SHA1}" \
133+
--build-arg KUBECTL_DARWIN_URL="${KUBECTL_DARWIN_URL}" \
118134
.
119135
}
136+
137+
function release_description {
138+
local -a tag="${1}"
139+
shift
140+
git tag -l --format='%(contents:body)' "${tag}"
141+
echo
142+
echo "SHA256 sums for the files:"
143+
echo '```'
144+
(cd fixed && sha256sum "$@")
145+
echo '```'
146+
}
147+
148+
function release {
149+
local tag="${1}"
150+
shift
151+
local gh_user="${GH_RELEASE_USER}"
152+
if [[ ${tag} =~ test ]]; then
153+
gh_user="${GH_RELEASE_TEST_USER}"
154+
fi
155+
local -a opts=(--user "${gh_user}" --repo "${GH_REPO}" --tag "${tag}")
156+
local -a files=($(cd fixed && ls dind-cluster-v*.sh))
157+
local description="$(release_description "${tag}" "${files[@]}")"
158+
local pre_release=
159+
if [[ ${tag} =~ -(test|pre).*$ ]]; then
160+
pre_release="--pre-release"
161+
fi
162+
if github-release --quiet delete "${opts[@]}"; then
163+
echo >&2 "Replacing the old release"
164+
fi
165+
github-release release "${opts[@]}" \
166+
--name "$(git tag -l --format='%(contents:subject)' "${tag}")" \
167+
--description "${description}" \
168+
${pre_release}
169+
for filename in "${files[@]}"; do
170+
echo >&2 "Uploading: ${filename}"
171+
github-release upload "${opts[@]}" \
172+
--name "${filename}" \
173+
--replace \
174+
--file "fixed/${filename}"
175+
done
176+
}

0 commit comments

Comments
 (0)