MCPcopy Create free account
hub / github.com/bytebase/bytebase / getVCSSource

Function getVCSSource

action/command/rollout.go:301–326  ·  view source on GitHub ↗
(w *world.World)

Source from the content-addressed store, hash-verified

299}
300
301func getVCSSource(w *world.World) *v1pb.Release_VCSSource {
302 switch w.Platform {
303 case world.GitHub:
304 return &v1pb.Release_VCSSource{
305 VcsType: v1pb.VCSType_GITHUB,
306 Url: os.Getenv("GITHUB_SERVER_URL") + "/" + os.Getenv("GITHUB_REPOSITORY") + "/commit/" + os.Getenv("GITHUB_SHA"),
307 }
308 case world.GitLab:
309 return &v1pb.Release_VCSSource{
310 VcsType: v1pb.VCSType_GITLAB,
311 Url: os.Getenv("CI_PROJECT_URL") + "/-/commit/" + os.Getenv("CI_COMMIT_SHA"),
312 }
313 case world.Bitbucket:
314 return &v1pb.Release_VCSSource{
315 VcsType: v1pb.VCSType_BITBUCKET,
316 Url: os.Getenv("BITBUCKET_GIT_HTTP_ORIGIN") + "/commits/" + os.Getenv("BITBUCKET_COMMIT"),
317 }
318 case world.AzureDevOps:
319 return &v1pb.Release_VCSSource{
320 VcsType: v1pb.VCSType_AZURE_DEVOPS,
321 Url: os.Getenv("SYSTEM_COLLECTIONURI") + os.Getenv("SYSTEM_TEAMPROJECT") + "/_git/" + os.Getenv("BUILD_REPOSITORY_NAME") + "/commit/" + os.Getenv("BUILD_SOURCEVERSION"),
322 }
323 default:
324 return nil
325 }
326}

Callers 1

runRolloutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected