From 7c3ed98b566ae38ac20f15f471957954d9925c6d Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 16 Aug 2023 08:36:06 +0200 Subject: [PATCH] fix: fix env vars to fetch metadata urls (#14) --- plugin/pipeline.go | 2 +- plugin/repo.go | 10 +++++++++- plugin/system.go | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugin/pipeline.go b/plugin/pipeline.go index 8aa0d43..fe19b5e 100644 --- a/plugin/pipeline.go +++ b/plugin/pipeline.go @@ -56,7 +56,7 @@ func pipelineFlags(category string) []cli.Flag { &cli.StringFlag{ Name: "pipeline.link", Usage: "pipeline link", - EnvVars: []string{"CI_PIPELINE_LINK"}, + EnvVars: []string{"CI_PIPELINE_URL"}, Category: category, }, &cli.StringFlag{ diff --git a/plugin/repo.go b/plugin/repo.go index 77e22b6..35d8c42 100644 --- a/plugin/repo.go +++ b/plugin/repo.go @@ -20,6 +20,7 @@ import ( // Repository defines runtime metadata for a repository. type Repository struct { + Slug string `json:"slug,omitempty"` Name string `json:"name,omitempty"` Owner string `json:"owner,omitempty"` Link string `json:"link,omitempty"` @@ -30,6 +31,12 @@ type Repository struct { func repositoryFlags(category string) []cli.Flag { return []cli.Flag{ + &cli.StringFlag{ + Name: "repo.slug", + Usage: "repo slug", + EnvVars: []string{"CI_REPO"}, + Category: category, + }, &cli.StringFlag{ Name: "repo.name", Usage: "repo name", @@ -45,7 +52,7 @@ func repositoryFlags(category string) []cli.Flag { &cli.StringFlag{ Name: "repo.link", Usage: "repo link", - EnvVars: []string{"CI_REPO_LINK"}, + EnvVars: []string{"CI_REPO_URL"}, Category: category, }, &cli.StringFlag{ @@ -71,6 +78,7 @@ func repositoryFlags(category string) []cli.Flag { func repositoryFromContext(c *cli.Context) Repository { return Repository{ + Slug: c.String("repo.slug"), Name: c.String("repo.name"), Owner: c.String("repo.owner"), Link: c.String("repo.link"), diff --git a/plugin/system.go b/plugin/system.go index 3f1ee1d..08d4118 100644 --- a/plugin/system.go +++ b/plugin/system.go @@ -44,7 +44,7 @@ func systemFlags(category string) []cli.Flag { &cli.StringFlag{ Name: "system.link", Usage: "system link", - EnvVars: []string{"CI_SYSTEM_LINK"}, + EnvVars: []string{"CI_SYSTEM_URL"}, Category: category, }, &cli.StringFlag{