From 7cf5a1545e85db55eb121abde2da2240880b211e Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 17 May 2022 17:26:35 +0200 Subject: [PATCH] Drop deprecated environment vars (#920) --- pipeline/frontend/metadata.go | 20 -------------------- pipeline/frontend/yaml/compiler/compiler.go | 15 +++++++++------ 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/pipeline/frontend/metadata.go b/pipeline/frontend/metadata.go index 619f74f89..73424f26a 100644 --- a/pipeline/frontend/metadata.go +++ b/pipeline/frontend/metadata.go @@ -184,32 +184,12 @@ func (m *Metadata) Environ() map[string]string { "CI_SYSTEM_HOST": m.Sys.Host, "CI_SYSTEM_ARCH": m.Sys.Arch, "CI_SYSTEM_VERSION": version.Version, - - // TODO drop for v0.16.0 development - // DEPRECATED - "CI_ARCH": m.Sys.Arch, // use CI_SYSTEM_ARCH - "CI_COMMIT": m.Curr.Commit.Sha, // use CI_COMMIT_SHA - "CI_REMOTE_URL": m.Repo.Remote, // use CI_REPO_REMOTE - "CI_REPO_BRANCH": m.Repo.Branch, // use CI_REPO_DEFAULT_BRANCH - "CI_PARENT_BUILD_NUMBER": strconv.FormatInt(m.Curr.Parent, 10), // use CI_BUILD_PARENT - "CI_BUILD_TARGET": m.Curr.Target, // use CI_BUILD_DEPLOY_TARGET - "CI_DEPLOY_TO": m.Curr.Target, // use CI_BUILD_DEPLOY_TARGET - "CI_COMMIT_AUTHOR_NAME": m.Curr.Commit.Author.Name, // use CI_COMMIT_AUTHOR - "CI_PREV_COMMIT_AUTHOR_NAME": m.Prev.Commit.Author.Name, // use CI_PREV_COMMIT_AUTHOR - "CI_SYSTEM": m.Sys.Name, // use CI_SYSTEM_NAME - "CI_BRANCH": m.Curr.Commit.Branch, // use CI_COMMIT_BRANCH - "CI_SOURCE_BRANCH": sourceBranch, // use CI_COMMIT_SOURCE_BRANCH - "CI_TARGET_BRANCH": targetBranch, // use CI_COMMIT_TARGET_BRANCH - "CI_TAG": "", // use CI_COMMIT_TAG - "CI_PULL_REQUEST": "", // use CI_COMMIT_PULL_REQUEST } if m.Curr.Event == EventTag { params["CI_COMMIT_TAG"] = strings.TrimPrefix(m.Curr.Commit.Ref, "refs/tags/") - params["CI_TAG"] = params["CI_COMMIT_TAG"] } if m.Curr.Event == EventPull { params["CI_COMMIT_PULL_REQUEST"] = pullRegexp.FindString(m.Curr.Commit.Ref) - params["CI_PULL_REQUEST"] = params["CI_COMMIT_PULL_REQUEST"] } return params diff --git a/pipeline/frontend/yaml/compiler/compiler.go b/pipeline/frontend/yaml/compiler/compiler.go index 33a8e7bac..4e26739ad 100644 --- a/pipeline/frontend/yaml/compiler/compiler.go +++ b/pipeline/frontend/yaml/compiler/compiler.go @@ -20,6 +20,9 @@ const ( networkDriverNAT = "nat" networkDriverBridge = "bridge" + + nameServices = "services" + namePipeline = "pipeline" ) type Registry struct { @@ -165,16 +168,16 @@ func (c *Compiler) Compile(conf *yaml.Config) *backend.Config { // add services steps if len(conf.Services.Containers) != 0 { stage := new(backend.Stage) - stage.Name = fmt.Sprintf("%s_services", c.prefix) - stage.Alias = "services" + stage.Name = fmt.Sprintf("%s_%s", c.prefix, nameServices) + stage.Alias = nameServices for i, container := range conf.Services.Containers { if !container.Constraints.Match(c.metadata) { continue } - name := fmt.Sprintf("%s_services_%d", c.prefix, i) - step := c.createProcess(name, container, "services") + name := fmt.Sprintf("%s_%s_%d", c.prefix, nameServices, i) + step := c.createProcess(name, container, nameServices) stage.Steps = append(stage.Steps, step) } config.Stages = append(config.Stages, stage) @@ -203,7 +206,7 @@ func (c *Compiler) Compile(conf *yaml.Config) *backend.Config { } name := fmt.Sprintf("%s_step_%d", c.prefix, i) - step := c.createProcess(name, container, "pipeline") + step := c.createProcess(name, container, namePipeline) stage.Steps = append(stage.Steps, step) } @@ -230,7 +233,7 @@ func (c *Compiler) setupCache(conf *yaml.Config, ir *backend.Config) { } func (c *Compiler) setupCacheRebuild(conf *yaml.Config, ir *backend.Config) { - if c.local || len(conf.Cache) == 0 || c.metadata.Curr.Event != "push" || c.cacher == nil { + if c.local || len(conf.Cache) == 0 || c.metadata.Curr.Event != frontend.EventPush || c.cacher == nil { return } container := c.cacher.Rebuild(c.metadata.Repo.Name, c.metadata.Curr.Commit.Branch, conf.Cache)