mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Drop deprecated environment vars (#920)
This commit is contained in:
parent
4136df7551
commit
7cf5a1545e
2 changed files with 9 additions and 26 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue