From 30c031631de07b31c4f7013370ac3ea6bb8b87e2 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Thu, 7 Dec 2023 10:45:09 +0000 Subject: [PATCH] Fix support for woodpecker 2.0.0 (#19) `_LINK` -> `_URL` Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/19 Reviewed-by: anbraten Co-authored-by: Lauris BH Co-committed-by: Lauris BH --- metadata_test.go | 14 +++++++------- pipeline.go | 1 + repo.go | 1 + system.go | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/metadata_test.go b/metadata_test.go index 389ae1c..5b2d248 100644 --- a/metadata_test.go +++ b/metadata_test.go @@ -32,8 +32,8 @@ func testMetadata() map[string]string { "CI_REPO_NAME": "woodpecker", "CI_REPO_OWNER": "woodpecker-ci", "CI_REPO_SCM": "git", - "CI_REPO_LINK": "https://github.com/woodpecker-ci/woodpecker", - "CI_REPO_CLONE_URL": "https://github.com/woodpecker-ci/woodpecker.git", + "CI_REPO_URL": "https://codeberg.org/woodpecker-plugins/go-plugin", + "CI_REPO_CLONE_URL": "https://codeberg.org/woodpecker-plugins/go-plugin.git", "CI_REPO_DEFAULT_BRANCH": "main", "CI_REPO_PRIVATE": "false", // Commit @@ -45,11 +45,11 @@ func testMetadata() map[string]string { "CI_COMMIT_AUTHOR": "John Doe", "CI_COMMIT_AUTHOR_EMAIL": "john@example.com", "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 "CI_PIPELINE_NUMBER": "1", "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_CREATED": "1611234567", "CI_PIPELINE_STARTED": "1611234567", @@ -60,7 +60,7 @@ func testMetadata() map[string]string { "CI_STEP_STARTED": "1611234567", // System "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_HOST": "woodpecker-ci.org", } @@ -82,8 +82,8 @@ func TestMetadata(t *testing.T) { // Repository assert.Equal(t, "woodpecker", plugin.Metadata.Repository.Name) 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://github.com/woodpecker-ci/woodpecker.git", plugin.Metadata.Repository.CloneURL) + assert.Equal(t, "https://codeberg.org/woodpecker-plugins/go-plugin", plugin.Metadata.Repository.Link) + assert.Equal(t, "https://codeberg.org/woodpecker-plugins/go-plugin.git", plugin.Metadata.Repository.CloneURL) assert.Equal(t, "main", plugin.Metadata.Repository.Branch) assert.False(t, plugin.Metadata.Repository.Private) diff --git a/pipeline.go b/pipeline.go index 5fcee9c..a6a7478 100644 --- a/pipeline.go +++ b/pipeline.go @@ -63,6 +63,7 @@ func pipelineFlags() []cli.Flag { Name: "pipeline.link", Usage: "pipeline link", EnvVars: []string{ + "CI_PIPELINE_URL", "CI_PIPELINE_LINK", "DRONE_BUILD_LINK", }, diff --git a/repo.go b/repo.go index 2f24d7f..0b4e1ef 100644 --- a/repo.go +++ b/repo.go @@ -50,6 +50,7 @@ func repositoryFlags() []cli.Flag { Name: "repo.link", Usage: "repo link", EnvVars: []string{ + "CI_REPO_URL", "CI_REPO_LINK", "DRONE_REPO_LINK", }, diff --git a/system.go b/system.go index 39615db..658e1ef 100644 --- a/system.go +++ b/system.go @@ -51,6 +51,7 @@ func systemFlags() []cli.Flag { Name: "system.link", Usage: "system link", EnvVars: []string{ + "CI_SYSTEM_URL", "CI_SYSTEM_LINK", }, },