@@ -318,3 +318,121 @@ Feature: Verify Enterprise Contract Tekton Tasks
318318 Then the task should succeed
319319 And the task logs for step "detailed-report" should match the snapshot
320320 And the task results should match the snapshot
321+
322+ Scenario : Collect keyless signing parameters from ConfigMap
323+ Given a working namespace
324+ And a namespace named "konflux-info" exists
325+ # Note: These scenarios might run in parallel so let's use a different config map
326+ # for each scenario so we don't have to worry about them clashing with each other
327+ And a ConfigMap "cluster-config" in namespace "konflux-info" with content:
328+ """
329+ {
330+ "defaultOIDCIssuer": "https://kubernetes.default.svc.cluster.local",
331+ "rekorExternalUrl": "https://rekor.example.com",
332+ "fulcioExternalUrl": "https://fulcio.example.com",
333+ "tufExternalUrl": "https://tuf.example.com",
334+ "buildIdentity": "https://kubernetes.io/namespaces/openshift-pipelines/serviceaccounts/tekton-chains-controller",
335+ "buildIdentityRegexp": "^https://konflux-ci.dev/.*$",
336+ "enableKeylessSigning": "true"
337+ }
338+ """
339+ When version 0.1 of the task named "collect-keyless-signing-params" is run with parameters:
340+ | configMapName | cluster -config |
341+ Then the task should succeed
342+ And the task logs for step "collect-signing-params" should match the snapshot
343+ And the task result "defaultOIDCIssuer" should equal "https://kubernetes.default.svc.cluster.local"
344+ And the task result "rekorExternalUrl" should equal "https://rekor.example.com"
345+ And the task result "fulcioExternalUrl" should equal "https://fulcio.example.com"
346+ And the task result "tufExternalUrl" should equal "https://tuf.example.com"
347+ And the task result "buildIdentity" should equal "https://kubernetes.io/namespaces/openshift-pipelines/serviceaccounts/tekton-chains-controller"
348+ And the task result "buildIdentityRegexp" should equal "^https://konflux-ci.dev/.*$"
349+ And the task result "keylessSigningEnabled" should equal "true"
350+
351+ Scenario : Collect keyless signing parameters from ConfigMap with keyless signing disabled
352+ Given a working namespace
353+ And a namespace named "konflux-info" exists
354+ # Note: These scenarios might run in parallel so let's use a different config map
355+ # for each scenario so we don't have to worry about them clashing with each other
356+ And a ConfigMap "cluster-config-2" in namespace "konflux-info" with content:
357+ """
358+ {
359+ "defaultOIDCIssuer": "https://kubernetes.default.svc.cluster.local",
360+ "rekorExternalUrl": "https://rekor.example.com",
361+ "fulcioExternalUrl": "https://fulcio.example.com",
362+ "tufExternalUrl": "https://tuf.example.com",
363+ "buildIdentity": "https://kubernetes.io/namespaces/openshift-pipelines/serviceaccounts/tekton-chains-controller",
364+ "buildIdentityRegexp": "^https://konflux-ci.dev/.*$",
365+ "enableKeylessSigning": "false"
366+ }
367+ """
368+ When version 0.1 of the task named "collect-keyless-signing-params" is run with parameters:
369+ | configMapName | cluster -config -2 |
370+ Then the task should succeed
371+ And the task logs for step "collect-signing-params" should match the snapshot
372+ And the task result "defaultOIDCIssuer" should equal ""
373+ And the task result "rekorExternalUrl" should equal ""
374+ And the task result "fulcioExternalUrl" should equal ""
375+ And the task result "tufExternalUrl" should equal ""
376+ And the task result "buildIdentity" should equal ""
377+ And the task result "buildIdentityRegexp" should equal ""
378+ And the task result "keylessSigningEnabled" should equal "false"
379+
380+ Scenario : Collect keyless signing parameters when there is a malformed ConfigMap
381+ Given a working namespace
382+ And a namespace named "konflux-info" exists
383+ # Note: These scenarios might run in parallel so let's use a different config map
384+ # for each scenario so we don't have to worry about them clashing with each other
385+ And a ConfigMap "cluster-config-3" in namespace "konflux-info" with content:
386+ """
387+ {"foo": "bar"}
388+ """
389+ When version 0.1 of the task named "collect-keyless-signing-params" is run with parameters:
390+ | configMapName | cluster -config -3 |
391+ Then the task should succeed
392+ And the task logs for step "collect-signing-params" should match the snapshot
393+ And the task result "defaultOIDCIssuer" should equal ""
394+ And the task result "rekorExternalUrl" should equal ""
395+ And the task result "fulcioExternalUrl" should equal ""
396+ And the task result "tufExternalUrl" should equal ""
397+ And the task result "buildIdentity" should equal ""
398+ And the task result "buildIdentityRegexp" should equal ""
399+ And the task result "keylessSigningEnabled" should equal "false"
400+
401+ Scenario : Collect keyless signing parameters when the ConfigMap does not exist
402+ Given a working namespace
403+ And a namespace named "konflux-info" exists
404+ # Note: These scenarios might run in parallel so let's use a different config map
405+ # for each scenario so we don't have to worry about them clashing with each other.
406+ # Creating a config map deliberately so we are sure the rbac is created. (I might
407+ # be wrong but I think it could matter if this secenario runs before any of the
408+ # others.)
409+ And a ConfigMap "cluster-config-4" in namespace "konflux-info" with content:
410+ """
411+ {"foo": "bar"}
412+ """
413+ When version 0.1 of the task named "collect-keyless-signing-params" is run with parameters:
414+ | configMapNamespace | konflux -info |
415+ | configMapName | doesnt -exist -config |
416+ Then the task should succeed
417+ And the task logs for step "collect-signing-params" should match the snapshot
418+ And the task result "defaultOIDCIssuer" should equal ""
419+ And the task result "rekorExternalUrl" should equal ""
420+ And the task result "fulcioExternalUrl" should equal ""
421+ And the task result "tufExternalUrl" should equal ""
422+ And the task result "buildIdentityRegexp" should equal ""
423+ And the task result "keylessSigningEnabled" should equal "false"
424+
425+ Scenario : Collect keyless signing parameters when the namespace does not exist
426+ Given a working namespace
427+ When version 0.1 of the task named "collect-keyless-signing-params" is run with parameters:
428+ | configMapNamespace | doesnt -exist -namespace |
429+ | configMapName | whatever |
430+ Then the task should succeed
431+ And the task logs for step "collect-signing-params" should match the snapshot
432+ And the task result "defaultOIDCIssuer" should equal ""
433+ And the task result "rekorExternalUrl" should equal ""
434+ And the task result "fulcioExternalUrl" should equal ""
435+ And the task result "tufExternalUrl" should equal ""
436+ And the task result "buildIdentity" should equal ""
437+ And the task result "buildIdentityRegexp" should equal ""
438+ And the task result "keylessSigningEnabled" should equal "false"
0 commit comments