mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-05 07:08:41 +00:00
Rename link
to url
(#2812)
As of https://woodpecker-ci.org/docs/next/usage/terminiology#conventions
This commit is contained in:
parent
451b71dcd4
commit
342b25826c
45 changed files with 198 additions and 146 deletions
|
@ -130,7 +130,7 @@ var flags = []cli.Flag{
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
EnvVars: []string{"CI_SYSTEM_URL"},
|
EnvVars: []string{"CI_SYSTEM_URL"},
|
||||||
Name: "system-link",
|
Name: "system-url",
|
||||||
Value: "https://github.com/woodpecker-ci/woodpecker",
|
Value: "https://github.com/woodpecker-ci/woodpecker",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
|
@ -144,7 +144,7 @@ var flags = []cli.Flag{
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
EnvVars: []string{"CI_REPO_URL"},
|
EnvVars: []string{"CI_REPO_URL"},
|
||||||
Name: "repo-link",
|
Name: "repo-url",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
EnvVars: []string{"CI_REPO_CLONE_URL"},
|
EnvVars: []string{"CI_REPO_CLONE_URL"},
|
||||||
|
@ -193,7 +193,7 @@ var flags = []cli.Flag{
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
EnvVars: []string{"CI_PIPELINE_URL"},
|
EnvVars: []string{"CI_PIPELINE_URL"},
|
||||||
Name: "pipeline-link",
|
Name: "pipeline-url",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
EnvVars: []string{"CI_PIPELINE_TARGET"},
|
EnvVars: []string{"CI_PIPELINE_TARGET"},
|
||||||
|
@ -257,7 +257,7 @@ var flags = []cli.Flag{
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
EnvVars: []string{"CI_PREV_PIPELINE_URL"},
|
EnvVars: []string{"CI_PREV_PIPELINE_URL"},
|
||||||
Name: "prev-pipeline-link",
|
Name: "prev-pipeline-url",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
EnvVars: []string{"CI_PREV_COMMIT_SHA"},
|
EnvVars: []string{"CI_PREV_COMMIT_SHA"},
|
||||||
|
|
|
@ -45,7 +45,7 @@ func metadataFromContext(c *cli.Context, axis matrix.Axis) metadata.Metadata {
|
||||||
Name: repoName,
|
Name: repoName,
|
||||||
Owner: repoOwner,
|
Owner: repoOwner,
|
||||||
RemoteID: c.String("repo-remote-id"),
|
RemoteID: c.String("repo-remote-id"),
|
||||||
Link: c.String("repo-link"),
|
ForgeURL: c.String("repo-url"),
|
||||||
CloneURL: c.String("repo-clone-url"),
|
CloneURL: c.String("repo-clone-url"),
|
||||||
CloneSSHURL: c.String("repo-clone-ssh-url"),
|
CloneSSHURL: c.String("repo-clone-ssh-url"),
|
||||||
Private: c.Bool("repo-private"),
|
Private: c.Bool("repo-private"),
|
||||||
|
@ -59,7 +59,7 @@ func metadataFromContext(c *cli.Context, axis matrix.Axis) metadata.Metadata {
|
||||||
Finished: c.Int64("pipeline-finished"),
|
Finished: c.Int64("pipeline-finished"),
|
||||||
Status: c.String("pipeline-status"),
|
Status: c.String("pipeline-status"),
|
||||||
Event: c.String("pipeline-event"),
|
Event: c.String("pipeline-event"),
|
||||||
Link: c.String("pipeline-link"),
|
ForgeURL: c.String("pipeline-url"),
|
||||||
Target: c.String("pipeline-target"),
|
Target: c.String("pipeline-target"),
|
||||||
Commit: metadata.Commit{
|
Commit: metadata.Commit{
|
||||||
Sha: c.String("commit-sha"),
|
Sha: c.String("commit-sha"),
|
||||||
|
@ -81,7 +81,7 @@ func metadataFromContext(c *cli.Context, axis matrix.Axis) metadata.Metadata {
|
||||||
Finished: c.Int64("prev-pipeline-finished"),
|
Finished: c.Int64("prev-pipeline-finished"),
|
||||||
Status: c.String("prev-pipeline-status"),
|
Status: c.String("prev-pipeline-status"),
|
||||||
Event: c.String("prev-pipeline-event"),
|
Event: c.String("prev-pipeline-event"),
|
||||||
Link: c.String("prev-pipeline-link"),
|
ForgeURL: c.String("prev-pipeline-url"),
|
||||||
Commit: metadata.Commit{
|
Commit: metadata.Commit{
|
||||||
Sha: c.String("prev-commit-sha"),
|
Sha: c.String("prev-commit-sha"),
|
||||||
Ref: c.String("prev-commit-ref"),
|
Ref: c.String("prev-commit-ref"),
|
||||||
|
@ -106,7 +106,7 @@ func metadataFromContext(c *cli.Context, axis matrix.Axis) metadata.Metadata {
|
||||||
},
|
},
|
||||||
Sys: metadata.System{
|
Sys: metadata.System{
|
||||||
Name: c.String("system-name"),
|
Name: c.String("system-name"),
|
||||||
Link: c.String("system-link"),
|
URL: c.String("system-url"),
|
||||||
Platform: platform,
|
Platform: platform,
|
||||||
Version: version.Version,
|
Version: version.Version,
|
||||||
},
|
},
|
||||||
|
|
|
@ -60,7 +60,7 @@ func repoInfo(c *cli.Context) error {
|
||||||
// template for repo information
|
// template for repo information
|
||||||
var tmplRepoInfo = `Owner: {{ .Owner }}
|
var tmplRepoInfo = `Owner: {{ .Owner }}
|
||||||
Repo: {{ .Name }}
|
Repo: {{ .Name }}
|
||||||
Link: {{ .Link }}
|
URL: {{ .ForgeURL }}
|
||||||
Config path: {{ .Config }}
|
Config path: {{ .Config }}
|
||||||
Visibility: {{ .Visibility }}
|
Visibility: {{ .Visibility }}
|
||||||
Private: {{ .IsSCMPrivate }}
|
Private: {{ .IsSCMPrivate }}
|
||||||
|
|
|
@ -3963,12 +3963,12 @@ const docTemplate = `{
|
||||||
"finished_at": {
|
"finished_at": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"forge_url": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"link_url": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"message": {
|
"message": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@ -4111,6 +4111,9 @@ const docTemplate = `{
|
||||||
"description": "ForgeRemoteID is the unique identifier for the repository on the forge.",
|
"description": "ForgeRemoteID is the unique identifier for the repository on the forge.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"forge_url": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"full_name": {
|
"full_name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@ -4120,9 +4123,6 @@ const docTemplate = `{
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"link_url": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,6 +12,7 @@ Some versions need some changes to the server configuration or the pipeline conf
|
||||||
- Removed `ssh` backend. Use an agent directly on the SSH machine using the `local` backend.
|
- Removed `ssh` backend. Use an agent directly on the SSH machine using the `local` backend.
|
||||||
- Removed `/hook` and `/stream` API paths in favor of `/api/(hook|stream)`. You may need to use the "Repair repository" button in the repo settings or "Repair all" in the admin settings to recreate the forge hook.
|
- Removed `/hook` and `/stream` API paths in favor of `/api/(hook|stream)`. You may need to use the "Repair repository" button in the repo settings or "Repair all" in the admin settings to recreate the forge hook.
|
||||||
- Removed `WOODPECKER_DOCS` config variable
|
- Removed `WOODPECKER_DOCS` config variable
|
||||||
|
- Renamed `link` to `url` (including all API fields)
|
||||||
- Deprecated `CI_COMMIT_URL` env var, use `CI_PIPELINE_FORGE_URL`
|
- Deprecated `CI_COMMIT_URL` env var, use `CI_PIPELINE_FORGE_URL`
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
|
@ -37,9 +37,9 @@ func EnvVarSubst(yaml string, environ map[string]string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MetadataFromStruct return the metadata from a pipeline will run with.
|
// MetadataFromStruct return the metadata from a pipeline will run with.
|
||||||
func MetadataFromStruct(forge metadata.ServerForge, repo *model.Repo, pipeline, last *model.Pipeline, workflow *model.Workflow, link string) metadata.Metadata {
|
func MetadataFromStruct(forge metadata.ServerForge, repo *model.Repo, pipeline, last *model.Pipeline, workflow *model.Workflow, sysURL string) metadata.Metadata {
|
||||||
host := link
|
host := sysURL
|
||||||
uri, err := url.Parse(link)
|
uri, err := url.Parse(sysURL)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
host = uri.Host
|
host = uri.Host
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ func MetadataFromStruct(forge metadata.ServerForge, repo *model.Repo, pipeline,
|
||||||
Name: repo.Name,
|
Name: repo.Name,
|
||||||
Owner: repo.Owner,
|
Owner: repo.Owner,
|
||||||
RemoteID: fmt.Sprint(repo.ForgeRemoteID),
|
RemoteID: fmt.Sprint(repo.ForgeRemoteID),
|
||||||
Link: repo.Link,
|
ForgeURL: repo.ForgeURL,
|
||||||
CloneURL: repo.Clone,
|
CloneURL: repo.Clone,
|
||||||
CloneSSHURL: repo.CloneSSH,
|
CloneSSHURL: repo.CloneSSH,
|
||||||
Private: repo.IsSCMPrivate,
|
Private: repo.IsSCMPrivate,
|
||||||
|
@ -94,7 +94,7 @@ func MetadataFromStruct(forge metadata.ServerForge, repo *model.Repo, pipeline,
|
||||||
Step: metadata.Step{},
|
Step: metadata.Step{},
|
||||||
Sys: metadata.System{
|
Sys: metadata.System{
|
||||||
Name: "woodpecker",
|
Name: "woodpecker",
|
||||||
Link: link,
|
URL: sysURL,
|
||||||
Host: host,
|
Host: host,
|
||||||
Platform: "", // will be set by pipeline platform option or by agent
|
Platform: "", // will be set by pipeline platform option or by agent
|
||||||
Version: version.Version,
|
Version: version.Version,
|
||||||
|
@ -126,7 +126,7 @@ func metadataPipelineFromModelPipeline(pipeline *model.Pipeline, includeParent b
|
||||||
Finished: pipeline.Finished,
|
Finished: pipeline.Finished,
|
||||||
Status: string(pipeline.Status),
|
Status: string(pipeline.Status),
|
||||||
Event: string(pipeline.Event),
|
Event: string(pipeline.Event),
|
||||||
Link: pipeline.Link,
|
ForgeURL: pipeline.ForgeURL,
|
||||||
Target: pipeline.Deploy,
|
Target: pipeline.Deploy,
|
||||||
Commit: metadata.Commit{
|
Commit: metadata.Commit{
|
||||||
Sha: pipeline.Commit,
|
Sha: pipeline.Commit,
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (m *Metadata) Environ() map[string]string {
|
||||||
"CI_REPO_OWNER": m.Repo.Owner,
|
"CI_REPO_OWNER": m.Repo.Owner,
|
||||||
"CI_REPO_REMOTE_ID": m.Repo.RemoteID,
|
"CI_REPO_REMOTE_ID": m.Repo.RemoteID,
|
||||||
"CI_REPO_SCM": "git",
|
"CI_REPO_SCM": "git",
|
||||||
"CI_REPO_URL": m.Repo.Link,
|
"CI_REPO_URL": m.Repo.ForgeURL,
|
||||||
"CI_REPO_CLONE_URL": m.Repo.CloneURL,
|
"CI_REPO_CLONE_URL": m.Repo.CloneURL,
|
||||||
"CI_REPO_CLONE_SSH_URL": m.Repo.CloneSSHURL,
|
"CI_REPO_CLONE_SSH_URL": m.Repo.CloneSSHURL,
|
||||||
"CI_REPO_DEFAULT_BRANCH": m.Repo.Branch,
|
"CI_REPO_DEFAULT_BRANCH": m.Repo.Branch,
|
||||||
|
@ -69,7 +69,7 @@ func (m *Metadata) Environ() map[string]string {
|
||||||
"CI_PIPELINE_PARENT": strconv.FormatInt(m.Curr.Parent, 10),
|
"CI_PIPELINE_PARENT": strconv.FormatInt(m.Curr.Parent, 10),
|
||||||
"CI_PIPELINE_EVENT": m.Curr.Event,
|
"CI_PIPELINE_EVENT": m.Curr.Event,
|
||||||
"CI_PIPELINE_URL": m.getPipelineWebURL(m.Curr, 0),
|
"CI_PIPELINE_URL": m.getPipelineWebURL(m.Curr, 0),
|
||||||
"CI_PIPELINE_FORGE_URL": m.Curr.Link,
|
"CI_PIPELINE_FORGE_URL": m.Curr.ForgeURL,
|
||||||
"CI_PIPELINE_DEPLOY_TARGET": m.Curr.Target,
|
"CI_PIPELINE_DEPLOY_TARGET": m.Curr.Target,
|
||||||
"CI_PIPELINE_STATUS": m.Curr.Status,
|
"CI_PIPELINE_STATUS": m.Curr.Status,
|
||||||
"CI_PIPELINE_CREATED": strconv.FormatInt(m.Curr.Created, 10),
|
"CI_PIPELINE_CREATED": strconv.FormatInt(m.Curr.Created, 10),
|
||||||
|
@ -90,7 +90,7 @@ func (m *Metadata) Environ() map[string]string {
|
||||||
"CI_PREV_COMMIT_REF": m.Prev.Commit.Ref,
|
"CI_PREV_COMMIT_REF": m.Prev.Commit.Ref,
|
||||||
"CI_PREV_COMMIT_REFSPEC": m.Prev.Commit.Refspec,
|
"CI_PREV_COMMIT_REFSPEC": m.Prev.Commit.Refspec,
|
||||||
"CI_PREV_COMMIT_BRANCH": m.Prev.Commit.Branch,
|
"CI_PREV_COMMIT_BRANCH": m.Prev.Commit.Branch,
|
||||||
"CI_PREV_COMMIT_URL": m.Prev.Link,
|
"CI_PREV_COMMIT_URL": m.Prev.ForgeURL,
|
||||||
"CI_PREV_COMMIT_MESSAGE": m.Prev.Commit.Message,
|
"CI_PREV_COMMIT_MESSAGE": m.Prev.Commit.Message,
|
||||||
"CI_PREV_COMMIT_AUTHOR": m.Prev.Commit.Author.Name,
|
"CI_PREV_COMMIT_AUTHOR": m.Prev.Commit.Author.Name,
|
||||||
"CI_PREV_COMMIT_AUTHOR_EMAIL": m.Prev.Commit.Author.Email,
|
"CI_PREV_COMMIT_AUTHOR_EMAIL": m.Prev.Commit.Author.Email,
|
||||||
|
@ -100,7 +100,7 @@ func (m *Metadata) Environ() map[string]string {
|
||||||
"CI_PREV_PIPELINE_PARENT": strconv.FormatInt(m.Prev.Parent, 10),
|
"CI_PREV_PIPELINE_PARENT": strconv.FormatInt(m.Prev.Parent, 10),
|
||||||
"CI_PREV_PIPELINE_EVENT": m.Prev.Event,
|
"CI_PREV_PIPELINE_EVENT": m.Prev.Event,
|
||||||
"CI_PREV_PIPELINE_URL": m.getPipelineWebURL(m.Prev, 0),
|
"CI_PREV_PIPELINE_URL": m.getPipelineWebURL(m.Prev, 0),
|
||||||
"CI_PREV_PIPELINE_FORGE_URL": m.Prev.Link,
|
"CI_PREV_PIPELINE_FORGE_URL": m.Prev.ForgeURL,
|
||||||
"CI_PREV_PIPELINE_DEPLOY_TARGET": m.Prev.Target,
|
"CI_PREV_PIPELINE_DEPLOY_TARGET": m.Prev.Target,
|
||||||
"CI_PREV_PIPELINE_STATUS": m.Prev.Status,
|
"CI_PREV_PIPELINE_STATUS": m.Prev.Status,
|
||||||
"CI_PREV_PIPELINE_CREATED": strconv.FormatInt(m.Prev.Created, 10),
|
"CI_PREV_PIPELINE_CREATED": strconv.FormatInt(m.Prev.Created, 10),
|
||||||
|
@ -108,7 +108,7 @@ func (m *Metadata) Environ() map[string]string {
|
||||||
"CI_PREV_PIPELINE_FINISHED": strconv.FormatInt(m.Prev.Finished, 10),
|
"CI_PREV_PIPELINE_FINISHED": strconv.FormatInt(m.Prev.Finished, 10),
|
||||||
|
|
||||||
"CI_SYSTEM_NAME": m.Sys.Name,
|
"CI_SYSTEM_NAME": m.Sys.Name,
|
||||||
"CI_SYSTEM_URL": m.Sys.Link,
|
"CI_SYSTEM_URL": m.Sys.URL,
|
||||||
"CI_SYSTEM_HOST": m.Sys.Host,
|
"CI_SYSTEM_HOST": m.Sys.Host,
|
||||||
"CI_SYSTEM_PLATFORM": m.Sys.Platform, // will be set by pipeline platform option or by agent
|
"CI_SYSTEM_PLATFORM": m.Sys.Platform, // will be set by pipeline platform option or by agent
|
||||||
"CI_SYSTEM_VERSION": m.Sys.Version,
|
"CI_SYSTEM_VERSION": m.Sys.Version,
|
||||||
|
@ -117,7 +117,7 @@ func (m *Metadata) Environ() map[string]string {
|
||||||
"CI_FORGE_URL": m.Forge.URL,
|
"CI_FORGE_URL": m.Forge.URL,
|
||||||
|
|
||||||
// TODO Deprecated, remove in 3.x
|
// TODO Deprecated, remove in 3.x
|
||||||
"CI_COMMIT_URL": m.Curr.Link,
|
"CI_COMMIT_URL": m.Curr.ForgeURL,
|
||||||
}
|
}
|
||||||
if m.Curr.Event == EventTag {
|
if m.Curr.Event == EventTag {
|
||||||
params["CI_COMMIT_TAG"] = strings.TrimPrefix(m.Curr.Commit.Ref, "refs/tags/")
|
params["CI_COMMIT_TAG"] = strings.TrimPrefix(m.Curr.Commit.Ref, "refs/tags/")
|
||||||
|
@ -132,8 +132,8 @@ func (m *Metadata) Environ() map[string]string {
|
||||||
|
|
||||||
func (m *Metadata) getPipelineWebURL(pipeline Pipeline, stepNumber int) string {
|
func (m *Metadata) getPipelineWebURL(pipeline Pipeline, stepNumber int) string {
|
||||||
if stepNumber == 0 {
|
if stepNumber == 0 {
|
||||||
return fmt.Sprintf("%s/repos/%d/pipeline/%d", m.Sys.Link, m.Repo.ID, pipeline.Number)
|
return fmt.Sprintf("%s/repos/%d/pipeline/%d", m.Sys.URL, m.Repo.ID, pipeline.Number)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s/repos/%d/pipeline/%d/%d", m.Sys.Link, m.Repo.ID, pipeline.Number, stepNumber)
|
return fmt.Sprintf("%s/repos/%d/pipeline/%d/%d", m.Sys.URL, m.Repo.ID, pipeline.Number, stepNumber)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ type (
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Owner string `json:"owner,omitempty"`
|
Owner string `json:"owner,omitempty"`
|
||||||
RemoteID string `json:"remote_id,omitempty"`
|
RemoteID string `json:"remote_id,omitempty"`
|
||||||
Link string `json:"link,omitempty"`
|
ForgeURL string `json:"forge_url,omitempty"`
|
||||||
CloneURL string `json:"clone_url,omitempty"`
|
CloneURL string `json:"clone_url,omitempty"`
|
||||||
CloneSSHURL string `json:"clone_url_ssh,omitempty"`
|
CloneSSHURL string `json:"clone_url_ssh,omitempty"`
|
||||||
Private bool `json:"private,omitempty"`
|
Private bool `json:"private,omitempty"`
|
||||||
|
@ -51,7 +51,7 @@ type (
|
||||||
Timeout int64 `json:"timeout,omitempty"`
|
Timeout int64 `json:"timeout,omitempty"`
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
Event string `json:"event,omitempty"`
|
Event string `json:"event,omitempty"`
|
||||||
Link string `json:"link,omitempty"`
|
ForgeURL string `json:"forge_url,omitempty"`
|
||||||
Target string `json:"target,omitempty"`
|
Target string `json:"target,omitempty"`
|
||||||
Trusted bool `json:"trusted,omitempty"`
|
Trusted bool `json:"trusted,omitempty"`
|
||||||
Commit Commit `json:"commit,omitempty"`
|
Commit Commit `json:"commit,omitempty"`
|
||||||
|
@ -103,7 +103,7 @@ type (
|
||||||
System struct {
|
System struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Host string `json:"host,omitempty"`
|
Host string `json:"host,omitempty"`
|
||||||
Link string `json:"link,omitempty"`
|
URL string `json:"url,omitempty"`
|
||||||
Platform string `json:"arch,omitempty"`
|
Platform string `json:"arch,omitempty"`
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ func TestMetadataFromStruct(t *testing.T) {
|
||||||
repo *model.Repo
|
repo *model.Repo
|
||||||
pipeline, last *model.Pipeline
|
pipeline, last *model.Pipeline
|
||||||
workflow *model.Workflow
|
workflow *model.Workflow
|
||||||
link string
|
sysURL string
|
||||||
expectedMetadata metadata.Metadata
|
expectedMetadata metadata.Metadata
|
||||||
expectedEnviron map[string]string
|
expectedEnviron map[string]string
|
||||||
}{
|
}{
|
||||||
|
@ -88,15 +88,15 @@ func TestMetadataFromStruct(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "Test with forge",
|
name: "Test with forge",
|
||||||
forge: forge,
|
forge: forge,
|
||||||
repo: &model.Repo{FullName: "testUser/testRepo", Link: "https://gitea.com/testUser/testRepo", Clone: "https://gitea.com/testUser/testRepo.git", CloneSSH: "git@gitea.com:testUser/testRepo.git", Branch: "main", IsSCMPrivate: true},
|
repo: &model.Repo{FullName: "testUser/testRepo", ForgeURL: "https://gitea.com/testUser/testRepo", Clone: "https://gitea.com/testUser/testRepo.git", CloneSSH: "git@gitea.com:testUser/testRepo.git", Branch: "main", IsSCMPrivate: true},
|
||||||
pipeline: &model.Pipeline{Number: 3},
|
pipeline: &model.Pipeline{Number: 3},
|
||||||
last: &model.Pipeline{Number: 2},
|
last: &model.Pipeline{Number: 2},
|
||||||
workflow: &model.Workflow{Name: "hello"},
|
workflow: &model.Workflow{Name: "hello"},
|
||||||
link: "https://example.com",
|
sysURL: "https://example.com",
|
||||||
expectedMetadata: metadata.Metadata{
|
expectedMetadata: metadata.Metadata{
|
||||||
Forge: metadata.Forge{Type: "gitea", URL: "https://gitea.com"},
|
Forge: metadata.Forge{Type: "gitea", URL: "https://gitea.com"},
|
||||||
Sys: metadata.System{Name: "woodpecker", Host: "example.com", Link: "https://example.com"},
|
Sys: metadata.System{Name: "woodpecker", Host: "example.com", URL: "https://example.com"},
|
||||||
Repo: metadata.Repo{Owner: "testUser", Name: "testRepo", Link: "https://gitea.com/testUser/testRepo", CloneURL: "https://gitea.com/testUser/testRepo.git", CloneSSHURL: "git@gitea.com:testUser/testRepo.git", Branch: "main", Private: true},
|
Repo: metadata.Repo{Owner: "testUser", Name: "testRepo", ForgeURL: "https://gitea.com/testUser/testRepo", CloneURL: "https://gitea.com/testUser/testRepo.git", CloneSSHURL: "git@gitea.com:testUser/testRepo.git", Branch: "main", Private: true},
|
||||||
Curr: metadata.Pipeline{Number: 3},
|
Curr: metadata.Pipeline{Number: 3},
|
||||||
Prev: metadata.Pipeline{Number: 2},
|
Prev: metadata.Pipeline{Number: 2},
|
||||||
Workflow: metadata.Workflow{Name: "hello"},
|
Workflow: metadata.Workflow{Name: "hello"},
|
||||||
|
@ -122,7 +122,7 @@ func TestMetadataFromStruct(t *testing.T) {
|
||||||
|
|
||||||
for _, testCase := range testCases {
|
for _, testCase := range testCases {
|
||||||
t.Run(testCase.name, func(t *testing.T) {
|
t.Run(testCase.name, func(t *testing.T) {
|
||||||
result := frontend.MetadataFromStruct(testCase.forge, testCase.repo, testCase.pipeline, testCase.last, testCase.workflow, testCase.link)
|
result := frontend.MetadataFromStruct(testCase.forge, testCase.repo, testCase.pipeline, testCase.last, testCase.workflow, testCase.sysURL)
|
||||||
assert.EqualValues(t, testCase.expectedMetadata, result)
|
assert.EqualValues(t, testCase.expectedMetadata, result)
|
||||||
assert.EqualValues(t, testCase.expectedEnviron, result.Environ())
|
assert.EqualValues(t, testCase.expectedEnviron, result.Environ())
|
||||||
})
|
})
|
||||||
|
|
|
@ -60,7 +60,7 @@ func TestCompilerCompile(t *testing.T) {
|
||||||
Owner: "octacat",
|
Owner: "octacat",
|
||||||
Name: "hello-world",
|
Name: "hello-world",
|
||||||
Private: true,
|
Private: true,
|
||||||
Link: "https://github.com/octocat/hello-world",
|
ForgeURL: "https://github.com/octocat/hello-world",
|
||||||
CloneURL: "https://github.com/octocat/hello-world.git",
|
CloneURL: "https://github.com/octocat/hello-world.git",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -104,9 +104,9 @@ func WithWorkspace(base, path string) Option {
|
||||||
|
|
||||||
// WithWorkspaceFromURL configures the compiler with the workspace
|
// WithWorkspaceFromURL configures the compiler with the workspace
|
||||||
// base and path based on the repository url.
|
// base and path based on the repository url.
|
||||||
func WithWorkspaceFromURL(base, link string) Option {
|
func WithWorkspaceFromURL(base, u string) Option {
|
||||||
srcPath := "src"
|
srcPath := "src"
|
||||||
parsed, err := url.Parse(link)
|
parsed, err := url.Parse(u)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
srcPath = path.Join(srcPath, parsed.Hostname(), parsed.Path)
|
srcPath = path.Join(srcPath, parsed.Hostname(), parsed.Path)
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ func TestWithMetadata(t *testing.T) {
|
||||||
Owner: "octacat",
|
Owner: "octacat",
|
||||||
Name: "hello-world",
|
Name: "hello-world",
|
||||||
Private: true,
|
Private: true,
|
||||||
Link: "https://github.com/octocat/hello-world",
|
ForgeURL: "https://github.com/octocat/hello-world",
|
||||||
CloneURL: "https://github.com/octocat/hello-world.git",
|
CloneURL: "https://github.com/octocat/hello-world.git",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ func TestWithMetadata(t *testing.T) {
|
||||||
if compiler.env["CI_REPO_NAME"] != metadata.Repo.Name {
|
if compiler.env["CI_REPO_NAME"] != metadata.Repo.Name {
|
||||||
t.Errorf("WithMetadata must set CI_REPO_NAME")
|
t.Errorf("WithMetadata must set CI_REPO_NAME")
|
||||||
}
|
}
|
||||||
if compiler.env["CI_REPO_URL"] != metadata.Repo.Link {
|
if compiler.env["CI_REPO_URL"] != metadata.Repo.ForgeURL {
|
||||||
t.Errorf("WithMetadata must set CI_REPO_URL")
|
t.Errorf("WithMetadata must set CI_REPO_URL")
|
||||||
}
|
}
|
||||||
if compiler.env["CI_REPO_CLONE_URL"] != metadata.Repo.CloneURL {
|
if compiler.env["CI_REPO_CLONE_URL"] != metadata.Repo.CloneURL {
|
||||||
|
|
|
@ -48,7 +48,7 @@ type StepBuilder struct {
|
||||||
Netrc *model.Netrc
|
Netrc *model.Netrc
|
||||||
Secs []*model.Secret
|
Secs []*model.Secret
|
||||||
Regs []*model.Registry
|
Regs []*model.Registry
|
||||||
Link string
|
Host string
|
||||||
Yamls []*forge_types.FileMeta
|
Yamls []*forge_types.FileMeta
|
||||||
Envs map[string]string
|
Envs map[string]string
|
||||||
Forge metadata.ServerForge
|
Forge metadata.ServerForge
|
||||||
|
@ -117,7 +117,7 @@ func (b *StepBuilder) Build() (items []*Item, errorsAndWarnings error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *StepBuilder) genItemForWorkflow(workflow *model.Workflow, axis matrix.Axis, data string) (item *Item, errorsAndWarnings error) {
|
func (b *StepBuilder) genItemForWorkflow(workflow *model.Workflow, axis matrix.Axis, data string) (item *Item, errorsAndWarnings error) {
|
||||||
workflowMetadata := frontend.MetadataFromStruct(b.Forge, b.Repo, b.Curr, b.Last, workflow, b.Link)
|
workflowMetadata := frontend.MetadataFromStruct(b.Forge, b.Repo, b.Curr, b.Last, workflow, b.Host)
|
||||||
environ := b.environmentVariables(workflowMetadata, axis)
|
environ := b.environmentVariables(workflowMetadata, axis)
|
||||||
|
|
||||||
// add global environment variables for substituting
|
// add global environment variables for substituting
|
||||||
|
@ -291,7 +291,7 @@ func (b *StepBuilder) toInternalRepresentation(parsed *yaml_types.Workflow, envi
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
compiler.WithProxy(b.ProxyOpts),
|
compiler.WithProxy(b.ProxyOpts),
|
||||||
compiler.WithWorkspaceFromURL("/woodpecker", b.Repo.Link),
|
compiler.WithWorkspaceFromURL("/woodpecker", b.Repo.ForgeURL),
|
||||||
compiler.WithMetadata(metadata),
|
compiler.WithMetadata(metadata),
|
||||||
compiler.WithTrusted(b.Repo.IsTrusted),
|
compiler.WithTrusted(b.Repo.IsTrusted),
|
||||||
compiler.WithNetrcOnlyTrusted(b.Repo.NetrcOnlyTrusted),
|
compiler.WithNetrcOnlyTrusted(b.Repo.NetrcOnlyTrusted),
|
||||||
|
|
|
@ -44,7 +44,7 @@ func TestGlobalEnvsubst(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Data: []byte(`
|
{Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -81,7 +81,7 @@ func TestMissingGlobalEnvsubst(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Data: []byte(`
|
{Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -115,7 +115,7 @@ bbb`,
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Data: []byte(`
|
{Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -154,7 +154,7 @@ func TestMultiPipeline(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Data: []byte(`
|
{Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -191,7 +191,7 @@ func TestDependsOn(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Name: "lint", Data: []byte(`
|
{Name: "lint", Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -241,7 +241,7 @@ func TestRunsOn(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Data: []byte(`
|
{Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -279,7 +279,7 @@ func TestPipelineName(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Name: ".woodpecker/lint.yml", Data: []byte(`
|
{Name: ".woodpecker/lint.yml", Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -317,7 +317,7 @@ func TestBranchFilter(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Data: []byte(`
|
{Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -358,7 +358,7 @@ func TestRootWhenFilter(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Data: []byte(`
|
{Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -410,7 +410,7 @@ func TestZeroSteps(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Data: []byte(`
|
{Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -446,7 +446,7 @@ func TestZeroStepsAsMultiPipelineDeps(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Name: "zerostep", Data: []byte(`
|
{Name: "zerostep", Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
@ -498,7 +498,7 @@ func TestZeroStepsAsMultiPipelineTransitiveDeps(t *testing.T) {
|
||||||
Netrc: &model.Netrc{},
|
Netrc: &model.Netrc{},
|
||||||
Secs: []*model.Secret{},
|
Secs: []*model.Secret{},
|
||||||
Regs: []*model.Registry{},
|
Regs: []*model.Registry{},
|
||||||
Link: "",
|
Host: "",
|
||||||
Yamls: []*forge_types.FileMeta{
|
Yamls: []*forge_types.FileMeta{
|
||||||
{Name: "zerostep", Data: []byte(`
|
{Name: "zerostep", Data: []byte(`
|
||||||
version: 1
|
version: 1
|
||||||
|
|
|
@ -87,8 +87,8 @@ func createTmpPipeline(event model.WebhookEvent, commitSHA string, repo *model.R
|
||||||
Author: user.Login,
|
Author: user.Login,
|
||||||
Email: user.Email,
|
Email: user.Email,
|
||||||
|
|
||||||
// TODO: Generate proper link to commit
|
// TODO: Generate proper URL to commit
|
||||||
Link: repo.Link,
|
ForgeURL: repo.ForgeURL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ func PostRepo(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
link := fmt.Sprintf(
|
hookURL := fmt.Sprintf(
|
||||||
"%s/api/hook?access_token=%s",
|
"%s/api/hook?access_token=%s",
|
||||||
server.Config.Server.WebhookHost,
|
server.Config.Server.WebhookHost,
|
||||||
sig,
|
sig,
|
||||||
|
@ -148,7 +148,7 @@ func PostRepo(c *gin.Context) {
|
||||||
|
|
||||||
repo.OrgID = org.ID
|
repo.OrgID = org.ID
|
||||||
|
|
||||||
err = forge.Activate(c, user, repo, link)
|
err = forge.Activate(c, user, repo, hookURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.String(http.StatusInternalServerError, err.Error())
|
c.String(http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
|
@ -483,9 +483,9 @@ func MoveRepo(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconstruct the link
|
// reconstruct the hook url
|
||||||
host := server.Config.Server.WebhookHost
|
host := server.Config.Server.WebhookHost
|
||||||
link := fmt.Sprintf(
|
hookURL := fmt.Sprintf(
|
||||||
"%s/api/hook?access_token=%s",
|
"%s/api/hook?access_token=%s",
|
||||||
host,
|
host,
|
||||||
sig,
|
sig,
|
||||||
|
@ -494,7 +494,7 @@ func MoveRepo(c *gin.Context) {
|
||||||
if err := forge.Deactivate(c, user, repo, host); err != nil {
|
if err := forge.Deactivate(c, user, repo, host); err != nil {
|
||||||
log.Trace().Err(err).Msgf("deactivate repo '%s' for move to activate later, got an error", repo.FullName)
|
log.Trace().Err(err).Msgf("deactivate repo '%s' for move to activate later, got an error", repo.FullName)
|
||||||
}
|
}
|
||||||
if err := forge.Activate(c, user, repo, link); err != nil {
|
if err := forge.Activate(c, user, repo, hookURL); err != nil {
|
||||||
c.String(http.StatusInternalServerError, err.Error())
|
c.String(http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -571,9 +571,9 @@ func repairRepo(c *gin.Context, repo *model.Repo, withPerms bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconstruct the link
|
// reconstruct the hook url
|
||||||
host := server.Config.Server.WebhookHost
|
host := server.Config.Server.WebhookHost
|
||||||
link := fmt.Sprintf(
|
hookURL := fmt.Sprintf(
|
||||||
"%s/api/hook?access_token=%s",
|
"%s/api/hook?access_token=%s",
|
||||||
host,
|
host,
|
||||||
sig,
|
sig,
|
||||||
|
@ -613,7 +613,7 @@ func repairRepo(c *gin.Context, repo *model.Repo, withPerms bool) {
|
||||||
if err := forge.Deactivate(c, user, repo, host); err != nil {
|
if err := forge.Deactivate(c, user, repo, host); err != nil {
|
||||||
log.Trace().Err(err).Msgf("deactivate repo '%s' to repair failed", repo.FullName)
|
log.Trace().Err(err).Msgf("deactivate repo '%s' to repair failed", repo.FullName)
|
||||||
}
|
}
|
||||||
if err := forge.Activate(c, user, repo, link); err != nil {
|
if err := forge.Activate(c, user, repo, hookURL); err != nil {
|
||||||
c.String(http.StatusInternalServerError, err.Error())
|
c.String(http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@ type CCProject struct {
|
||||||
WebURL string `xml:"webUrl,attr"`
|
WebURL string `xml:"webUrl,attr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(r *model.Repo, b *model.Pipeline, link string) *CCProjects {
|
func New(r *model.Repo, b *model.Pipeline, url string) *CCProjects {
|
||||||
proj := &CCProject{
|
proj := &CCProject{
|
||||||
Name: r.FullName,
|
Name: r.FullName,
|
||||||
WebURL: link,
|
WebURL: url,
|
||||||
Activity: "Building",
|
Activity: "Building",
|
||||||
LastBuildStatus: "Unknown",
|
LastBuildStatus: "Unknown",
|
||||||
LastBuildLabel: "Unknown",
|
LastBuildLabel: "Unknown",
|
||||||
|
|
|
@ -139,6 +139,6 @@ func CreatePipeline(ctx context.Context, store store.Store, f forge.Forge, cron
|
||||||
Message: cron.Name,
|
Message: cron.Name,
|
||||||
Timestamp: cron.NextExec,
|
Timestamp: cron.NextExec,
|
||||||
Sender: cron.Name,
|
Sender: cron.Name,
|
||||||
Link: repo.Link,
|
ForgeURL: repo.ForgeURL,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,7 +283,7 @@ func (c *config) Status(ctx context.Context, user *model.User, repo *model.Repo,
|
||||||
State: convertStatus(pipeline.Status),
|
State: convertStatus(pipeline.Status),
|
||||||
Desc: common.GetPipelineStatusDescription(pipeline.Status),
|
Desc: common.GetPipelineStatusDescription(pipeline.Status),
|
||||||
Key: "Woodpecker",
|
Key: "Woodpecker",
|
||||||
URL: common.GetPipelineStatusLink(repo, pipeline, nil),
|
URL: common.GetPipelineStatusURL(repo, pipeline, nil),
|
||||||
}
|
}
|
||||||
return c.newClient(ctx, user).CreateStatus(repo.Owner, repo.Name, pipeline.Commit, &status)
|
return c.newClient(ctx, user).CreateStatus(repo.Owner, repo.Name, pipeline.Commit, &status)
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ func convertRepo(from *internal.Repo, perm *internal.RepoPerm) *model.Repo {
|
||||||
Owner: strings.Split(from.FullName, "/")[0],
|
Owner: strings.Split(from.FullName, "/")[0],
|
||||||
Name: strings.Split(from.FullName, "/")[1],
|
Name: strings.Split(from.FullName, "/")[1],
|
||||||
FullName: from.FullName,
|
FullName: from.FullName,
|
||||||
Link: from.Links.HTML.Href,
|
ForgeURL: from.Links.HTML.Href,
|
||||||
IsSCMPrivate: from.IsPrivate,
|
IsSCMPrivate: from.IsPrivate,
|
||||||
Avatar: from.Owner.Links.Avatar.Href,
|
Avatar: from.Owner.Links.Avatar.Href,
|
||||||
SCMKind: model.SCMKind(from.Scm),
|
SCMKind: model.SCMKind(from.Scm),
|
||||||
|
@ -171,7 +171,7 @@ func convertPullHook(from *internal.PullRequestHook) *model.Pipeline {
|
||||||
from.PullRequest.Dest.Branch.Name,
|
from.PullRequest.Dest.Branch.Name,
|
||||||
),
|
),
|
||||||
CloneURL: fmt.Sprintf("https://bitbucket.org/%s", from.PullRequest.Source.Repo.FullName),
|
CloneURL: fmt.Sprintf("https://bitbucket.org/%s", from.PullRequest.Source.Repo.FullName),
|
||||||
Link: from.PullRequest.Links.HTML.Href,
|
ForgeURL: from.PullRequest.Links.HTML.Href,
|
||||||
Branch: from.PullRequest.Dest.Branch.Name,
|
Branch: from.PullRequest.Dest.Branch.Name,
|
||||||
Message: from.PullRequest.Desc,
|
Message: from.PullRequest.Desc,
|
||||||
Avatar: from.Actor.Links.Avatar.Href,
|
Avatar: from.Actor.Links.Avatar.Href,
|
||||||
|
@ -186,7 +186,7 @@ func convertPullHook(from *internal.PullRequestHook) *model.Pipeline {
|
||||||
func convertPushHook(hook *internal.PushHook, change *internal.Change) *model.Pipeline {
|
func convertPushHook(hook *internal.PushHook, change *internal.Change) *model.Pipeline {
|
||||||
pipeline := &model.Pipeline{
|
pipeline := &model.Pipeline{
|
||||||
Commit: change.New.Target.Hash,
|
Commit: change.New.Target.Hash,
|
||||||
Link: change.New.Target.Links.HTML.Href,
|
ForgeURL: change.New.Target.Links.HTML.Href,
|
||||||
Branch: change.New.Name,
|
Branch: change.New.Name,
|
||||||
Message: change.New.Target.Message,
|
Message: change.New.Target.Message,
|
||||||
Avatar: hook.Actor.Links.Avatar.Href,
|
Avatar: hook.Actor.Links.Avatar.Href,
|
||||||
|
|
|
@ -65,7 +65,7 @@ func Test_helper(t *testing.T) {
|
||||||
g.Assert(string(to.SCMKind)).Equal(from.Scm)
|
g.Assert(string(to.SCMKind)).Equal(from.Scm)
|
||||||
g.Assert(to.IsSCMPrivate).Equal(from.IsPrivate)
|
g.Assert(to.IsSCMPrivate).Equal(from.IsPrivate)
|
||||||
g.Assert(to.Clone).Equal(from.Links.HTML.Href)
|
g.Assert(to.Clone).Equal(from.Links.HTML.Href)
|
||||||
g.Assert(to.Link).Equal(from.Links.HTML.Href)
|
g.Assert(to.ForgeURL).Equal(from.Links.HTML.Href)
|
||||||
g.Assert(to.Perm.Push).IsTrue()
|
g.Assert(to.Perm.Push).IsTrue()
|
||||||
g.Assert(to.Perm.Admin).IsFalse()
|
g.Assert(to.Perm.Admin).IsFalse()
|
||||||
})
|
})
|
||||||
|
@ -139,7 +139,7 @@ func Test_helper(t *testing.T) {
|
||||||
g.Assert(pipeline.Avatar).Equal(hook.Actor.Links.Avatar.Href)
|
g.Assert(pipeline.Avatar).Equal(hook.Actor.Links.Avatar.Href)
|
||||||
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Dest.Commit.Hash)
|
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Dest.Commit.Hash)
|
||||||
g.Assert(pipeline.Branch).Equal(hook.PullRequest.Dest.Branch.Name)
|
g.Assert(pipeline.Branch).Equal(hook.PullRequest.Dest.Branch.Name)
|
||||||
g.Assert(pipeline.Link).Equal(hook.PullRequest.Links.HTML.Href)
|
g.Assert(pipeline.ForgeURL).Equal(hook.PullRequest.Links.HTML.Href)
|
||||||
g.Assert(pipeline.Ref).Equal("refs/heads/main")
|
g.Assert(pipeline.Ref).Equal("refs/heads/main")
|
||||||
g.Assert(pipeline.Refspec).Equal("change:main")
|
g.Assert(pipeline.Refspec).Equal("change:main")
|
||||||
g.Assert(pipeline.CloneURL).Equal("https://bitbucket.org/baz/bar")
|
g.Assert(pipeline.CloneURL).Equal("https://bitbucket.org/baz/bar")
|
||||||
|
@ -167,7 +167,7 @@ func Test_helper(t *testing.T) {
|
||||||
g.Assert(pipeline.Avatar).Equal(hook.Actor.Links.Avatar.Href)
|
g.Assert(pipeline.Avatar).Equal(hook.Actor.Links.Avatar.Href)
|
||||||
g.Assert(pipeline.Commit).Equal(change.New.Target.Hash)
|
g.Assert(pipeline.Commit).Equal(change.New.Target.Hash)
|
||||||
g.Assert(pipeline.Branch).Equal(change.New.Name)
|
g.Assert(pipeline.Branch).Equal(change.New.Name)
|
||||||
g.Assert(pipeline.Link).Equal(change.New.Target.Links.HTML.Href)
|
g.Assert(pipeline.ForgeURL).Equal(change.New.Target.Links.HTML.Href)
|
||||||
g.Assert(pipeline.Ref).Equal("refs/heads/main")
|
g.Assert(pipeline.Ref).Equal("refs/heads/main")
|
||||||
g.Assert(pipeline.Message).Equal(change.New.Target.Message)
|
g.Assert(pipeline.Message).Equal(change.New.Target.Message)
|
||||||
g.Assert(pipeline.Timestamp).Equal(change.New.Target.Date.Unix())
|
g.Assert(pipeline.Timestamp).Equal(change.New.Target.Date.Unix())
|
||||||
|
|
|
@ -77,7 +77,7 @@ func GetPipelineStatusDescription(status model.StatusValue) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPipelineStatusLink(repo *model.Repo, pipeline *model.Pipeline, workflow *model.Workflow) string {
|
func GetPipelineStatusURL(repo *model.Repo, pipeline *model.Pipeline, workflow *model.Workflow) string {
|
||||||
if workflow == nil {
|
if workflow == nil {
|
||||||
return fmt.Sprintf("%s/repos/%d/pipeline/%d", server.Config.Server.Host, repo.ID, pipeline.Number)
|
return fmt.Sprintf("%s/repos/%d/pipeline/%d", server.Config.Server.Host, repo.ID, pipeline.Number)
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,7 @@ func (c *Gitea) Status(ctx context.Context, user *model.User, repo *model.Repo,
|
||||||
pipeline.Commit,
|
pipeline.Commit,
|
||||||
gitea.CreateStatusOption{
|
gitea.CreateStatusOption{
|
||||||
State: getStatus(workflow.State),
|
State: getStatus(workflow.State),
|
||||||
TargetURL: common.GetPipelineStatusLink(repo, pipeline, workflow),
|
TargetURL: common.GetPipelineStatusURL(repo, pipeline, workflow),
|
||||||
Description: common.GetPipelineStatusDescription(workflow.State),
|
Description: common.GetPipelineStatusDescription(workflow.State),
|
||||||
Context: common.GetPipelineStatusContext(repo, pipeline, workflow),
|
Context: common.GetPipelineStatusContext(repo, pipeline, workflow),
|
||||||
},
|
},
|
||||||
|
|
|
@ -92,7 +92,7 @@ func Test_gitea(t *testing.T) {
|
||||||
g.Assert(repo.FullName).Equal(fakeRepo.Owner + "/" + fakeRepo.Name)
|
g.Assert(repo.FullName).Equal(fakeRepo.Owner + "/" + fakeRepo.Name)
|
||||||
g.Assert(repo.IsSCMPrivate).IsTrue()
|
g.Assert(repo.IsSCMPrivate).IsTrue()
|
||||||
g.Assert(repo.Clone).Equal("http://localhost/test_name/repo_name.git")
|
g.Assert(repo.Clone).Equal("http://localhost/test_name/repo_name.git")
|
||||||
g.Assert(repo.Link).Equal("http://localhost/test_name/repo_name")
|
g.Assert(repo.ForgeURL).Equal("http://localhost/test_name/repo_name")
|
||||||
})
|
})
|
||||||
g.It("Should handle a not found error", func() {
|
g.It("Should handle a not found error", func() {
|
||||||
_, err := c.Repo(ctx, fakeUser, "0", fakeRepoNotFound.Owner, fakeRepoNotFound.Name)
|
_, err := c.Repo(ctx, fakeUser, "0", fakeRepoNotFound.Owner, fakeRepoNotFound.Name)
|
||||||
|
|
|
@ -43,7 +43,7 @@ func toRepo(from *gitea.Repository) *model.Repo {
|
||||||
Owner: from.Owner.UserName,
|
Owner: from.Owner.UserName,
|
||||||
FullName: from.FullName,
|
FullName: from.FullName,
|
||||||
Avatar: avatar,
|
Avatar: avatar,
|
||||||
Link: from.HTMLURL,
|
ForgeURL: from.HTMLURL,
|
||||||
IsSCMPrivate: from.Private || from.Owner.Visibility != gitea.VisibleTypePublic,
|
IsSCMPrivate: from.Private || from.Owner.Visibility != gitea.VisibleTypePublic,
|
||||||
Clone: from.CloneURL,
|
Clone: from.CloneURL,
|
||||||
CloneSSH: from.SSHURL,
|
CloneSSH: from.SSHURL,
|
||||||
|
@ -92,7 +92,7 @@ func pipelineFromPush(hook *pushHook) *model.Pipeline {
|
||||||
Event: model.EventPush,
|
Event: model.EventPush,
|
||||||
Commit: hook.After,
|
Commit: hook.After,
|
||||||
Ref: hook.Ref,
|
Ref: hook.Ref,
|
||||||
Link: link,
|
ForgeURL: link,
|
||||||
Branch: strings.TrimPrefix(hook.Ref, "refs/heads/"),
|
Branch: strings.TrimPrefix(hook.Ref, "refs/heads/"),
|
||||||
Message: message,
|
Message: message,
|
||||||
Avatar: avatar,
|
Avatar: avatar,
|
||||||
|
@ -131,7 +131,7 @@ func pipelineFromTag(hook *pushHook) *model.Pipeline {
|
||||||
Event: model.EventTag,
|
Event: model.EventTag,
|
||||||
Commit: hook.Sha,
|
Commit: hook.Sha,
|
||||||
Ref: fmt.Sprintf("refs/tags/%s", hook.Ref),
|
Ref: fmt.Sprintf("refs/tags/%s", hook.Ref),
|
||||||
Link: fmt.Sprintf("%s/src/tag/%s", hook.Repo.HTMLURL, hook.Ref),
|
ForgeURL: fmt.Sprintf("%s/src/tag/%s", hook.Repo.HTMLURL, hook.Ref),
|
||||||
Branch: fmt.Sprintf("refs/tags/%s", hook.Ref),
|
Branch: fmt.Sprintf("refs/tags/%s", hook.Ref),
|
||||||
Message: fmt.Sprintf("created tag %s", hook.Ref),
|
Message: fmt.Sprintf("created tag %s", hook.Ref),
|
||||||
Avatar: avatar,
|
Avatar: avatar,
|
||||||
|
@ -150,7 +150,7 @@ func pipelineFromPullRequest(hook *pullRequestHook) *model.Pipeline {
|
||||||
pipeline := &model.Pipeline{
|
pipeline := &model.Pipeline{
|
||||||
Event: model.EventPull,
|
Event: model.EventPull,
|
||||||
Commit: hook.PullRequest.Head.Sha,
|
Commit: hook.PullRequest.Head.Sha,
|
||||||
Link: hook.PullRequest.URL,
|
ForgeURL: hook.PullRequest.URL,
|
||||||
Ref: fmt.Sprintf("refs/pull/%d/head", hook.Number),
|
Ref: fmt.Sprintf("refs/pull/%d/head", hook.Number),
|
||||||
Branch: hook.PullRequest.Base.Ref,
|
Branch: hook.PullRequest.Base.Ref,
|
||||||
Message: hook.PullRequest.Title,
|
Message: hook.PullRequest.Title,
|
||||||
|
|
|
@ -99,7 +99,7 @@ func Test_parse(t *testing.T) {
|
||||||
g.Assert(pipeline.Event).Equal(model.EventPush)
|
g.Assert(pipeline.Event).Equal(model.EventPush)
|
||||||
g.Assert(pipeline.Commit).Equal(hook.After)
|
g.Assert(pipeline.Commit).Equal(hook.After)
|
||||||
g.Assert(pipeline.Ref).Equal(hook.Ref)
|
g.Assert(pipeline.Ref).Equal(hook.Ref)
|
||||||
g.Assert(pipeline.Link).Equal(hook.Commits[0].URL)
|
g.Assert(pipeline.ForgeURL).Equal(hook.Commits[0].URL)
|
||||||
g.Assert(pipeline.Branch).Equal("main")
|
g.Assert(pipeline.Branch).Equal("main")
|
||||||
g.Assert(pipeline.Message).Equal(hook.Commits[0].Message)
|
g.Assert(pipeline.Message).Equal(hook.Commits[0].Message)
|
||||||
g.Assert(pipeline.Avatar).Equal("http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87")
|
g.Assert(pipeline.Avatar).Equal("http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87")
|
||||||
|
@ -114,7 +114,7 @@ func Test_parse(t *testing.T) {
|
||||||
g.Assert(repo.Name).Equal(hook.Repo.Name)
|
g.Assert(repo.Name).Equal(hook.Repo.Name)
|
||||||
g.Assert(repo.Owner).Equal(hook.Repo.Owner.UserName)
|
g.Assert(repo.Owner).Equal(hook.Repo.Owner.UserName)
|
||||||
g.Assert(repo.FullName).Equal("gordon/hello-world")
|
g.Assert(repo.FullName).Equal("gordon/hello-world")
|
||||||
g.Assert(repo.Link).Equal(hook.Repo.HTMLURL)
|
g.Assert(repo.ForgeURL).Equal(hook.Repo.HTMLURL)
|
||||||
})
|
})
|
||||||
|
|
||||||
g.It("Should return a Pipeline struct from a tag hook", func() {
|
g.It("Should return a Pipeline struct from a tag hook", func() {
|
||||||
|
@ -125,7 +125,7 @@ func Test_parse(t *testing.T) {
|
||||||
g.Assert(pipeline.Commit).Equal(hook.Sha)
|
g.Assert(pipeline.Commit).Equal(hook.Sha)
|
||||||
g.Assert(pipeline.Ref).Equal("refs/tags/v1.0.0")
|
g.Assert(pipeline.Ref).Equal("refs/tags/v1.0.0")
|
||||||
g.Assert(pipeline.Branch).Equal("refs/tags/v1.0.0")
|
g.Assert(pipeline.Branch).Equal("refs/tags/v1.0.0")
|
||||||
g.Assert(pipeline.Link).Equal("http://gitea.golang.org/gordon/hello-world/src/tag/v1.0.0")
|
g.Assert(pipeline.ForgeURL).Equal("http://gitea.golang.org/gordon/hello-world/src/tag/v1.0.0")
|
||||||
g.Assert(pipeline.Message).Equal("created tag v1.0.0")
|
g.Assert(pipeline.Message).Equal("created tag v1.0.0")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ func Test_parse(t *testing.T) {
|
||||||
g.Assert(pipeline.Event).Equal(model.EventPull)
|
g.Assert(pipeline.Event).Equal(model.EventPull)
|
||||||
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Head.Sha)
|
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Head.Sha)
|
||||||
g.Assert(pipeline.Ref).Equal("refs/pull/1/head")
|
g.Assert(pipeline.Ref).Equal("refs/pull/1/head")
|
||||||
g.Assert(pipeline.Link).Equal(hook.PullRequest.URL)
|
g.Assert(pipeline.ForgeURL).Equal(hook.PullRequest.URL)
|
||||||
g.Assert(pipeline.Branch).Equal("main")
|
g.Assert(pipeline.Branch).Equal("main")
|
||||||
g.Assert(pipeline.Refspec).Equal("feature/changes:main")
|
g.Assert(pipeline.Refspec).Equal("feature/changes:main")
|
||||||
g.Assert(pipeline.Message).Equal(hook.PullRequest.Title)
|
g.Assert(pipeline.Message).Equal(hook.PullRequest.Title)
|
||||||
|
@ -151,7 +151,7 @@ func Test_parse(t *testing.T) {
|
||||||
g.Assert(repo.Name).Equal(hook.Repo.Name)
|
g.Assert(repo.Name).Equal(hook.Repo.Name)
|
||||||
g.Assert(repo.Owner).Equal(hook.Repo.Owner.UserName)
|
g.Assert(repo.Owner).Equal(hook.Repo.Owner.UserName)
|
||||||
g.Assert(repo.FullName).Equal("gordon/hello-world")
|
g.Assert(repo.FullName).Equal("gordon/hello-world")
|
||||||
g.Assert(repo.Link).Equal(hook.Repo.HTMLURL)
|
g.Assert(repo.ForgeURL).Equal(hook.Repo.HTMLURL)
|
||||||
})
|
})
|
||||||
|
|
||||||
g.It("Should return a Perm struct from a Gitea Perm", func() {
|
g.It("Should return a Perm struct from a Gitea Perm", func() {
|
||||||
|
@ -209,7 +209,7 @@ func Test_parse(t *testing.T) {
|
||||||
g.Assert(repo.Owner).Equal(from.Owner.UserName)
|
g.Assert(repo.Owner).Equal(from.Owner.UserName)
|
||||||
g.Assert(repo.Name).Equal("hello-world")
|
g.Assert(repo.Name).Equal("hello-world")
|
||||||
g.Assert(repo.Branch).Equal("main")
|
g.Assert(repo.Branch).Equal("main")
|
||||||
g.Assert(repo.Link).Equal(from.HTMLURL)
|
g.Assert(repo.ForgeURL).Equal(from.HTMLURL)
|
||||||
g.Assert(repo.Clone).Equal(from.CloneURL)
|
g.Assert(repo.Clone).Equal(from.CloneURL)
|
||||||
g.Assert(repo.Avatar).Equal(from.Owner.AvatarURL)
|
g.Assert(repo.Avatar).Equal(from.Owner.AvatarURL)
|
||||||
g.Assert(repo.IsSCMPrivate).Equal(from.Private)
|
g.Assert(repo.IsSCMPrivate).Equal(from.Private)
|
||||||
|
|
|
@ -86,7 +86,7 @@ func convertRepo(from *github.Repository) *model.Repo {
|
||||||
ForgeRemoteID: model.ForgeRemoteID(fmt.Sprint(from.GetID())),
|
ForgeRemoteID: model.ForgeRemoteID(fmt.Sprint(from.GetID())),
|
||||||
Name: from.GetName(),
|
Name: from.GetName(),
|
||||||
FullName: from.GetFullName(),
|
FullName: from.GetFullName(),
|
||||||
Link: from.GetHTMLURL(),
|
ForgeURL: from.GetHTMLURL(),
|
||||||
IsSCMPrivate: from.GetPrivate(),
|
IsSCMPrivate: from.GetPrivate(),
|
||||||
Clone: from.GetCloneURL(),
|
Clone: from.GetCloneURL(),
|
||||||
CloneSSH: from.GetSSHURL(),
|
CloneSSH: from.GetSSHURL(),
|
||||||
|
@ -146,7 +146,7 @@ func convertRepoHook(eventRepo *github.PushEventRepository) *model.Repo {
|
||||||
Owner: eventRepo.GetOwner().GetLogin(),
|
Owner: eventRepo.GetOwner().GetLogin(),
|
||||||
Name: eventRepo.GetName(),
|
Name: eventRepo.GetName(),
|
||||||
FullName: eventRepo.GetFullName(),
|
FullName: eventRepo.GetFullName(),
|
||||||
Link: eventRepo.GetHTMLURL(),
|
ForgeURL: eventRepo.GetHTMLURL(),
|
||||||
IsSCMPrivate: eventRepo.GetPrivate(),
|
IsSCMPrivate: eventRepo.GetPrivate(),
|
||||||
Clone: eventRepo.GetCloneURL(),
|
Clone: eventRepo.GetCloneURL(),
|
||||||
CloneSSH: eventRepo.GetSSHURL(),
|
CloneSSH: eventRepo.GetSSHURL(),
|
||||||
|
|
|
@ -118,7 +118,7 @@ func Test_helper(t *testing.T) {
|
||||||
g.Assert(string(to.SCMKind)).Equal("git")
|
g.Assert(string(to.SCMKind)).Equal("git")
|
||||||
g.Assert(to.IsSCMPrivate).IsTrue()
|
g.Assert(to.IsSCMPrivate).IsTrue()
|
||||||
g.Assert(to.Clone).Equal("https://github.com/octocat/hello-world.git")
|
g.Assert(to.Clone).Equal("https://github.com/octocat/hello-world.git")
|
||||||
g.Assert(to.Link).Equal("https://github.com/octocat/hello-world")
|
g.Assert(to.ForgeURL).Equal("https://github.com/octocat/hello-world")
|
||||||
})
|
})
|
||||||
|
|
||||||
g.It("should convert repository permissions", func() {
|
g.It("should convert repository permissions", func() {
|
||||||
|
@ -174,7 +174,7 @@ func Test_helper(t *testing.T) {
|
||||||
g.Assert(repo.Name).Equal(*from.Name)
|
g.Assert(repo.Name).Equal(*from.Name)
|
||||||
g.Assert(repo.FullName).Equal(*from.FullName)
|
g.Assert(repo.FullName).Equal(*from.FullName)
|
||||||
g.Assert(repo.IsSCMPrivate).Equal(*from.Private)
|
g.Assert(repo.IsSCMPrivate).Equal(*from.Private)
|
||||||
g.Assert(repo.Link).Equal(*from.HTMLURL)
|
g.Assert(repo.ForgeURL).Equal(*from.HTMLURL)
|
||||||
g.Assert(repo.Clone).Equal(*from.CloneURL)
|
g.Assert(repo.Clone).Equal(*from.CloneURL)
|
||||||
g.Assert(repo.Branch).Equal(*from.DefaultBranch)
|
g.Assert(repo.Branch).Equal(*from.DefaultBranch)
|
||||||
})
|
})
|
||||||
|
@ -239,7 +239,7 @@ func Test_helper(t *testing.T) {
|
||||||
g.Assert(pipeline.Ref).Equal("refs/heads/main")
|
g.Assert(pipeline.Ref).Equal("refs/heads/main")
|
||||||
g.Assert(pipeline.Commit).Equal(*from.Deployment.SHA)
|
g.Assert(pipeline.Commit).Equal(*from.Deployment.SHA)
|
||||||
g.Assert(pipeline.Message).Equal(*from.Deployment.Description)
|
g.Assert(pipeline.Message).Equal(*from.Deployment.Description)
|
||||||
g.Assert(pipeline.Link).Equal(*from.Deployment.URL)
|
g.Assert(pipeline.ForgeURL).Equal(*from.Deployment.URL)
|
||||||
g.Assert(pipeline.Author).Equal(*from.Sender.Login)
|
g.Assert(pipeline.Author).Equal(*from.Sender.Login)
|
||||||
g.Assert(pipeline.Avatar).Equal(*from.Sender.AvatarURL)
|
g.Assert(pipeline.Avatar).Equal(*from.Sender.AvatarURL)
|
||||||
})
|
})
|
||||||
|
@ -262,7 +262,7 @@ func Test_helper(t *testing.T) {
|
||||||
g.Assert(pipeline.Ref).Equal("refs/heads/main")
|
g.Assert(pipeline.Ref).Equal("refs/heads/main")
|
||||||
g.Assert(pipeline.Commit).Equal(*from.HeadCommit.ID)
|
g.Assert(pipeline.Commit).Equal(*from.HeadCommit.ID)
|
||||||
g.Assert(pipeline.Message).Equal(*from.HeadCommit.Message)
|
g.Assert(pipeline.Message).Equal(*from.HeadCommit.Message)
|
||||||
g.Assert(pipeline.Link).Equal(*from.HeadCommit.URL)
|
g.Assert(pipeline.ForgeURL).Equal(*from.HeadCommit.URL)
|
||||||
g.Assert(pipeline.Author).Equal(*from.Sender.Login)
|
g.Assert(pipeline.Author).Equal(*from.Sender.Login)
|
||||||
g.Assert(pipeline.Avatar).Equal(*from.Sender.AvatarURL)
|
g.Assert(pipeline.Avatar).Equal(*from.Sender.AvatarURL)
|
||||||
g.Assert(pipeline.Email).Equal(*from.HeadCommit.Author.Email)
|
g.Assert(pipeline.Email).Equal(*from.HeadCommit.Author.Email)
|
||||||
|
|
|
@ -488,7 +488,7 @@ func (c *client) Status(ctx context.Context, user *model.User, repo *model.Repo,
|
||||||
client := c.newClientToken(ctx, user.Token)
|
client := c.newClientToken(ctx, user.Token)
|
||||||
|
|
||||||
if pipeline.Event == model.EventDeploy {
|
if pipeline.Event == model.EventDeploy {
|
||||||
matches := reDeploy.FindStringSubmatch(pipeline.Link)
|
matches := reDeploy.FindStringSubmatch(pipeline.ForgeURL)
|
||||||
if len(matches) != 2 {
|
if len(matches) != 2 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ func (c *client) Status(ctx context.Context, user *model.User, repo *model.Repo,
|
||||||
_, _, err := client.Repositories.CreateDeploymentStatus(ctx, repo.Owner, repo.Name, int64(id), &github.DeploymentStatusRequest{
|
_, _, err := client.Repositories.CreateDeploymentStatus(ctx, repo.Owner, repo.Name, int64(id), &github.DeploymentStatusRequest{
|
||||||
State: github.String(convertStatus(pipeline.Status)),
|
State: github.String(convertStatus(pipeline.Status)),
|
||||||
Description: github.String(common.GetPipelineStatusDescription(pipeline.Status)),
|
Description: github.String(common.GetPipelineStatusDescription(pipeline.Status)),
|
||||||
LogURL: github.String(common.GetPipelineStatusLink(repo, pipeline, nil)),
|
LogURL: github.String(common.GetPipelineStatusURL(repo, pipeline, nil)),
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ func (c *client) Status(ctx context.Context, user *model.User, repo *model.Repo,
|
||||||
Context: github.String(common.GetPipelineStatusContext(repo, pipeline, workflow)),
|
Context: github.String(common.GetPipelineStatusContext(repo, pipeline, workflow)),
|
||||||
State: github.String(convertStatus(workflow.State)),
|
State: github.String(convertStatus(workflow.State)),
|
||||||
Description: github.String(common.GetPipelineStatusDescription(workflow.State)),
|
Description: github.String(common.GetPipelineStatusDescription(workflow.State)),
|
||||||
TargetURL: github.String(common.GetPipelineStatusLink(repo, pipeline, workflow)),
|
TargetURL: github.String(common.GetPipelineStatusURL(repo, pipeline, workflow)),
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ func Test_github(t *testing.T) {
|
||||||
g.Assert(repo.FullName).Equal(fakeRepo.FullName)
|
g.Assert(repo.FullName).Equal(fakeRepo.FullName)
|
||||||
g.Assert(repo.IsSCMPrivate).IsTrue()
|
g.Assert(repo.IsSCMPrivate).IsTrue()
|
||||||
g.Assert(repo.Clone).Equal(fakeRepo.Clone)
|
g.Assert(repo.Clone).Equal(fakeRepo.Clone)
|
||||||
g.Assert(repo.Link).Equal(fakeRepo.Link)
|
g.Assert(repo.ForgeURL).Equal(fakeRepo.ForgeURL)
|
||||||
})
|
})
|
||||||
g.It("Should handle a not found error", func() {
|
g.It("Should handle a not found error", func() {
|
||||||
_, err := c.Repo(ctx, fakeUser, "0", fakeRepoNotFound.Owner, fakeRepoNotFound.Name)
|
_, err := c.Repo(ctx, fakeUser, "0", fakeRepoNotFound.Owner, fakeRepoNotFound.Name)
|
||||||
|
@ -124,7 +124,7 @@ var (
|
||||||
Name: "Hello-World",
|
Name: "Hello-World",
|
||||||
FullName: "octocat/Hello-World",
|
FullName: "octocat/Hello-World",
|
||||||
Avatar: "https://github.com/images/error/octocat_happy.gif",
|
Avatar: "https://github.com/images/error/octocat_happy.gif",
|
||||||
Link: "https://github.com/octocat/Hello-World",
|
ForgeURL: "https://github.com/octocat/Hello-World",
|
||||||
Clone: "https://github.com/octocat/Hello-World.git",
|
Clone: "https://github.com/octocat/Hello-World.git",
|
||||||
IsSCMPrivate: true,
|
IsSCMPrivate: true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ func parsePushHook(hook *github.PushEvent) (*model.Repo, *model.Pipeline, error)
|
||||||
Event: model.EventPush,
|
Event: model.EventPush,
|
||||||
Commit: hook.GetHeadCommit().GetID(),
|
Commit: hook.GetHeadCommit().GetID(),
|
||||||
Ref: hook.GetRef(),
|
Ref: hook.GetRef(),
|
||||||
Link: hook.GetHeadCommit().GetURL(),
|
ForgeURL: hook.GetHeadCommit().GetURL(),
|
||||||
Branch: strings.Replace(hook.GetRef(), "refs/heads/", "", -1),
|
Branch: strings.Replace(hook.GetRef(), "refs/heads/", "", -1),
|
||||||
Message: hook.GetHeadCommit().GetMessage(),
|
Message: hook.GetHeadCommit().GetMessage(),
|
||||||
Email: hook.GetHeadCommit().GetAuthor().GetEmail(),
|
Email: hook.GetHeadCommit().GetAuthor().GetEmail(),
|
||||||
|
@ -117,7 +117,7 @@ func parseDeployHook(hook *github.DeploymentEvent) (*model.Repo, *model.Pipeline
|
||||||
pipeline := &model.Pipeline{
|
pipeline := &model.Pipeline{
|
||||||
Event: model.EventDeploy,
|
Event: model.EventDeploy,
|
||||||
Commit: hook.GetDeployment().GetSHA(),
|
Commit: hook.GetDeployment().GetSHA(),
|
||||||
Link: hook.GetDeployment().GetURL(),
|
ForgeURL: hook.GetDeployment().GetURL(),
|
||||||
Message: hook.GetDeployment().GetDescription(),
|
Message: hook.GetDeployment().GetDescription(),
|
||||||
Ref: hook.GetDeployment().GetRef(),
|
Ref: hook.GetDeployment().GetRef(),
|
||||||
Branch: hook.GetDeployment().GetRef(),
|
Branch: hook.GetDeployment().GetRef(),
|
||||||
|
@ -153,7 +153,7 @@ func parsePullHook(hook *github.PullRequestEvent, merge bool) (*github.PullReque
|
||||||
pipeline := &model.Pipeline{
|
pipeline := &model.Pipeline{
|
||||||
Event: model.EventPull,
|
Event: model.EventPull,
|
||||||
Commit: hook.GetPullRequest().GetHead().GetSHA(),
|
Commit: hook.GetPullRequest().GetHead().GetSHA(),
|
||||||
Link: hook.GetPullRequest().GetHTMLURL(),
|
ForgeURL: hook.GetPullRequest().GetHTMLURL(),
|
||||||
Ref: fmt.Sprintf(headRefs, hook.GetPullRequest().GetNumber()),
|
Ref: fmt.Sprintf(headRefs, hook.GetPullRequest().GetNumber()),
|
||||||
Branch: hook.GetPullRequest().GetBase().GetRef(),
|
Branch: hook.GetPullRequest().GetBase().GetRef(),
|
||||||
Message: hook.GetPullRequest().GetTitle(),
|
Message: hook.GetPullRequest().GetTitle(),
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (g *GitLab) convertGitLabRepo(_repo *gitlab.Project) (*model.Repo, error) {
|
||||||
Name: name,
|
Name: name,
|
||||||
FullName: _repo.PathWithNamespace,
|
FullName: _repo.PathWithNamespace,
|
||||||
Avatar: _repo.AvatarURL,
|
Avatar: _repo.AvatarURL,
|
||||||
Link: _repo.WebURL,
|
ForgeURL: _repo.WebURL,
|
||||||
Clone: _repo.HTTPURLToRepo,
|
Clone: _repo.HTTPURLToRepo,
|
||||||
CloneSSH: _repo.SSHURLToRepo,
|
CloneSSH: _repo.SSHURLToRepo,
|
||||||
Branch: _repo.DefaultBranch,
|
Branch: _repo.DefaultBranch,
|
||||||
|
@ -90,7 +90,7 @@ func convertMergeRequestHook(hook *gitlab.MergeEvent, req *http.Request) (int, *
|
||||||
}
|
}
|
||||||
|
|
||||||
repo.ForgeRemoteID = model.ForgeRemoteID(fmt.Sprint(obj.TargetProjectID))
|
repo.ForgeRemoteID = model.ForgeRemoteID(fmt.Sprint(obj.TargetProjectID))
|
||||||
repo.Link = target.WebURL
|
repo.ForgeURL = target.WebURL
|
||||||
|
|
||||||
if target.GitHTTPURL != "" {
|
if target.GitHTTPURL != "" {
|
||||||
repo.Clone = target.GitHTTPURL
|
repo.Clone = target.GitHTTPURL
|
||||||
|
@ -130,7 +130,7 @@ func convertMergeRequestHook(hook *gitlab.MergeEvent, req *http.Request) (int, *
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline.Title = obj.Title
|
pipeline.Title = obj.Title
|
||||||
pipeline.Link = obj.URL
|
pipeline.ForgeURL = obj.URL
|
||||||
pipeline.PullRequestLabels = convertLabels(hook.Labels)
|
pipeline.PullRequestLabels = convertLabels(hook.Labels)
|
||||||
|
|
||||||
return obj.IID, repo, pipeline, nil
|
return obj.IID, repo, pipeline, nil
|
||||||
|
@ -147,7 +147,7 @@ func convertPushHook(hook *gitlab.PushEvent) (*model.Repo, *model.Pipeline, erro
|
||||||
|
|
||||||
repo.ForgeRemoteID = model.ForgeRemoteID(fmt.Sprint(hook.ProjectID))
|
repo.ForgeRemoteID = model.ForgeRemoteID(fmt.Sprint(hook.ProjectID))
|
||||||
repo.Avatar = hook.Project.AvatarURL
|
repo.Avatar = hook.Project.AvatarURL
|
||||||
repo.Link = hook.Project.WebURL
|
repo.ForgeURL = hook.Project.WebURL
|
||||||
repo.Clone = hook.Project.GitHTTPURL
|
repo.Clone = hook.Project.GitHTTPURL
|
||||||
repo.CloneSSH = hook.Project.GitSSHURL
|
repo.CloneSSH = hook.Project.GitSSHURL
|
||||||
repo.FullName = hook.Project.PathWithNamespace
|
repo.FullName = hook.Project.PathWithNamespace
|
||||||
|
@ -200,7 +200,7 @@ func convertTagHook(hook *gitlab.TagEvent) (*model.Repo, *model.Pipeline, error)
|
||||||
|
|
||||||
repo.ForgeRemoteID = model.ForgeRemoteID(fmt.Sprint(hook.ProjectID))
|
repo.ForgeRemoteID = model.ForgeRemoteID(fmt.Sprint(hook.ProjectID))
|
||||||
repo.Avatar = hook.Project.AvatarURL
|
repo.Avatar = hook.Project.AvatarURL
|
||||||
repo.Link = hook.Project.WebURL
|
repo.ForgeURL = hook.Project.WebURL
|
||||||
repo.Clone = hook.Project.GitHTTPURL
|
repo.Clone = hook.Project.GitHTTPURL
|
||||||
repo.CloneSSH = hook.Project.GitSSHURL
|
repo.CloneSSH = hook.Project.GitSSHURL
|
||||||
repo.FullName = hook.Project.PathWithNamespace
|
repo.FullName = hook.Project.PathWithNamespace
|
||||||
|
|
|
@ -410,7 +410,7 @@ func (g *GitLab) Status(ctx context.Context, user *model.User, repo *model.Repo,
|
||||||
_, _, err = client.Commits.SetCommitStatus(_repo.ID, pipeline.Commit, &gitlab.SetCommitStatusOptions{
|
_, _, err = client.Commits.SetCommitStatus(_repo.ID, pipeline.Commit, &gitlab.SetCommitStatusOptions{
|
||||||
State: getStatus(workflow.State),
|
State: getStatus(workflow.State),
|
||||||
Description: gitlab.String(common.GetPipelineStatusDescription(workflow.State)),
|
Description: gitlab.String(common.GetPipelineStatusDescription(workflow.State)),
|
||||||
TargetURL: gitlab.String(common.GetPipelineStatusLink(repo, pipeline, workflow)),
|
TargetURL: gitlab.String(common.GetPipelineStatusURL(repo, pipeline, workflow)),
|
||||||
Context: gitlab.String(common.GetPipelineStatusContext(repo, pipeline, workflow)),
|
Context: gitlab.String(common.GetPipelineStatusContext(repo, pipeline, workflow)),
|
||||||
}, gitlab.WithContext(ctx))
|
}, gitlab.WithContext(ctx))
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ type Pipeline struct {
|
||||||
Sender string `json:"sender" xorm:"pipeline_sender"` // uses reported user for webhooks and name of cron for cron pipelines
|
Sender string `json:"sender" xorm:"pipeline_sender"` // uses reported user for webhooks and name of cron for cron pipelines
|
||||||
Avatar string `json:"author_avatar" xorm:"pipeline_avatar"`
|
Avatar string `json:"author_avatar" xorm:"pipeline_avatar"`
|
||||||
Email string `json:"author_email" xorm:"pipeline_email"`
|
Email string `json:"author_email" xorm:"pipeline_email"`
|
||||||
Link string `json:"link_url" xorm:"pipeline_link"`
|
ForgeURL string `json:"forge_url" xorm:"pipeline_forge_url"`
|
||||||
Reviewer string `json:"reviewed_by" xorm:"pipeline_reviewer"`
|
Reviewer string `json:"reviewed_by" xorm:"pipeline_reviewer"`
|
||||||
Reviewed int64 `json:"reviewed_at" xorm:"pipeline_reviewed"`
|
Reviewed int64 `json:"reviewed_at" xorm:"pipeline_reviewed"`
|
||||||
Workflows []*Workflow `json:"workflows,omitempty" xorm:"-"`
|
Workflows []*Workflow `json:"workflows,omitempty" xorm:"-"`
|
||||||
|
|
|
@ -31,7 +31,7 @@ type Repo struct {
|
||||||
Name string `json:"name" xorm:"UNIQUE(name) 'repo_name'"`
|
Name string `json:"name" xorm:"UNIQUE(name) 'repo_name'"`
|
||||||
FullName string `json:"full_name" xorm:"UNIQUE 'repo_full_name'"`
|
FullName string `json:"full_name" xorm:"UNIQUE 'repo_full_name'"`
|
||||||
Avatar string `json:"avatar_url,omitempty" xorm:"varchar(500) 'repo_avatar'"`
|
Avatar string `json:"avatar_url,omitempty" xorm:"varchar(500) 'repo_avatar'"`
|
||||||
Link string `json:"link_url,omitempty" xorm:"varchar(1000) 'repo_link'"`
|
ForgeURL string `json:"forge_url,omitempty" xorm:"varchar(1000) 'repo_forge_url'"`
|
||||||
Clone string `json:"clone_url,omitempty" xorm:"varchar(1000) 'repo_clone'"`
|
Clone string `json:"clone_url,omitempty" xorm:"varchar(1000) 'repo_clone'"`
|
||||||
CloneSSH string `json:"clone_url_ssh" xorm:"varchar(1000) 'repo_clone_ssh'"`
|
CloneSSH string `json:"clone_url_ssh" xorm:"varchar(1000) 'repo_clone_ssh'"`
|
||||||
Branch string `json:"default_branch,omitempty" xorm:"varchar(500) 'repo_branch'"`
|
Branch string `json:"default_branch,omitempty" xorm:"varchar(500) 'repo_branch'"`
|
||||||
|
@ -83,7 +83,7 @@ func (r *Repo) Update(from *Repo) {
|
||||||
r.Name = from.Name
|
r.Name = from.Name
|
||||||
r.FullName = from.FullName
|
r.FullName = from.FullName
|
||||||
r.Avatar = from.Avatar
|
r.Avatar = from.Avatar
|
||||||
r.Link = from.Link
|
r.ForgeURL = from.ForgeURL
|
||||||
r.SCMKind = from.SCMKind
|
r.SCMKind = from.SCMKind
|
||||||
if len(from.Clone) > 0 {
|
if len(from.Clone) > 0 {
|
||||||
r.Clone = from.Clone
|
r.Clone = from.Clone
|
||||||
|
|
|
@ -74,7 +74,7 @@ func parsePipeline(store store.Store, currentPipeline *model.Pipeline, user *mod
|
||||||
Secs: secs,
|
Secs: secs,
|
||||||
Regs: regs,
|
Regs: regs,
|
||||||
Envs: envs,
|
Envs: envs,
|
||||||
Link: server.Config.Server.Host,
|
Host: server.Config.Server.Host,
|
||||||
Yamls: yamls,
|
Yamls: yamls,
|
||||||
Forge: server.Config.Services.Forge,
|
Forge: server.Config.Services.Forge,
|
||||||
ProxyOpts: compiler.ProxyOptions{
|
ProxyOpts: compiler.ProxyOptions{
|
||||||
|
|
|
@ -36,6 +36,26 @@ func (oldSecret021) TableName() string {
|
||||||
return "secrets"
|
return "secrets"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type syncRepo021 struct {
|
||||||
|
OrgID int64 `json:"org_id" xorm:"repo_org_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName return database table name for xorm
|
||||||
|
func (syncRepo021) TableName() string {
|
||||||
|
return "repos"
|
||||||
|
}
|
||||||
|
|
||||||
|
type repo021 struct {
|
||||||
|
ID int64 `json:"id,omitempty" xorm:"pk autoincr 'repo_id'"`
|
||||||
|
OrgID int64 `json:"org_id" xorm:"repo_org_id"`
|
||||||
|
Owner string `json:"owner" xorm:"UNIQUE(name) 'repo_owner'"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName return database table name for xorm
|
||||||
|
func (repo021) TableName() string {
|
||||||
|
return "repos"
|
||||||
|
}
|
||||||
|
|
||||||
var addOrgs = task{
|
var addOrgs = task{
|
||||||
name: "add-orgs",
|
name: "add-orgs",
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -46,7 +66,7 @@ var addOrgs = task{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := sess.Sync(new(model.Org), new(model.Repo), new(model.User)); err != nil {
|
if err := sess.Sync(new(model.Org), new(syncRepo021), new(model.User)); err != nil {
|
||||||
return fmt.Errorf("sync new models failed: %w", err)
|
return fmt.Errorf("sync new models failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +76,7 @@ var addOrgs = task{
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all org names from repos
|
// get all org names from repos
|
||||||
var repos []*model.Repo
|
var repos []*repo021
|
||||||
if err := sess.Find(&repos); err != nil {
|
if err := sess.Find(&repos); err != nil {
|
||||||
return fmt.Errorf("find all repos failed: %w", err)
|
return fmt.Errorf("find all repos failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
31
server/store/datastore/migration/027_link_to_url.go
Normal file
31
server/store/datastore/migration/027_link_to_url.go
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright 2023 Woodpecker Authors
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
package migration
|
||||||
|
|
||||||
|
import (
|
||||||
|
"xorm.io/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
var renameLinkToURL = task{
|
||||||
|
name: "rename-link-to-url",
|
||||||
|
required: true,
|
||||||
|
fn: func(sess *xorm.Session) (err error) {
|
||||||
|
if err := renameColumn(sess, "pipelines", "pipeline_link", "pipeline_forge_url"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return renameColumn(sess, "repos", "repo_link", "repo_forge_url")
|
||||||
|
},
|
||||||
|
}
|
|
@ -59,6 +59,7 @@ var migrationTasks = []*task{
|
||||||
&alterTableConfigUpdateColumnConfigDataType,
|
&alterTableConfigUpdateColumnConfigDataType,
|
||||||
&removePluginOnlyOptionFromSecretsTable,
|
&removePluginOnlyOptionFromSecretsTable,
|
||||||
&convertToNewPipelineErrorFormat,
|
&convertToNewPipelineErrorFormat,
|
||||||
|
&renameLinkToURL,
|
||||||
}
|
}
|
||||||
|
|
||||||
var allBeans = []any{
|
var allBeans = []any{
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<a
|
<a
|
||||||
v-if="pipeline.event === 'pull_request'"
|
v-if="pipeline.event === 'pull_request'"
|
||||||
class="flex items-center space-x-1 text-wp-link-100 hover:text-wp-link-200 min-w-0"
|
class="flex items-center space-x-1 text-wp-link-100 hover:text-wp-link-200 min-w-0"
|
||||||
:href="pipeline.link_url"
|
:href="pipeline.forge_url"
|
||||||
>
|
>
|
||||||
<Icon name="pull_request" />
|
<Icon name="pull_request" />
|
||||||
<span class="truncate">{{ prettyRef }}</span>
|
<span class="truncate">{{ prettyRef }}</span>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
<a
|
<a
|
||||||
v-else
|
v-else
|
||||||
class="text-wp-link-100 hover:text-wp-link-200 flex items-center"
|
class="text-wp-link-100 hover:text-wp-link-200 flex items-center"
|
||||||
:href="pipeline.link_url"
|
:href="pipeline.forge_url"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<Icon name="commit" />
|
<Icon name="commit" />
|
||||||
|
|
|
@ -76,9 +76,8 @@ export type Pipeline = {
|
||||||
// email for the author of the commit.
|
// email for the author of the commit.
|
||||||
author_email: string;
|
author_email: string;
|
||||||
|
|
||||||
// The link to view the repository.
|
// This url will point to the repository state associated with the pipeline's commit.
|
||||||
// This link will point to the repository state associated with the pipeline's commit.
|
forge_url: string;
|
||||||
link_url: string;
|
|
||||||
|
|
||||||
signed: boolean;
|
signed: boolean;
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ export type Repo = {
|
||||||
// The url for the avatar image.
|
// The url for the avatar image.
|
||||||
avatar_url: string;
|
avatar_url: string;
|
||||||
|
|
||||||
// The link to view the repository.
|
// The url to view the repository.
|
||||||
link_url: string;
|
forge_url: string;
|
||||||
|
|
||||||
// The url used to clone the repository.
|
// The url used to clone the repository.
|
||||||
clone_url: string;
|
clone_url: string;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<a v-if="badgeUrl" :href="badgeUrl" target="_blank">
|
<a v-if="badgeUrl" :href="badgeUrl" target="_blank">
|
||||||
<img :src="badgeUrl" />
|
<img :src="badgeUrl" />
|
||||||
</a>
|
</a>
|
||||||
<IconButton :href="repo.link_url" :title="$t('repo.open_in_forge')" :icon="forge ?? 'repo'" />
|
<IconButton :href="repo.forge_url" :title="$t('repo.open_in_forge')" :icon="forge ?? 'repo'" />
|
||||||
<IconButton
|
<IconButton
|
||||||
v-if="repoPermissions.admin"
|
v-if="repoPermissions.admin"
|
||||||
:to="{ name: 'repo-settings' }"
|
:to="{ name: 'repo-settings' }"
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
color="blue"
|
color="blue"
|
||||||
:start-icon="forge ?? 'repo'"
|
:start-icon="forge ?? 'repo'"
|
||||||
:text="$t('repo.pipeline.protected.review')"
|
:text="$t('repo.pipeline.protected.review')"
|
||||||
:to="pipeline.link_url"
|
:to="pipeline.forge_url"
|
||||||
:title="message"
|
:title="message"
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -33,7 +33,7 @@ type (
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
FullName string `json:"full_name"`
|
FullName string `json:"full_name"`
|
||||||
Avatar string `json:"avatar_url,omitempty"`
|
Avatar string `json:"avatar_url,omitempty"`
|
||||||
Link string `json:"link_url,omitempty"`
|
ForgeURL string `json:"forge_url,omitempty"`
|
||||||
Clone string `json:"clone_url,omitempty"`
|
Clone string `json:"clone_url,omitempty"`
|
||||||
DefaultBranch string `json:"default_branch,omitempty"`
|
DefaultBranch string `json:"default_branch,omitempty"`
|
||||||
SCMKind string `json:"scm,omitempty"`
|
SCMKind string `json:"scm,omitempty"`
|
||||||
|
@ -93,7 +93,7 @@ type (
|
||||||
Author string `json:"author"`
|
Author string `json:"author"`
|
||||||
Avatar string `json:"author_avatar"`
|
Avatar string `json:"author_avatar"`
|
||||||
Email string `json:"author_email"`
|
Email string `json:"author_email"`
|
||||||
Link string `json:"link_url"`
|
ForgeURL string `json:"forge_url"`
|
||||||
Reviewer string `json:"reviewed_by"`
|
Reviewer string `json:"reviewed_by"`
|
||||||
Reviewed int64 `json:"reviewed_at"`
|
Reviewed int64 `json:"reviewed_at"`
|
||||||
Workflows []*Workflow `json:"workflows,omitempty"`
|
Workflows []*Workflow `json:"workflows,omitempty"`
|
||||||
|
|
Loading…
Reference in a new issue