3838 ),
3939 ("gitlab.com/foo/bar//a.yml@/some/ref" , "a.yml" ),
4040 ("gitlab.com/foo/bar//a/b.yml@/some/ref" , "a/b.yml" ),
41+ # Custom domain.
42+ ("gitlab.example.com/foo/bar//example.yml@/some/ref" , "example.yml" ),
4143 # Malformed `ci_config_ref_uri`s.
4244 ("gitlab.com/foo/bar//notnested.wrongsuffix@/some/ref" , None ),
4345 ("gitlab.com/foo/bar//@/some/ref" , None ),
@@ -59,6 +61,7 @@ class TestGitLabPublisher:
5961 @pytest .mark .parametrize ("environment" , [None , "some_environment" ])
6062 def test_lookup_fails_invalid_ci_config_ref_uri (self , environment ):
6163 signed_claims = {
64+ "iss" : "https://gitlab.com" ,
6265 "project_path" : "foo/bar" ,
6366 "ci_config_ref_uri" : ("gitlab.com/foo/bar//example/.yml@refs/heads/main" ),
6467 }
@@ -101,6 +104,7 @@ def test_lookup_succeeds_with_mixed_case_project_path(
101104 )
102105
103106 signed_claims = {
107+ "iss" : "https://gitlab.com" ,
104108 "project_path" : project_path ,
105109 "ci_config_ref_uri" : "gitlab.com/foo/bar//.gitlab-ci.yml@refs/heads/main" ,
106110 "environment" : "some_environment" ,
@@ -129,6 +133,7 @@ def test_lookup_succeeds_with_non_lowercase_environment(
129133 )
130134
131135 signed_claims = {
136+ "iss" : "https://gitlab.com" ,
132137 "project_path" : "foo/bar" ,
133138 "ci_config_ref_uri" : ("gitlab.com/foo/bar//.gitlab-ci.yml@refs/heads/main" ),
134139 "environment" : environment ,
@@ -157,6 +162,7 @@ def test_lookup_is_case_sensitive_for_environment(self, db_request, environment)
157162 )
158163
159164 signed_claims = {
165+ "iss" : "https://gitlab.com" ,
160166 "project_path" : "foo/bar" ,
161167 "ci_config_ref_uri" : ("gitlab.com/foo/bar//.gitlab-ci.yml@refs/heads/main" ),
162168 "environment" : environment ,
@@ -194,6 +200,7 @@ def test_lookup_escapes(
194200
195201 for workflow_filepath in (workflow_filepath_a , workflow_filepath_b ):
196202 signed_claims = {
203+ "iss" : "https://gitlab.com" ,
197204 "project_path" : "foo/bar" ,
198205 "ci_config_ref_uri" : (
199206 f"gitlab.com/foo/bar//{ workflow_filepath } @refs/heads/main"
@@ -212,6 +219,7 @@ def test_lookup_escapes(
212219
213220 def test_lookup_no_matching_publisher (self , db_request ):
214221 signed_claims = {
222+ "iss" : "https://gitlab.com" ,
215223 "project_path" : "foo/bar" ,
216224 "ci_config_ref_uri" : ("gitlab.com/foo/bar//.gitlab-ci.yml@refs/heads/main" ),
217225 }
@@ -272,6 +280,7 @@ def test_gitlab_publisher_computed_properties(self):
272280 namespace = "fakeowner" ,
273281 workflow_filepath = "subfolder/fakeworkflow.yml" ,
274282 environment = "fakeenv" ,
283+ issuer_url = "https://gitlab.com" ,
275284 )
276285
277286 for claim_name in publisher .__required_verifiable_claims__ .keys ():
@@ -359,6 +368,7 @@ def test_gitlab_publisher_missing_claims(self, monkeypatch, missing):
359368 project = "fakerepo" ,
360369 namespace = "fakeowner" ,
361370 workflow_filepath = "subfolder/fakeworkflow.yml" ,
371+ issuer_url = "https://gitlab.com" ,
362372 )
363373
364374 scope = pretend .stub ()
@@ -394,6 +404,7 @@ def test_gitlab_publisher_missing_optional_claims(self, monkeypatch):
394404 namespace = "fakeowner" ,
395405 workflow_filepath = "subfolder/fakeworkflow.yml" ,
396406 environment = "some-environment" , # The optional claim that should be present
407+ issuer_url = "https://gitlab.com" ,
397408 )
398409
399410 sentry_sdk = pretend .stub (capture_message = pretend .call_recorder (lambda s : None ))
@@ -429,6 +440,7 @@ def test_gitlab_publisher_verifies(self, monkeypatch, environment, missing_claim
429440 namespace = "fakeowner" ,
430441 workflow_filepath = "subfolder/fakeworkflow.yml" ,
431442 environment = "environment" ,
443+ issuer_url = "https://gitlab.com" ,
432444 )
433445
434446 noop_check = pretend .call_recorder (lambda gt , sc , ac , ** kwargs : True )
@@ -661,6 +673,7 @@ def test_gitlab_publisher_ci_config_ref_uri(
661673 project = "bar" ,
662674 namespace = "foo" ,
663675 workflow_filepath = "workflows/baz.yml" ,
676+ issuer_url = "https://gitlab.com" ,
664677 )
665678
666679 check = gitlab .GitLabPublisher .__required_verifiable_claims__ [
@@ -844,6 +857,7 @@ def test_gitlab_publisher_verify_url(
844857 namespace = namespace ,
845858 workflow_filepath = "workflow_filename.yml" ,
846859 environment = "" ,
860+ issuer_url = "https://gitlab.com" ,
847861 )
848862 assert publisher .verify_url (url ) == expected
849863
@@ -854,6 +868,7 @@ def test_gitlab_publisher_attestation_identity(self, environment):
854868 namespace = "group/subgroup" ,
855869 workflow_filepath = "workflow_filename.yml" ,
856870 environment = environment ,
871+ issuer_url = "https://gitlab.com" ,
857872 )
858873
859874 identity = publisher .attestation_identity
@@ -922,3 +937,13 @@ def test_reify_already_exists(self, db_request):
922937 # it is returned and the pending publisher is marked for deletion.
923938 assert existing_publisher == publisher
924939 assert pending_publisher in db_request .db .deleted
940+
941+ def test_reify_with_custom_issuer_url (self , db_request ):
942+ custom_issuer_url = "https://gitlab.custom-domain.com"
943+ pending_publisher = PendingGitLabPublisherFactory .create (
944+ issuer_url = custom_issuer_url
945+ )
946+ publisher = pending_publisher .reify (db_request .db )
947+
948+ assert publisher .issuer_url == custom_issuer_url
949+ assert isinstance (publisher , gitlab .GitLabPublisher )
0 commit comments