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

feat: [CI-14706]: add check for bitbucket tag slash #325

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion scm/driver/bitbucket/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,26 @@ func (s *gitService) FindCommit(ctx context.Context, repo, ref string) (*scm.Com
}
var path string
if strings.Contains(ref, "/") {
path = fmt.Sprintf("2.0/repositories/%s/?at=%s", repo, ref)
// path = fmt.Sprintf("2.0/repositories/%s/?at=%s", repo, ref)
path = fmt.Sprintf("2.0/repositories/%s/refs/tags/%s", repo, ref)

} else {
path = fmt.Sprintf("2.0/repositories/%s/commit/%s", repo, ref)
}
out := new(commit)
res, err := s.client.do(ctx, "GET", path, nil, out)
fmt.Println("FindCommit: res====", res)
fmt.Println("FindCommit: convertCommit(out====", convertCommit(out))

return convertCommit(out), res, err
}

func (s *gitService) FindTag(ctx context.Context, repo, name string) (*scm.Reference, *scm.Response, error) {
path := fmt.Sprintf("2.0/repositories/%s/refs/tags/%s", repo, name)
out := new(branch)
res, err := s.client.do(ctx, "GET", path, nil, out)
fmt.Println("FindCommit: res444====", res)

return convertTag(out), res, err
}

Expand Down
4 changes: 4 additions & 0 deletions scm/driver/stash/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func (s *gitService) FindCommit(ctx context.Context, repo, ref string) (*scm.Com
path := fmt.Sprintf("rest/api/1.0/projects/%s/repos/%s/commits/%s", namespace, name, ref)
out := new(commit)
res, err := s.client.do(ctx, "GET", path, nil, out)
fmt.Println("FindCommit: res222====", res)

return convertCommit(out), res, err
}

Expand All @@ -67,6 +69,8 @@ func (s *gitService) FindTag(ctx context.Context, repo, tag string) (*scm.Refere
return convertTag(v), res, err
}
}
fmt.Println("FindCommit: res333====", res)

return nil, res, scm.ErrNotFound
}

Expand Down