diff --git a/src/mozilla_taskgraph/worker_types.py b/src/mozilla_taskgraph/worker_types.py index bcfb5da..a030a7c 100644 --- a/src/mozilla_taskgraph/worker_types.py +++ b/src/mozilla_taskgraph/worker_types.py @@ -70,6 +70,11 @@ "tag", description="The tag of the commit running the build." ): str, }, + Optional( + "artifact_prefix", + description="Directory prefix to store artifacts. Set this to 'public' " + "to create public artifacts.", + ): str, }, Extra: object, }, @@ -129,7 +134,9 @@ def normref(ref, type="heads"): "branch_dest_repo_owner", config.params["base_repository"] ) - task_def["payload"] = {"build_params": build_params} + payload = task_def["payload"] = {"build_params": build_params} + if bitrise.get("artifact_prefix"): + payload["artifact_prefix"] = bitrise["artifact_prefix"] @payload_builder( diff --git a/test/test_worker_types.py b/test/test_worker_types.py index cbaaba4..3d74ab0 100644 --- a/test/test_worker_types.py +++ b/test/test_worker_types.py @@ -160,6 +160,32 @@ }, id="environments", ), + pytest.param( + { + "bitrise": { + "artifact_prefix": "public", + "app": "some-app", + "workflows": ["bar"], + } + }, + {}, + { + "payload": { + "artifact_prefix": "public", + "build_params": { + "branch": "default", + "branch_repo_owner": "http://example.com/head/repo", + "commit_hash": "abcdef", + }, + }, + "scopes": [ + "foo:bitrise:app:some-app", + "foo:bitrise:workflow:bar", + ], + "tags": {"worker-implementation": "scriptworker"}, + }, + id="artifact prefix", + ), ), ) def test_build_bitrise_payload(