Skip to content

Commit

Permalink
support additional pipeline parameters in config validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kira-m committed Nov 8, 2024
1 parent 7ef8ef9 commit 178a54b
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
23 changes: 23 additions & 0 deletions config/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ func LocalPipelineValues(parameters Parameters) Values {
"pipeline.git.branch": git.Branch(),
"pipeline.git.revision": revision,
"pipeline.git.base_revision": revision,
"pipeline.git.branch.is_default": false,
"pipeline.trigger_parameters.circleci.event_time": "2020-01-01T00:00:00Z",
"pipeline.trigger_parameters.webhook.body": "",
"pipeline.trigger_parameters.github_app.branch": "main",
"pipeline.trigger_parameters.github_app.checkout_sha": revision,
"pipeline.trigger_parameters.github_app.commit_sha": revision,
"pipeline.trigger_parameters.github_app.commit_title": "",
"pipeline.trigger_parameters.github_app.commit_message": "",
"pipeline.trigger_parameters.github_app.commit_timestamp": "2020-01-01T00:00:00Z",
"pipeline.trigger_parameters.github_app.commit_author_name": "",
"pipeline.trigger_parameters.github_app.ref": "refs/heads/master",
"pipeline.trigger_parameters.github_app.repo_name": "",
"pipeline.trigger_parameters.github_app.repo_url": "",
"pipeline.trigger_parameters.github_app.total_commits_count": 1,
"pipeline.trigger_parameters.github_app.user_avatar": "",
"pipeline.trigger_parameters.github_app.user_id": "00000000-0000-0000-0000-000000000001",
"pipeline.trigger_parameters.github_app.user_name": "",
"pipeline.trigger_parameters.github_app.user_username": "",
"pipeline.trigger_parameters.github_app.web_url": "",
"pipeline.trigger_parameters.gitlab.commit_sha": revision,
"pipeline.trigger_parameters.gitlab.default_branch": "main",
"pipeline.trigger_parameters.gitlab.x_gitlab_event_id": "00000000-0000-0000-0000-000000000001",
"pipeline.trigger_parameters.gitlab.is_fork_merge_request": false,
}

for k, v := range parameters {
Expand Down
48 changes: 48 additions & 0 deletions config/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,31 @@ func TestLocalPipelineValues(t *testing.T) {
"pipeline.git.branch",
"pipeline.git.revision",
"pipeline.git.base_revision",
"pipeline.parameters.foo",
"pipeline.parameters.baz",
"pipeline.git.branch.is_default",
"pipeline.trigger_parameters.circleci.event_time",
"pipeline.trigger_parameters.webhook.body",
"pipeline.trigger_parameters.github_app.branch",
"pipeline.trigger_parameters.github_app.checkout_sha",
"pipeline.trigger_parameters.github_app.commit_sha",
"pipeline.trigger_parameters.github_app.commit_title",
"pipeline.trigger_parameters.github_app.commit_message",
"pipeline.trigger_parameters.github_app.commit_timestamp",
"pipeline.trigger_parameters.github_app.commit_author_name",
"pipeline.trigger_parameters.github_app.ref",
"pipeline.trigger_parameters.github_app.repo_name",
"pipeline.trigger_parameters.github_app.repo_url",
"pipeline.trigger_parameters.github_app.total_commits_count",
"pipeline.trigger_parameters.github_app.user_avatar",
"pipeline.trigger_parameters.github_app.user_id",
"pipeline.trigger_parameters.github_app.user_name",
"pipeline.trigger_parameters.github_app.user_username",
"pipeline.trigger_parameters.github_app.web_url",
"pipeline.trigger_parameters.gitlab.commit_sha",
"pipeline.trigger_parameters.gitlab.default_branch",
"pipeline.trigger_parameters.gitlab.x_gitlab_event_id",
"pipeline.trigger_parameters.gitlab.is_fork_merge_request",
},
},
{
Expand All @@ -41,6 +66,29 @@ func TestLocalPipelineValues(t *testing.T) {
"pipeline.git.base_revision",
"pipeline.parameters.foo",
"pipeline.parameters.baz",
"pipeline.git.branch.is_default",
"pipeline.trigger_parameters.circleci.event_time",
"pipeline.trigger_parameters.webhook.body",
"pipeline.trigger_parameters.github_app.branch",
"pipeline.trigger_parameters.github_app.checkout_sha",
"pipeline.trigger_parameters.github_app.commit_sha",
"pipeline.trigger_parameters.github_app.commit_title",
"pipeline.trigger_parameters.github_app.commit_message",
"pipeline.trigger_parameters.github_app.commit_timestamp",
"pipeline.trigger_parameters.github_app.commit_author_name",
"pipeline.trigger_parameters.github_app.ref",
"pipeline.trigger_parameters.github_app.repo_name",
"pipeline.trigger_parameters.github_app.repo_url",
"pipeline.trigger_parameters.github_app.total_commits_count",
"pipeline.trigger_parameters.github_app.user_avatar",
"pipeline.trigger_parameters.github_app.user_id",
"pipeline.trigger_parameters.github_app.user_name",
"pipeline.trigger_parameters.github_app.user_username",
"pipeline.trigger_parameters.github_app.web_url",
"pipeline.trigger_parameters.gitlab.commit_sha",
"pipeline.trigger_parameters.gitlab.default_branch",
"pipeline.trigger_parameters.gitlab.x_gitlab_event_id",
"pipeline.trigger_parameters.gitlab.is_fork_merge_request",
},
},
}
Expand Down

0 comments on commit 178a54b

Please sign in to comment.