Disallow duplicate taskcluster artifacts.

This commit is contained in:
Josh Matthews 2021-01-24 15:41:41 -05:00
parent 500cb865bd
commit 5d923c0a95
2 changed files with 13 additions and 3 deletions

View file

@ -698,12 +698,13 @@ def wpt_chunks(platform, make_chunk_task, build_task, total_chunks, processes,
--tracker-api default \
--reporter-api default
""")
task.with_artifacts(*[
all_artifacts = set([
"%s/%s" % (repo_dir, word)
for script in task.scripts
for word in script.split()
if word.endswith(".log")
])
task.with_artifacts(*all_artifacts)
task.find_or_create("%s_%swpt_%s.%s" % (
platform.replace(" ", "_").lower(),
job_id_prefix.replace("-", "_"),

View file

@ -387,7 +387,10 @@ class GenericWorkerTask(Task):
Paths are relative to the tasks home directory.
"""
self.artifacts.extend((type, path) for path in paths)
for path in paths:
if (type, path) in self.artifacts:
raise ValueError("Duplicate artifact: " + path) # pragma: no cover
self.artifacts.append(tuple((type, path)))
return self
def with_features(self, *names):
@ -736,13 +739,19 @@ class DockerWorkerTask(UnixTaskMixin, Task):
with_docker_image = chaining(setattr, "docker_image")
with_max_run_time_minutes = chaining(setattr, "max_run_time_minutes")
with_artifacts = chaining(append_to_attr, "artifacts")
with_script = chaining(append_to_attr, "scripts")
with_early_script = chaining(prepend_to_attr, "scripts")
with_caches = chaining(update_attr, "caches")
with_env = chaining(update_attr, "env")
with_capabilities = chaining(update_attr, "capabilities")
def with_artifacts(self, *paths):
for path in paths:
if path in self.artifacts:
raise ValueError("Duplicate artifact: " + path) # pragma: no cover
self.artifacts.append(path)
return self
def build_worker_payload(self):
"""
Return a `docker-worker` worker payload.