Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .woodpecker.star
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ def dockerReleases(ctx):

def checkVersionPlaceholder():
return [{
"name": "check-version-placeholder",
"name": "check-version-placeholder-next",
"steps": [
{
"name": "check-version-placeholder",
Expand All @@ -1838,6 +1838,27 @@ def checkVersionPlaceholder():
"when": [
event["pull_request"],
],
},{
"name": "check-version-placeholder-next-production-release",
"steps": [
{
"name": "check-version-placeholder",
"image": OC_CI_ALPINE,
"commands": [
"grep -r -e '%%NEXT_PRODUCTION_VERSION%%' %s/services %s/pkg > next_production_version.txt || true" % (
dirs["base"],
dirs["base"],
),
'if [ -s next_production_version.txt ]; then echo "replace version placeholders"; cat next_production_version.txt; exit 1; fi',
],
},
],
"when": [
event["pull_request"],
{
"evaluate": 'CI_COMMIT_PULL_REQUEST_LABELS contains "production_release"',
},
Comment on lines +1857 to +1860
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work, because If at least one of the conditions in the when block evaluate to true the step is executed, otherwise it is skipped. see: https://woodpecker-ci.org/docs/usage/workflow-syntax#when---conditional-execution

Also, the linter shows a warning:
Image

A condition is evaluated to true if all sub-conditions are true.

Suggested change
event["pull_request"],
{
"evaluate": 'CI_COMMIT_PULL_REQUEST_LABELS contains "production_release"',
},
{
"event": "pull_request",
"evaluate": 'CI_COMMIT_PULL_REQUEST_LABELS contains "production_release"',
}

or

Suggested change
event["pull_request"],
{
"evaluate": 'CI_COMMIT_PULL_REQUEST_LABELS contains "production_release"',
},
{
"evaluate": CI_PIPELINE_EVENT == "pull_request" && CI_COMMIT_PULL_REQUEST_LABELS contains "production_release"',
},

],
}]

def dockerRelease(ctx, repo, build_type):
Expand Down