Fix support for woodpecker 2.0.0 (#19)

`_LINK` -> `_URL`

Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/19
Reviewed-by: anbraten <anbraten@noreply.codeberg.org>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-committed-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
Lauris BH 2023-12-07 10:45:09 +00:00 committed by Lauris BH
parent f02d9dcbb4
commit 30c031631d
4 changed files with 10 additions and 7 deletions

View File

@ -32,8 +32,8 @@ func testMetadata() map[string]string {
"CI_REPO_NAME": "woodpecker", "CI_REPO_NAME": "woodpecker",
"CI_REPO_OWNER": "woodpecker-ci", "CI_REPO_OWNER": "woodpecker-ci",
"CI_REPO_SCM": "git", "CI_REPO_SCM": "git",
"CI_REPO_LINK": "https://github.com/woodpecker-ci/woodpecker", "CI_REPO_URL": "https://codeberg.org/woodpecker-plugins/go-plugin",
"CI_REPO_CLONE_URL": "https://github.com/woodpecker-ci/woodpecker.git", "CI_REPO_CLONE_URL": "https://codeberg.org/woodpecker-plugins/go-plugin.git",
"CI_REPO_DEFAULT_BRANCH": "main", "CI_REPO_DEFAULT_BRANCH": "main",
"CI_REPO_PRIVATE": "false", "CI_REPO_PRIVATE": "false",
// Commit // Commit
@ -45,11 +45,11 @@ func testMetadata() map[string]string {
"CI_COMMIT_AUTHOR": "John Doe", "CI_COMMIT_AUTHOR": "John Doe",
"CI_COMMIT_AUTHOR_EMAIL": "john@example.com", "CI_COMMIT_AUTHOR_EMAIL": "john@example.com",
"CI_COMMIT_AUTHOR_AVATAR": "https://avatars.githubusercontent.com/u/1234567?v=4", "CI_COMMIT_AUTHOR_AVATAR": "https://avatars.githubusercontent.com/u/1234567?v=4",
"CI_COMMIT_LINK": "https://github.com/woodpecker-ci/woodpecker/commit/a1b2c3d4", "CI_COMMIT_URL": "https://codeberg.org/woodpecker-plugins/go-plugin/commit/a1b2c3d4",
// Build // Build
"CI_PIPELINE_NUMBER": "1", "CI_PIPELINE_NUMBER": "1",
"CI_PIPELINE_EVENT": "push", "CI_PIPELINE_EVENT": "push",
"CI_PIPELINE_LINK": "https://ci.woodpecker-ci.org/woodpecker-ci/woodpecker/1", "CI_PIPELINE_URL": "https://ci.woodpecker-ci.org/woodpecker-ci/woodpecker/1",
"CI_PIPELINE_STATUS": "running", "CI_PIPELINE_STATUS": "running",
"CI_PIPELINE_CREATED": "1611234567", "CI_PIPELINE_CREATED": "1611234567",
"CI_PIPELINE_STARTED": "1611234567", "CI_PIPELINE_STARTED": "1611234567",
@ -60,7 +60,7 @@ func testMetadata() map[string]string {
"CI_STEP_STARTED": "1611234567", "CI_STEP_STARTED": "1611234567",
// System // System
"CI_SYSTEM_NAME": "woodpecker", "CI_SYSTEM_NAME": "woodpecker",
"CI_SYSTEM_LINK": "https://ci.woodpecker-ci.org", "CI_SYSTEM_URL": "https://ci.woodpecker-ci.org",
"CI_SYSTEM_VERSION": "1.0.0", "CI_SYSTEM_VERSION": "1.0.0",
"CI_SYSTEM_HOST": "woodpecker-ci.org", "CI_SYSTEM_HOST": "woodpecker-ci.org",
} }
@ -82,8 +82,8 @@ func TestMetadata(t *testing.T) {
// Repository // Repository
assert.Equal(t, "woodpecker", plugin.Metadata.Repository.Name) assert.Equal(t, "woodpecker", plugin.Metadata.Repository.Name)
assert.Equal(t, "woodpecker-ci", plugin.Metadata.Repository.Owner) assert.Equal(t, "woodpecker-ci", plugin.Metadata.Repository.Owner)
assert.Equal(t, "https://github.com/woodpecker-ci/woodpecker", plugin.Metadata.Repository.Link) assert.Equal(t, "https://codeberg.org/woodpecker-plugins/go-plugin", plugin.Metadata.Repository.Link)
assert.Equal(t, "https://github.com/woodpecker-ci/woodpecker.git", plugin.Metadata.Repository.CloneURL) assert.Equal(t, "https://codeberg.org/woodpecker-plugins/go-plugin.git", plugin.Metadata.Repository.CloneURL)
assert.Equal(t, "main", plugin.Metadata.Repository.Branch) assert.Equal(t, "main", plugin.Metadata.Repository.Branch)
assert.False(t, plugin.Metadata.Repository.Private) assert.False(t, plugin.Metadata.Repository.Private)

View File

@ -63,6 +63,7 @@ func pipelineFlags() []cli.Flag {
Name: "pipeline.link", Name: "pipeline.link",
Usage: "pipeline link", Usage: "pipeline link",
EnvVars: []string{ EnvVars: []string{
"CI_PIPELINE_URL",
"CI_PIPELINE_LINK", "CI_PIPELINE_LINK",
"DRONE_BUILD_LINK", "DRONE_BUILD_LINK",
}, },

View File

@ -50,6 +50,7 @@ func repositoryFlags() []cli.Flag {
Name: "repo.link", Name: "repo.link",
Usage: "repo link", Usage: "repo link",
EnvVars: []string{ EnvVars: []string{
"CI_REPO_URL",
"CI_REPO_LINK", "CI_REPO_LINK",
"DRONE_REPO_LINK", "DRONE_REPO_LINK",
}, },

View File

@ -51,6 +51,7 @@ func systemFlags() []cli.Flag {
Name: "system.link", Name: "system.link",
Usage: "system link", Usage: "system link",
EnvVars: []string{ EnvVars: []string{
"CI_SYSTEM_URL",
"CI_SYSTEM_LINK", "CI_SYSTEM_LINK",
}, },
}, },