mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-09-05 20:07:25 +00:00
Rename CI_COMMIT_PRERELEASE to CI_PIPELINE_RELEASE_PRE (#6794)
This commit is contained in:
+4
-2
@@ -328,9 +328,11 @@ var flags = []cli.Flag{
|
||||
Usage: "Set the metadata environment variable \"CI_COMMIT_PULL_REQUEST_DRAFT\".",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Sources: cli.EnvVars("CI_COMMIT_PRERELEASE"),
|
||||
// CI_COMMIT_PRERELEASE is kept as a deprecated alias.
|
||||
// TODO remove CI_COMMIT_PRERELEASE in next major
|
||||
Sources: cli.EnvVars("CI_PIPELINE_RELEASE_PRE", "CI_COMMIT_PRERELEASE"),
|
||||
Name: "commit-release-is-pre",
|
||||
Usage: "Set the metadata environment variable \"CI_COMMIT_PRERELEASE\".",
|
||||
Usage: "Set the metadata environment variable \"CI_PIPELINE_RELEASE_PRE\".",
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Sources: cli.EnvVars("CI_PREV_PIPELINE_NUMBER"),
|
||||
|
||||
@@ -80,7 +80,7 @@ This is the reference list of all environment variables available to your pipeli
|
||||
| `CI_COMMIT_TIMESTAMP` | commit UNIX timestamp | `1722617519` |
|
||||
| `CI_COMMIT_AUTHOR` | commit author username | `john-doe` |
|
||||
| `CI_COMMIT_AUTHOR_EMAIL` | commit author email address | `john-doe@example.com` |
|
||||
| `CI_COMMIT_PRERELEASE` | release is a pre-release (empty if event is not `release`) | `false` |
|
||||
| `CI_COMMIT_PRERELEASE` | release is a pre-release (empty if event is not `release`) — **deprecated**, use `CI_PIPELINE_RELEASE_PRE` | `false` |
|
||||
| | **Current pipeline** | |
|
||||
| `CI_PIPELINE_NUMBER` | pipeline number | `8` |
|
||||
| `CI_PIPELINE_PARENT` | number of parent pipeline | `0` |
|
||||
@@ -92,6 +92,7 @@ This is the reference list of all environment variables available to your pipeli
|
||||
| `CI_PIPELINE_DEPLOY_TARGET` | pipeline deploy target for `deployment` events | `production` |
|
||||
| `CI_PIPELINE_DEPLOY_TASK` | pipeline deploy task for `deployment` events | `migration` |
|
||||
| `CI_PIPELINE_RELEASE_TITLE` | release title (empty if event is not `release`) | `v1.10.3` |
|
||||
| `CI_PIPELINE_RELEASE_PRE` | release is a pre-release (empty if event is not `release`) | `false` |
|
||||
| `CI_PIPELINE_CREATED` | pipeline created UNIX timestamp | `1722617519` |
|
||||
| `CI_PIPELINE_STARTED` | pipeline started UNIX timestamp | `1722617519` |
|
||||
| `CI_PIPELINE_FILES` | changed files (empty if event is not `push` or `pull_request`), it is undefined if more than 500 files are touched | `[]`, `[".woodpecker.yml","README.md"]` |
|
||||
|
||||
@@ -10,6 +10,7 @@ To enhance the usability of Woodpecker and meet evolving security standards, occ
|
||||
|
||||
- (Kubernetes) Deprecated `step` label on pod in favor of new namespaced label `woodpecker-ci.org/step`. The `step` label will be removed in a future update.
|
||||
- deprecated `CI_COMMIT_AUTHOR_AVATAR` and `CI_PREV_COMMIT_AUTHOR_AVATAR` env vars in favor of `CI_PIPELINE_AVATAR` and `CI_PREV_PIPELINE_AVATAR`
|
||||
- deprecated `CI_COMMIT_PRERELEASE` env var in favor of `CI_PIPELINE_RELEASE_PRE`
|
||||
- deprecated `runs_on` workflow property in favor of `when.status`.
|
||||
|
||||
### API changes
|
||||
|
||||
@@ -105,6 +105,9 @@ func (m *Metadata) Environ() map[string]string {
|
||||
}
|
||||
if pipeline.Event == EventRelease {
|
||||
setNonEmptyEnvVar(params, "CI_PIPELINE_RELEASE_TITLE", pipeline.Release.Title)
|
||||
setNonEmptyEnvVar(params, "CI_PIPELINE_RELEASE_PRE", strconv.FormatBool(pipeline.Release.IsPrerelease))
|
||||
// Deprecated: use CI_PIPELINE_RELEASE_PRE instead.
|
||||
// TODO remove in next major
|
||||
setNonEmptyEnvVar(params, "CI_COMMIT_PRERELEASE", strconv.FormatBool(pipeline.Release.IsPrerelease))
|
||||
}
|
||||
if pipeline.Event.IsPull() {
|
||||
|
||||
@@ -48,7 +48,8 @@ func TestEnviron(t *testing.T) {
|
||||
assert.Equal(t, "release", envs["CI_PIPELINE_EVENT"])
|
||||
assert.Equal(t, "pull_request_metadata", envs["CI_PREV_PIPELINE_EVENT"])
|
||||
assert.Equal(t, "v1.2.3", envs["CI_PIPELINE_RELEASE_TITLE"])
|
||||
assert.Equal(t, "true", envs["CI_COMMIT_PRERELEASE"])
|
||||
assert.Equal(t, "true", envs["CI_PIPELINE_RELEASE_PRE"])
|
||||
assert.Equal(t, "true", envs["CI_COMMIT_PRERELEASE"]) // deprecated alias
|
||||
assert.Equal(t, "branch-a", envs["CI_PREV_COMMIT_SOURCE_BRANCH"])
|
||||
assert.Equal(t, "branch-b", envs["CI_PREV_COMMIT_TARGET_BRANCH"])
|
||||
assert.Equal(t, "[]", envs["CI_PIPELINE_FILES"])
|
||||
|
||||
@@ -359,6 +359,7 @@ var deprecatedEnvVars = []struct {
|
||||
replacement string
|
||||
re *regexp.Regexp
|
||||
}{
|
||||
{"CI_COMMIT_PRERELEASE", "CI_PIPELINE_RELEASE_PRE", deprecatedEnvVarRefRegexp("CI_COMMIT_PRERELEASE")},
|
||||
{"CI_COMMIT_AUTHOR_AVATAR", "CI_PIPELINE_AVATAR", deprecatedEnvVarRefRegexp("CI_COMMIT_AUTHOR_AVATAR")},
|
||||
{"CI_PREV_COMMIT_AUTHOR_AVATAR", "CI_PREV_PIPELINE_AVATAR", deprecatedEnvVarRefRegexp("CI_PREV_COMMIT_AUTHOR_AVATAR")},
|
||||
}
|
||||
|
||||
@@ -216,15 +216,16 @@ func TestDeprecations(t *testing.T) {
|
||||
from string
|
||||
want string // empty = expect no deprecation warning
|
||||
}{
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_COMMIT_AUTHOR_AVATAR"] } }`, want: "Usage of `CI_COMMIT_AUTHOR_AVATAR` is deprecated, use `CI_PIPELINE_AVATAR`"},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $$CI_COMMIT_AUTHOR_AVATAR"] } }`, want: "Usage of `CI_COMMIT_AUTHOR_AVATAR` is deprecated, use `CI_PIPELINE_AVATAR`"},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_COMMIT_PRERELEASE"] } }`, want: "Usage of `CI_COMMIT_PRERELEASE` is deprecated, use `CI_PIPELINE_RELEASE_PRE`"},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $$CI_COMMIT_PRERELEASE"] } }`, want: "Usage of `CI_COMMIT_PRERELEASE` is deprecated, use `CI_PIPELINE_RELEASE_PRE`"},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo ${CI_COMMIT_PRERELEASE}"] } }`, want: "Usage of `CI_COMMIT_PRERELEASE` is deprecated, use `CI_PIPELINE_RELEASE_PRE`"},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo ${CI_COMMIT_AUTHOR_AVATAR}"] } }`, want: "Usage of `CI_COMMIT_AUTHOR_AVATAR` is deprecated, use `CI_PIPELINE_AVATAR`"},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_PREV_COMMIT_AUTHOR_AVATAR"] } }`, want: "Usage of `CI_PREV_COMMIT_AUTHOR_AVATAR` is deprecated, use `CI_PREV_PIPELINE_AVATAR`"},
|
||||
// new names must not warn
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_PIPELINE_RELEASE_PRE"] } }`, want: ""},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_PIPELINE_AVATAR"] } }`, want: ""},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_PREV_PIPELINE_AVATAR"] } }`, want: ""},
|
||||
// must not match a longer var name
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_COMMIT_AUTHOR_AVATAR_FOO"] } }`, want: ""},
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_COMMIT_PRERELEASE_FOO"] } }`, want: ""},
|
||||
// CI_COMMIT_AUTHOR_AVATAR regexp must not fire on CI_PREV_COMMIT_AUTHOR_AVATAR only
|
||||
{from: `steps: { build: { image: golang, commands: ["echo $CI_PREV_COMMIT_AUTHOR_AVATAR"] } }`, want: "Usage of `CI_PREV_COMMIT_AUTHOR_AVATAR` is deprecated, use `CI_PREV_PIPELINE_AVATAR`"},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user