-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
215 lines (210 loc) · 11.2 KB
/
.gitlab-ci.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
stages:
- Build
- Package
- Update-Dashboard
before_script:
- export BASE_URL=${BASE_URL:-$(echo $CI_PROJECT_URL | cut -d'/' -f1-3)}
- export CI_COMMIT_SHA_SHORT=$(echo ${CI_COMMIT_SHA} | cut -c -8)
- >
if [ -z "$CROSS_CLOUD_YML" ]; then
if [ "$BASE_URL" == "https://gitlab.cncf.ci" ]; then
export CROSS_CLOUD_YML="https://raw.githubusercontent.com/CrossCloudCI/cncf-configuration/production/cross-cloud.yml"
elif [ "$BASE_URL" == "https://gitlab.staging.cncf.ci" ]; then
export CROSS_CLOUD_YML="https://raw.githubusercontent.com/CrossCloudCI/cncf-configuration/staging/cross-cloud.yml"
elif [ "$BASE_URL" == "https://gitlab.cidev.cncf.ci" ]; then
export CROSS_CLOUD_YML="https://raw.githubusercontent.com/CrossCloudCI/cncf-configuration/integration/cross-cloud.yml"
else
export CROSS_CLOUD_YML="https://raw.githubusercontent.com/CrossCloudCI/cncf-configuration/master/cross-cloud.yml"
fi
else
export CROSS_CLOUD_YML="$CROSS_CLOUD_YML"
fi
- source /opt/local/etc/rvmrc ; source /opt/local/etc/profile.d/rvm.sh ; rvm use ruby-2.3.0 ; cp -a /opt/local/dashboard /dashboard ; pushd /dashboard
- >
if [ -z "$PIPELINE_RELEASE_TYPE" ]; then
echo "Kubernetes pipeline must be created by the trigger client, exiting."
exit 1
else
source /opt/local/.env
fi
- ./bin/update_dashboard ; popd
compile:
image: crosscloudci/debian-docker
stage: Build
script:
- echo ' Dummy job for K8s compile'
# - apt update
# - apt install -y tar rsync git curl make file net-tools
# # Write build script
# - echo '#!/bin/bash' > kubernetes.sh
# - echo 'set -o errexit' >> kubernetes.sh
# - echo 'set -o nounset' >> kubernetes.sh
# - echo 'set -o pipefail' >> kubernetes.sh
# - echo 'source build/common.sh' >> kubernetes.sh
# - echo 'source build/lib/release.sh' >> kubernetes.sh
# - echo 'kube::build::verify_prereqs' >> kubernetes.sh
# - echo 'kube::build::build_image' >> kubernetes.sh
# - >
# if [ "$ARCH" == "arm64" ]; then
# echo 'ARCH set to arm64'
# echo 'kube::build::run_build_command make all KUBE_BUILD_PLATFORMS=linux/arm64' >> kubernetes.sh
# echo 'kube::build::copy_output' >> kubernetes.sh
# else
# echo 'Default to amd64 (Intel)'
# echo 'kube::build::run_build_command make all KUBE_BUILD_PLATFORMS=linux/amd64' >> kubernetes.sh
# echo 'kube::build::copy_output' >> kubernetes.sh
# fi
# #Run Build
# - chmod +x ./kubernetes.sh
# - ./kubernetes.sh
# - >
# if [ "$ARCH" == "arm64" ]; then
# echo 'ARCH set to arm64'
# echo export KUBELET_ARTIFACT="$BASE_URL"/kubernetes/kubernetes/-/jobs/${CI_JOB_ID}/artifacts/raw/_output/dockerized/bin/linux/arm64/kubelet >> release.env
# echo export KUBE_APISERVER_ARTIFACT="$BASE_URL"/kubernetes/kubernetes/-/jobs/${CI_JOB_ID}/artifacts/raw/_output/dockerized/bin/linux/arm64/kube-apiserver >> release.env
# echo export KUBE_CONTROLLER_MANAGER_ARTIFACT="$BASE_URL"/kubernetes/kubernetes/-/jobs/${CI_JOB_ID}/artifacts/raw/_output/dockerized/bin/linux/arm64/kube-controller-manager >> release.env
# echo export KUBE_SCHEDULER_ARTIFACT="$BASE_URL"/kubernetes/kubernetes/-/jobs/${CI_JOB_ID}/artifacts/raw/_output/dockerized/bin/linux/arm64/kube-scheduler >> release.env
# else
# echo 'Default to amd64 (Intel)'
# echo export KUBELET_ARTIFACT="$BASE_URL"/kubernetes/kubernetes/-/jobs/${CI_JOB_ID}/artifacts/raw/_output/dockerized/bin/linux/amd64/kubelet >> release.env
# echo export KUBE_APISERVER_ARTIFACT="$BASE_URL"/kubernetes/kubernetes/-/jobs/${CI_JOB_ID}/artifacts/raw/_output/dockerized/bin/linux/amd64/kube-apiserver >> release.env
# echo export KUBE_CONTROLLER_MANAGER_ARTIFACT="$BASE_URL"/kubernetes/kubernetes/-/jobs/${CI_JOB_ID}/artifacts/raw/_output/dockerized/bin/linux/amd64/kube-controller-manager >> release.env
# echo export KUBE_SCHEDULER_ARTIFACT="$BASE_URL"/kubernetes/kubernetes/-/jobs/${CI_JOB_ID}/artifacts/raw/_output/dockerized/bin/linux/amd64/kube-scheduler >> release.env
# fi
# - >
# echo "hyperkube_download_url: $BASE_URL/kubernetes/kubernetes/-/jobs/$CI_JOB_ID/artifacts/raw/_output/dockerized/bin/linux/$ARCH/hyperkube" >> kubespray.env
# artifacts:
# name: "${CI_JOB_NAME}.${CI_PIPELINE_ID}.${CI_JOB_ID}"
# when: always
# expire_in: 1 weeks
# paths:
# - release.env
# - kubespray.env
# - _output/dockerized/bin/linux/
container:
image: crosscloudci/debian-docker
stage: Package
dependencies:
- compile
script:
- echo ' Dummy job for K8s container'
# - apt update
# - apt install -y tar rsync git curl make file net-tools xz-utils
# # Set Kubespray Release
# - RELEASE_STABLE="v1.15.0"
# # Determine actual release
# - RELEASE="$(git describe --tags --always --dirty | cut -f1 -d"-")"
# - export KUBE_DOCKER_REGISTRY="$DOCKER_REGISTRY"
# - export KUBE_DOCKER_IMAGE_TAG="${RELEASE}-${CI_COMMIT_REF_NAME}.${CI_COMMIT_SHA_SHORT}.${ARCH}"
# - echo "${KUBE_DOCKER_IMAGE_TAG}"
# - mkdir ~/.docker && echo "$DOCKER_AUTH" > ~/.docker/config.json
# # Write package script
# - echo '#!/bin/bash' > kubernetes.sh
# - echo 'set -o errexit' >> kubernetes.sh
# - echo 'set -o nounset' >> kubernetes.sh
# - echo 'set -o pipefail' >> kubernetes.sh
# - >
# if [ "$ARCH" == "arm64" ]; then
# echo 'ARCH set to arm64'
# echo "sed -i -e '/ linux\/arm$/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# echo "sed -i -e '/ linux\/amd64/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# echo "sed -i -e '/ linux\/s390/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# echo "sed -i -e '/ linux\/386/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# echo "sed -i -e '/ linux\/ppc64le/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# echo "sed -i -e '/ darwin\/amd64/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# echo "sed -i -e '/ darwin\/386/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# echo "sed -i -e '/ windows\/386/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# echo "sed -i -e '/ windows\/amd64/ s/^/#/' hack/lib/golang.sh" >> kubernetes.sh
# else
# echo 'Default to amd64 (Intel)'
# sed -i -e '/ linux\/arm/ s/^/#/' hack/lib/golang.sh
# sed -i -e '/ linux\/s390/ s/^/#/' hack/lib/golang.sh
# sed -i -e '/ linux\/386/ s/^/#/' hack/lib/golang.sh
# sed -i -e '/ linux\/ppc64le/ s/^/#/' hack/lib/golang.sh
# sed -i -e '/ darwin\/amd64/ s/^/#/' hack/lib/golang.sh
# sed -i -e '/ darwin\/386/ s/^/#/' hack/lib/golang.sh
# sed -i -e '/ windows\/386/ s/^/#/' hack/lib/golang.sh
# sed -i -e '/ windows\/amd64/ s/^/#/' hack/lib/golang.sh
# fi
# - echo 'source build/common.sh' >> kubernetes.sh
# - echo 'source build/lib/release.sh' >> kubernetes.sh
# - echo 'kube::build::verify_prereqs' >> kubernetes.sh
# - echo 'kube::release::build_server_images' >> kubernetes.sh
# # Run Package
# - chmod +x ./kubernetes.sh
# - ./kubernetes.sh
# - docker tag "$KUBE_DOCKER_REGISTRY/kube-apiserver-$ARCH:$KUBE_DOCKER_IMAGE_TAG" "$KUBE_DOCKER_REGISTRY/kube-apiserver:$KUBE_DOCKER_IMAGE_TAG"
# - docker tag "$KUBE_DOCKER_REGISTRY/kube-controller-manager-$ARCH:$KUBE_DOCKER_IMAGE_TAG" "$KUBE_DOCKER_REGISTRY/kube-controller-manager:$KUBE_DOCKER_IMAGE_TAG"
# - docker tag "$KUBE_DOCKER_REGISTRY/kube-scheduler-$ARCH:$KUBE_DOCKER_IMAGE_TAG" "$KUBE_DOCKER_REGISTRY/kube-scheduler:$KUBE_DOCKER_IMAGE_TAG"
# - docker tag "$KUBE_DOCKER_REGISTRY/kube-proxy-$ARCH:$KUBE_DOCKER_IMAGE_TAG" "$KUBE_DOCKER_REGISTRY/kube-proxy:$KUBE_DOCKER_IMAGE_TAG"
# - docker push "$KUBE_DOCKER_REGISTRY/kube-apiserver:$KUBE_DOCKER_IMAGE_TAG"
# - docker push "$KUBE_DOCKER_REGISTRY/kube-controller-manager:$KUBE_DOCKER_IMAGE_TAG"
# - docker push "$KUBE_DOCKER_REGISTRY/kube-scheduler:$KUBE_DOCKER_IMAGE_TAG"
# - docker push "$KUBE_DOCKER_REGISTRY/kube-proxy:$KUBE_DOCKER_IMAGE_TAG"
# #Publish pause image
# - make -C ./build/pause/ all-push REGISTRY="${KUBE_DOCKER_REGISTRY}"
# #Push dummy coredns image
# - docker pull coredns/coredns:1.2.6
# - docker tag coredns/coredns:1.2.6 crosscloudci/coredns:1.2.6
# - docker push crosscloudci/coredns:1.2.6
# - docker pull coredns/coredns:1.3.1
# - docker tag coredns/coredns:1.3.1 crosscloudci/coredns:1.3.1
# - docker push crosscloudci/coredns:1.3.1
# #Enable binfmt_misc
# - >
# if [ "$ARCH" == "arm64" ]; then
# echo 'ARCH set to arm64'
# docker run --privileged linuxkit/binfmt:v0.6
# fi
# #Publish k8s-dns-node-cache/arm64 image
# - git clone https://github.com/kubernetes/dns.git
# - cd dns
# - sed -i "15s|.*|FROM ARG_FROM|" ./Dockerfile.node-cache
# - make containers CONTAINER_BINARIES=node-cache REGISTRY="$KUBE_DOCKER_REGISTRY" ARCH="$ARCH"
# - docker push crosscloudci/k8s-dns-node-cache-"$ARCH:$(git describe --tags --always --dirty)"
# - DNS_GIT_VERSION="$(git describe --tags --always --dirty)"
# - cd -
# - echo export DNS_NODE_CACHE_IMAGE="$KUBE_DOCKER_REGISTRY/k8s-dns-node-cache-$ARCH" >> release.env
# - echo export DNS_NODE_CACHE_TAG="$DNS_GIT_VERSION" >> release.env
# - >
# echo "nodelocaldns_image_repo: $KUBE_DOCKER_REGISTRY/k8s-dns-node-cache-$ARCH" >> kubespray.env
# - >
# echo "nodelocaldns_image_tag: $DNS_GIT_VERSION" >> kubespray.env
# - echo export KUBERNETES_VERSION="$KUBE_DOCKER_IMAGE_TAG" >> release.env
# - echo export KUBE_APISERVER_IMAGE="$KUBE_DOCKER_REGISTRY/kube-apiserver" >> release.env
# - echo export KUBE_APISERVER_TAG="$KUBE_DOCKER_IMAGE_TAG" >> release.env
# - echo export KUBE_CONTROLLER_MANAGER_IMAGE="$KUBE_DOCKER_REGISTRY/kube-controller-manager" >> release.env
# - echo export KUBE_CONTROLLER_MANAGER_TAG="$KUBE_DOCKER_IMAGE_TAG" >> release.env
# - echo export KUBE_SCHEDULER_IMAGE="$KUBE_DOCKER_REGISTRY/kube-scheduler" >> release.env
# - echo export KUBE_SCHEDULER_TAG="$KUBE_DOCKER_IMAGE_TAG" >> release.env
# - echo export KUBE_PROXY_IMAGE="$KUBE_DOCKER_REGISTRY/kube-proxy" >> release.env
# - echo export KUBE_PROXY_TAG="$KUBE_DOCKER_IMAGE_TAG" >> release.env
# - echo export DEPLOYMENT_SHA="${CI_PIPELINE_ID}" >> release.env
# - echo export KUBERNETES_SHA="${CI_COMMIT_SHA}" >> release.env
# - >
# echo "hyperkube_checksums:" >> kubespray.env
# - >
# echo " $ARCH:" >> kubespray.env
# - >
# echo " $RELEASE_STABLE: $(sha256sum _output/dockerized/bin/linux/$ARCH/hyperkube | awk '{ print $1 }')" >> kubespray.env
# - >
# echo "kube_version: $RELEASE_STABLE" >> kubespray.env
# - >
# echo "kube_image_repo: $KUBE_DOCKER_REGISTRY" >> kubespray.env
# - >
# echo "kube_image_version: $KUBE_DOCKER_IMAGE_TAG" >> kubespray.env
# - cat release.env
# - cat kubespray.env
# artifacts:
# name: "${CI_JOB_NAME}.${CI_PIPELINE_ID}.${CI_JOB_ID}"
# when: always
# expire_in: 1 weeks
# paths:
# - release.env
# - kubespray.env
Dashboard:
image: crosscloudci/debian-go
stage: Update-Dashboard
dependencies: []
script:
- echo 'test'