Skip to content

Commit

Permalink
set empty string as defaults for codefresh's optional fields (sigstor…
Browse files Browse the repository at this point in the history
…e#1777)

* set empty string as defaults for codefresh's optional fields

Signed-off-by: Javan lacerda <javanlacerda@google.com>

* adding test case for empty default value

Signed-off-by: Javan lacerda <javanlacerda@google.com>

* Require account_name and pipeline_name

Always present in token

Signed-off-by: Hayden B <hblauzvern@google.com>

---------

Signed-off-by: Javan lacerda <javanlacerda@google.com>
Signed-off-by: Hayden B <hblauzvern@google.com>
Co-authored-by: Hayden B <hblauzvern@google.com>
  • Loading branch information
javanlacerda and haydentherapper authored Aug 20, 2024
1 parent 37a04a5 commit 9efbcef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/identity/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ ci-issuer-metadata:
# for cases that the claimed data doesn't exist.
# platform_url: Codefresh platform url
platform_url: "https://g.codefresh.io"
scm_repo_url: ""
scm_ref: ""
runner_environment: ""
extension-templates:
# workflow_id: The ID of the specific workflow authorized in the claim.
# For example, 64f447c02199f903000gh20.
Expand Down
6 changes: 6 additions & 0 deletions pkg/identity/ciprovider/principal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func TestApplyTemplateOrReplace(t *testing.T) {
"url": "https://github.com",
"claim_foo": "default",
"default_foo": "default_bar",
"empty_value": "",
}

tests := map[string]struct {
Expand Down Expand Up @@ -309,6 +310,11 @@ func TestApplyTemplateOrReplace(t *testing.T) {
ExpectedResult: "bar",
ExpectErr: false,
},
`Should return empty string for empty default`: {
Template: "{{ .empty_value }}/123",
ExpectedResult: "/123",
ExpectErr: false,
},
}

for name, test := range tests {
Expand Down

0 comments on commit 9efbcef

Please sign in to comment.