Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: add ci image #40866

Merged
merged 9 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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