Skip to content

Commit

Permalink
fix(tibuild): fix commit sha support for new CD engine (#220)
Browse files Browse the repository at this point in the history
support both `commit/<sha>` and `<sha>` param style

---------

Co-authored-by: wuhuizuo <[email protected]>
  • Loading branch information
ti-chi-bot and wuhuizuo authored Jan 2, 2025
1 parent 7b83308 commit 69b4764
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
platform: [linux/amd64, linux/arm64]
platform: [linux/amd64]

steps:
- name: Checkout sources
Expand Down Expand Up @@ -69,23 +69,23 @@ jobs:
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.8.0/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
- name: Build image - cloudevents-server
- name: Build image - cloudevents-server
if: steps.changes.outputs.cloudevents-server == 'true'
working-directory: cloudevents-server
run: |
skaffold build \
--push=false \
--platform ${{ matrix.platform }} \
--default-repo ghcr.io/pingcap-qe/ee-apps
- name: Build image - tibuild
- name: Build image - tibuild
if: steps.changes.outputs.tibuild == 'true'
working-directory: tibuild
run: |
skaffold build \
--push=false \
--platform ${{ matrix.platform }} \
--default-repo ghcr.io/pingcap-qe/ee-apps
- name: Build image - dl
- name: Build image - dl
if: steps.changes.outputs.dl == 'true'
working-directory: dl
run: |
Expand Down
4 changes: 2 additions & 2 deletions tibuild/pkg/rest/service/dev_build_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func fillDetailInfoForTekton(ctx context.Context, client GHClient, req *DevBuild
req.Spec.GitHash = commit

return nil
case strings.HasPrefix(req.Spec.GitRef, "commit/"):
case strings.HasPrefix(req.Spec.GitRef, "commit/") || regexp.MustCompile(`^[a-fA-F\d]+$`).MatchString(req.Spec.GitRef):
commit := strings.Replace(req.Spec.GitRef, "commit/", "", 1)
req.Spec.GitHash = commit
branch, err := getBranchForCommit(ctx, client, repo.Owner, repo.Repo, commit)
Expand Down Expand Up @@ -531,5 +531,5 @@ var _ DevBuildService = DevbuildServer{}

var versionValidator *regexp.Regexp = regexp.MustCompile(`^v(\d+\.\d+)(\.\d+).*$`)
var hotfixVersionValidator *regexp.Regexp = regexp.MustCompile(`^v(\d+\.\d+)\.\d+-\d{8,}.*$`)
var gitRefValidator *regexp.Regexp = regexp.MustCompile(`^((v\d.*)|(pull/\d+)|([0-9a-fA-F]{40})|(release-.*)|master|main|(tag/.+)|(branch/.+))$`)
var gitRefValidator *regexp.Regexp = regexp.MustCompile(`^((master|main|release-.*|v\d.*|[0-9a-fA-F]{40})|(tag/.+)|(branch/.+)|(pull/\d+)|(commit/[0-9a-fA-F]{40}))$`)
var githubRepoValidator *regexp.Regexp = regexp.MustCompile(`^([\w_-]+/[\w_-]+)$`)

0 comments on commit 69b4764

Please sign in to comment.