Skip to content

Commit 9efbcef

Browse files
set empty string as defaults for codefresh's optional fields (#1777)
* set empty string as defaults for codefresh's optional fields Signed-off-by: Javan lacerda <[email protected]> * adding test case for empty default value Signed-off-by: Javan lacerda <[email protected]> * Require account_name and pipeline_name Always present in token Signed-off-by: Hayden B <[email protected]> --------- Signed-off-by: Javan lacerda <[email protected]> Signed-off-by: Hayden B <[email protected]> Co-authored-by: Hayden B <[email protected]>
1 parent 37a04a5 commit 9efbcef

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

config/identity/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ ci-issuer-metadata:
203203
# for cases that the claimed data doesn't exist.
204204
# platform_url: Codefresh platform url
205205
platform_url: "https://g.codefresh.io"
206+
scm_repo_url: ""
207+
scm_ref: ""
208+
runner_environment: ""
206209
extension-templates:
207210
# workflow_id: The ID of the specific workflow authorized in the claim.
208211
# For example, 64f447c02199f903000gh20.

pkg/identity/ciprovider/principal_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ func TestApplyTemplateOrReplace(t *testing.T) {
247247
"url": "https://github.com",
248248
"claim_foo": "default",
249249
"default_foo": "default_bar",
250+
"empty_value": "",
250251
}
251252

252253
tests := map[string]struct {
@@ -309,6 +310,11 @@ func TestApplyTemplateOrReplace(t *testing.T) {
309310
ExpectedResult: "bar",
310311
ExpectErr: false,
311312
},
313+
`Should return empty string for empty default`: {
314+
Template: "{{ .empty_value }}/123",
315+
ExpectedResult: "/123",
316+
ExpectErr: false,
317+
},
312318
}
313319

314320
for name, test := range tests {

0 commit comments

Comments
 (0)