-
Notifications
You must be signed in to change notification settings - Fork 15
/
.travis.yml
109 lines (89 loc) · 3.55 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
sudo: required
dist: focal
language: bash
services:
- docker
branches:
only:
- master
before_install:
- set -e
- mkdir -vp ~/.docker/cli-plugins/
- wget https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64 -O ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker buildx version
install:
- KUBE_VERSION=$(cat kube_version.txt)
- tags="$(git ls-remote --tags https://github.com/kubernetes/kubernetes.git | grep 'v[1-9]\.[0-9]*\.[0-9]*$' | awk -F'tags/' '{print $2}' | sort -t. -k1,1n -k2,2n -k3,3n)"
- new_tags="$(printf "%s" "$tags"| sed -n '{/\.0$/{g;p}};h' | tail -5) $(printf "%s" "$tags" | tail -1) v1.21.10 v1.22.7 v1.23.4"
- echo -e "[Tags] $new_tags"
- mkdir -p $GOPATH/src/k8s.io && cd $GOPATH/src/k8s.io
script:
- |
for t in $new_tags; do
echo "[check] $t"
b=$(echo "${KUBE_VERSION}" | grep -w ${t} | wc -l)
if [[ $b == 0 ]]; then
echo "[Build] $t"
git clone -q --depth=1 --branch $t --progress https://github.com/kubernetes/kubernetes.git
cd kubernetes
git checkout -b $t $t
git branch
sed -i 's#time.Hour \* 24 \* 365#time.Hour * 24 * 365 * 10#g' cmd/kubeadm/app/constants/constants.go
grep -n -R CertificateValidity ./*
grep -n -R duration365d ./*
build_version=$(cat build/build-image/cross/VERSION)
docker pull registry.k8s.io/build-image/kube-cross:${build_version}
./build/run.sh make kubeadm KUBE_BUILD_PLATFORMS=linux/amd64 >/dev/null
ls -l _output/dockerized/bin/linux/amd64/
./build/run.sh make kubeadm KUBE_BUILD_PLATFORMS=linux/386 >/dev/null
ls -l _output/dockerized/bin/linux/amd64/
cp _output/dockerized/bin/linux/386/kubeadm _output/kubeadm-linux-386 || return 1
cp _output/dockerized/bin/linux/amd64/kubeadm _output/kubeadm-linux-amd64 || return 1
ls -al _output/kubeadm-*
_output/kubeadm-linux-386 version
_output/kubeadm-linux-amd64 version
echo "[certs] test"
sudo _output/kubeadm-linux-amd64 init phase certs all
sudo _output/kubeadm-linux-amd64 init phase kubeconfig all
sudo _output/kubeadm-linux-amd64 certs check-expiration || sudo _output/kubeadm-linux-amd64 alpha certs check-expiration
kube_tag=$t
echo "[kube_tag] ${kube_tag}"
[[ "x${kube_tag:-}" == "x" ]] && return 1 || echo ok
cd ${TRAVIS_BUILD_DIR}/
git checkout master
git pull
git status
echo "[Push file]"
echo "${kube_tag}" >> kube_version.txt
git config --global user.email "[email protected]"
git config --global user.name "lework"
git remote rm origin
git remote add origin https://${GITHUB_TOKEN}@github.com/lework/kubeadm-certs.git > /dev/null 2>&1
git add -A
git commit -m "add kubeadm $kube_tag"
git push origin master
break
else
echo "[skip] $t"
fi
done
#cache:
# directories:
# - $HOME/.cache/go-build
# - $HOME/gopath/pkg/mod
deploy:
provider: releases
api_key: "${GITHUB_TOKEN}"
tag_name: "${kube_tag}"
file: "$GOPATH/src/k8s.io/kubernetes/_output/kubeadm-*"
file_glob: "true"
release_notes: "Set the validity period of the kubeadm certificate to 10 years. \n source: https://github.com/kubernetes/kubernetes/releases/tag/${kube_tag}"
skip_cleanup: true
overwrite: true
edge: true # opt in to dpl v2
on:
branch: master
condition: $kube_tag != ""
notifications:
email: false