From c2a390bac21d82a1be06931615a2f8986828ca94 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 30 Jan 2023 17:37:08 +0800 Subject: [PATCH 1/6] *: add ci image Signed-off-by: Weizhen Wang --- build/image/.ci_bazel | 1 + build/image/README | 7 +++++++ build/image/base | 30 ++++++++++++++++++++++++++++++ build/image/centos7_jenkins | 10 ++++++++++ 4 files changed, 48 insertions(+) create mode 100644 build/image/.ci_bazel create mode 100644 build/image/README create mode 100644 build/image/base create mode 100644 build/image/centos7_jenkins diff --git a/build/image/.ci_bazel b/build/image/.ci_bazel new file mode 100644 index 0000000000000..6114f8bf17db9 --- /dev/null +++ b/build/image/.ci_bazel @@ -0,0 +1 @@ +build:ci --remote_cache=http://bazel-cache.pingcap.net:8080/tidb --remote_timeout="15s" diff --git a/build/image/README b/build/image/README new file mode 100644 index 0000000000000..d5a5e7913fb81 --- /dev/null +++ b/build/image/README @@ -0,0 +1,7 @@ +## CI Image + +Here is the Dockerfile for the CI image. + +- ```base``` is the base image with golang, development tools and so on. +- ```centos7_jenkins``` is the production image with CI environment tool in tidb repo. +- ```.ci_bazel``` is the global default bazel config. it tell bazel where to get cache. diff --git a/build/image/base b/build/image/base new file mode 100644 index 0000000000000..f9dffb4569101 --- /dev/null +++ b/build/image/base @@ -0,0 +1,30 @@ +FROM hub.pingcap.net/jenkins/centos7_jenkins + +USER root +WORKDIR /root + +ENV GOLANG_VERSION 1.19.5 +ENV GOLANG_DOWNLOAD_URL https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz +ENV GOLANG_DOWNLOAD_SHA256 36519702ae2fd573c9869461990ae550c8c0d955cd28d2827a6b159fda81ff95 +ENV GOPATH /go +ENV GOROOT /usr/local/go +ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH +ADD https://github.com/bazelbuild/bazel/releases/download/5.3.2/bazel-5.3.2-linux-x86_64 /usr/bin/bazel +ADD https://uploader.codecov.io/latest/linux/codecov /usr/bin/codecov +RUN curl https://setup.ius.io | sh || true && \ + chmod u+x /usr/bin/bazel && yum update -y && \ + yum install -y supervisor tree libcurl-devel gettext autoconf python-pip python3-pip patch git wget gcc python autoconf make curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-CPAN perl-devel && \ + git clone --depth=1 --branch=v2.37.2 https://github.com/git/git && cd git && yum remove -y git && make configure && ./configure --prefix=/usr/local && make -j16 install && cd .. && rm -rf git && \ + pip3 install s3cmd requests && pip3 install requests && \ + curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \ + && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \ + && tar -C /usr/local -xzf golang.tar.gz \ + && rm golang.tar.gz && \ + mkdir /go && chown jenkins:jenkins /go && \ + curl -fsSL "http://pingcap-dev.hk.ufileos.com/jenkins/jenkins-slave-docker-sqllogictest.tar.gz" | tar xz -C "/git" \ + && chown -R jenkins:jenkins /git && \ + chown jenkins:jenkins /usr/bin/bazel && \ + chown jenkins:jenkins /usr/bin/codecov && \ + chmod +x /usr/bin/codecov +USER jenkins +WORKDIR /home/jenkins diff --git a/build/image/centos7_jenkins b/build/image/centos7_jenkins new file mode 100644 index 0000000000000..bfb40c152d9d4 --- /dev/null +++ b/build/image/centos7_jenkins @@ -0,0 +1,10 @@ +FROM hub.pingcap.net/wangweizhen/base_image:go11920230111 +USER root +WORKDIR /root +COPY .ci_bazel /data/bazel +RUN mkdir -p /data/tikv1 /data/tikv2 /data/tikv3 /data/pd && \ + chown -R jenkins:jenkins /data +USER jenkins +WORKDIR /home/jenkins +RUN go install github.com/hawkingrei/bazel_collect@latest && \ + go install github.com/bazelbuild/bazel-gazelle/cmd/gazelle@latest From 6c8c38fe01410aceb10125c3c082a408b68a50f3 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 30 Jan 2023 17:37:37 +0800 Subject: [PATCH 2/6] *: add ci image Signed-off-by: Weizhen Wang --- build/image/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/image/README b/build/image/README index d5a5e7913fb81..b109968354940 100644 --- a/build/image/README +++ b/build/image/README @@ -3,5 +3,5 @@ Here is the Dockerfile for the CI image. - ```base``` is the base image with golang, development tools and so on. -- ```centos7_jenkins``` is the production image with CI environment tool in tidb repo. +- ```centos7_jenkins``` is the production image with CI environment tool in tidb repo. it is based on ```base```. - ```.ci_bazel``` is the global default bazel config. it tell bazel where to get cache. From 759c39f744cd9f11fd223de53303be83ebb11f94 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 30 Jan 2023 17:41:02 +0800 Subject: [PATCH 3/6] *: add ci image Signed-off-by: Weizhen Wang --- build/image/{README => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build/image/{README => README.md} (100%) diff --git a/build/image/README b/build/image/README.md similarity index 100% rename from build/image/README rename to build/image/README.md From 0f3a367dc49ae0b0d186417a848cc29bd9c3ce2e Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 30 Jan 2023 17:56:14 +0800 Subject: [PATCH 4/6] *: add ci image Signed-off-by: Weizhen Wang --- .github/licenserc.yml | 1 + build/image/base | 14 ++++++++++++++ build/image/centos7_jenkins | 14 ++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/.github/licenserc.yml b/.github/licenserc.yml index e1add7017983b..aec59e4f66d57 100644 --- a/.github/licenserc.yml +++ b/.github/licenserc.yml @@ -40,4 +40,5 @@ header: - "tidb-binlog/proto/go-binlog/secondary_binlog.pb.go" - "**/*.sql" - ".bazelversion" + - "build/image/.ci_bazel" comment: on-failure diff --git a/build/image/base b/build/image/base index f9dffb4569101..0ec02479436f1 100644 --- a/build/image/base +++ b/build/image/base @@ -1,3 +1,17 @@ +# Copyright 2022 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM hub.pingcap.net/jenkins/centos7_jenkins USER root diff --git a/build/image/centos7_jenkins b/build/image/centos7_jenkins index bfb40c152d9d4..537bc97958985 100644 --- a/build/image/centos7_jenkins +++ b/build/image/centos7_jenkins @@ -1,3 +1,17 @@ +# Copyright 2022 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM hub.pingcap.net/wangweizhen/base_image:go11920230111 USER root WORKDIR /root From 0e15e681dd7a60b6256d8205c9567daa614a9017 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Tue, 31 Jan 2023 13:04:22 +0800 Subject: [PATCH 5/6] Update build/image/base Co-authored-by: Hangjie Mo --- build/image/base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/image/base b/build/image/base index 0ec02479436f1..85c3dbba6816f 100644 --- a/build/image/base +++ b/build/image/base @@ -1,4 +1,4 @@ -# Copyright 2022 PingCAP, Inc. +# Copyright 2023 PingCAP, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 503b054d9b58d0dde41281e2b6422aa35b9e3170 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Tue, 31 Jan 2023 13:04:37 +0800 Subject: [PATCH 6/6] Update build/image/centos7_jenkins Co-authored-by: Hangjie Mo --- build/image/centos7_jenkins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/image/centos7_jenkins b/build/image/centos7_jenkins index 537bc97958985..0f56c705ca114 100644 --- a/build/image/centos7_jenkins +++ b/build/image/centos7_jenkins @@ -1,4 +1,4 @@ -# Copyright 2022 PingCAP, Inc. +# Copyright 2023 PingCAP, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.