Skip to content

Commit

Permalink
*: add ci image (#40866)
Browse files Browse the repository at this point in the history
close #40867
  • Loading branch information
hawkingrei authored Feb 1, 2023
1 parent 7326e2f commit e4bf00f
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/licenserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ header:
- "tidb-binlog/proto/go-binlog/secondary_binlog.pb.go"
- "**/*.sql"
- ".bazelversion"
- "build/image/.ci_bazel"
comment: on-failure
1 change: 1 addition & 0 deletions build/image/.ci_bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build:ci --remote_cache=http://bazel-cache.pingcap.net:8080/tidb --remote_timeout="15s"
7 changes: 7 additions & 0 deletions build/image/README.md
Original file line number Diff line number Diff line change
@@ -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. it is based on ```base```.
- ```.ci_bazel``` is the global default bazel config. it tell bazel where to get cache.
44 changes: 44 additions & 0 deletions build/image/base
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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.
# 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
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
24 changes: 24 additions & 0 deletions build/image/centos7_jenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.
# 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
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

0 comments on commit e4bf00f

Please sign in to comment.