Skip to content

Commit

Permalink
fix(tibuild): fix src image checking regexp (#233)
Browse files Browse the repository at this point in the history
This pull request includes a modification to the regular expression used
to match source image URLs in the `artifact_helper.go` file. The change
expands the scope of acceptable URLs to include additional domains.

Changes to regular expression:

*
[`tibuild/pkg/rest/service/artifact_helper.go`](diffhunk://#diff-8952fb6234b7e7797b74c5ddf576757ece54b503266c7c71a80fb4b726431b24L48-R48):
Updated the `source_image_reg` regular expression to match URLs from
`qa`, `pingcap`, and `tikv` domains.

---------

Signed-off-by: wuhuizuo <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
wuhuizuo and github-advanced-security[bot] authored Feb 24, 2025
1 parent 2c737b7 commit ffafe99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions tibuild/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Copy 'website/' contents(not entire folder) into .(/webapp/) and build React
# Copy 'website/' contents(not entire folder) into .(/webapp/) and build React
FROM node:20.18.0 as webbuilder
WORKDIR /webapp
COPY website/ .
RUN --mount=type=cache,target=/webapp/node_modules npm install && yarn build

# Copy whole project's contents(not entire folder) into .(/goapp/) and build Golang
FROM golang:1.23.4 as serverbuilder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0
WORKDIR /goapp
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod go build -o ./bin/tibuild ./cmd/tibuild
Expand All @@ -23,4 +21,3 @@ COPY --from=webbuilder /webapp/build/ ./website/build/
COPY --from=serverbuilder /goapp/bin/tibuild ./bin/tibuild

CMD ["/app/bin/tibuild"]

4 changes: 2 additions & 2 deletions tibuild/pkg/rest/service/artifact_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ var source_image_reg *regexp.Regexp
var target_image_reg *regexp.Regexp

func init() {
source_image_reg = regexp.MustCompile(`^hub.pingcap.net/qa/[\w-]+:v\d+\.\d+\.\d+-\d{8,}.*$`)
target_image_reg = regexp.MustCompile(`^(docker.io/)?pingcap/[\w-]+:v\d+\.\d+\.\d+-\d{8,}.*$`)
source_image_reg = regexp.MustCompile(`^hub\.pingcap\.net/(qa|pingcap|tikv)/[\w-/]+:v\d+\.\d+\.\d+-\d{8,}.*$`)
target_image_reg = regexp.MustCompile(`^(docker\.io/)?pingcap/[\w-]+:v\d+\.\d+\.\d+-\d{8,}.*$`)
}

func NewArtifactHelper(jenkins Jenkins) *ArtifactHelper {
Expand Down

0 comments on commit ffafe99

Please sign in to comment.