You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -257,6 +261,7 @@ test_is_trusted_task_with_rules if {
257
261
{"name": "kind", "value": "task"},
258
262
]}}}
259
263
not tekton.is_trusted_task(deny_constrained_task_denied_version) with data.rule_data.trusted_task_rules as trusted_task_rules # regal ignore:line-length
264
+
with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "1.5"}}
260
265
261
266
# Task not satisfying any deny rule version constraints should not be denied
@@ -281,6 +288,27 @@ test_is_trusted_task_with_rules if {
281
288
{"name": "kind", "value": "task"},
282
289
]}}}
283
290
not tekton.is_trusted_task(allow_constrained_task_denied_version) with data.rule_data.trusted_task_rules as trusted_task_rules # regal ignore:line-length
291
+
with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "1.2.3"}}
292
+
293
+
# Task with mismatching versions between ref and manifest annotations.
294
+
# Only the manifest annotation is taken into consideration
not tekton.is_trusted_task(allow_constrained_task_denied_version_mismatching_1) with data.rule_data.trusted_task_rules as trusted_task_rules # regal ignore:line-length
301
+
with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "1.2.3"}}
302
+
303
+
# Task with mismatching versions between ref and manifest annotations.
304
+
# Only the manifest annotation is taken into consideration
tekton.is_trusted_task(allow_constrained_task_denied_version_mismatching_2) with data.rule_data.trusted_task_rules as trusted_task_rules # regal ignore:line-length
311
+
with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "1.5"}}
tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">=1.1", "<3"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "1.2.3"}} # regal ignore:line-length
897
+
tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">=1.1", "<3"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "1.1.0"}} # regal ignore:line-length
898
+
tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">1.1", "<3"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v1.1.1"}} # regal ignore:line-length
899
+
tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">1.1", "<=3"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v3.0.0"}} # regal ignore:line-length
872
900
873
901
# Version doesn't match all the constraints
874
-
not tekton._version_satisfies_all_rule_constraints({"tagged_ref": "v1.5.0"}, {"versions": [">=2"]})
875
-
not tekton._version_satisfies_all_rule_constraints({"tagged_ref": "v1.1.0"}, {"versions": [">1.1", "<3"]})
876
-
not tekton._version_satisfies_all_rule_constraints({"tagged_ref": "v3.0.0"}, {"versions": [">1.1", "<3"]})
877
-
not tekton._version_satisfies_all_rule_constraints({"tagged_ref": "v1.5.0"}, {"versions": ["<2", ">=1.5.1"]})
902
+
not tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">=2"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v1.5.0"}} # regal ignore:line-length
903
+
not tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">1.1", "<3"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v1.1.0"}} # regal ignore:line-length
904
+
not tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">1.1", "<3"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v3.0.0"}} # regal ignore:line-length
905
+
not tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": ["<2", ">=1.5.1"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v1.5.0"}} # regal ignore:line-length
878
906
879
907
# Invalid inputs - should fail
880
-
not tekton._version_satisfies_all_rule_constraints({}, {"versions": [">=2"]})
881
-
not tekton._version_satisfies_all_rule_constraints({"tagged_ref": "latest"}, {"versions": [">=2"]})
908
+
not tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">=2"]}) with ec.oci.image_manifest as {"annotations": {}} # regal ignore:line-length
909
+
not tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">=2"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "invalid"}} # regal ignore:line-length
882
910
}
883
911
884
912
test_version_satisfies_any_rule_constraints if {
885
913
# No version constraints in rule - should always pass
tekton._version_satisfies_any_rule_constraints({"key": "taskref"}, {"versions": [">1.1", "<3"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v1.1.0"}} # regal ignore:line-length
924
+
tekton._version_satisfies_any_rule_constraints({"key": "taskref"}, {"versions": [">1.1", "<3"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v3.0.0"}} # regal ignore:line-length
897
925
898
926
# Version doesn't match any constraint
899
-
not tekton._version_satisfies_all_rule_constraints({"tagged_ref": "v1.5.0"}, {"versions": [">=2"]})
900
-
not tekton._version_satisfies_any_rule_constraints({"tagged_ref": "v1.5.0"}, {"versions": ["<1", ">=1.5.1"]})
927
+
not tekton._version_satisfies_all_rule_constraints({"key": "taskref"}, {"versions": [">=2"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v1.5.0"}} # regal ignore:line-length
928
+
not tekton._version_satisfies_any_rule_constraints({"key": "taskref"}, {"versions": ["<1", ">=1.5.1"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "v1.5.0"}} # regal ignore:line-length
901
929
902
930
# Invalid inputs - should fail
903
-
not tekton._version_satisfies_any_rule_constraints({}, {"versions": [">=2"]})
904
-
not tekton._version_satisfies_any_rule_constraints({"tagged_ref": "latest"}, {"versions": [">=2"]})
931
+
not tekton._version_satisfies_any_rule_constraints({"key": "taskref"}, {"versions": [">=2"]}) with ec.oci.image_manifest as {"annotations": {}} # regal ignore:line-length
932
+
not tekton._version_satisfies_any_rule_constraints({"key": "taskref"}, {"versions": [">=2"]}) with ec.oci.image_manifest as {"annotations": {"org.opencontainers.image.version": "invalid"}} # regal ignore:line-length
0 commit comments