mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Taskcluster: move curl’ing artifacts into decisionlib
This commit is contained in:
parent
f357c6fe93
commit
a5cce280f1
3 changed files with 26 additions and 35 deletions
|
@ -514,6 +514,7 @@ class DockerWorkerTask(Task):
|
|||
self.features = {}
|
||||
self.capabilities = {}
|
||||
self.artifacts = []
|
||||
self.curl_scripts_count = 0
|
||||
|
||||
with_docker_image = chaining(setattr, "docker_image")
|
||||
with_max_run_time_minutes = chaining(setattr, "max_run_time_minutes")
|
||||
|
@ -563,6 +564,28 @@ class DockerWorkerTask(Task):
|
|||
self.features.update({name: True for name in names})
|
||||
return self
|
||||
|
||||
def with_curl_script(self, url, file_path):
|
||||
self.curl_scripts_count += 1
|
||||
n = self.curl_scripts_count
|
||||
return self \
|
||||
.with_env(**{
|
||||
"CURL_%s_URL" % n: url,
|
||||
"CURL_%s_PATH" % n: file_path,
|
||||
}) \
|
||||
.with_script("""
|
||||
mkdir -p $(dirname "$CURL_{n}_PATH")
|
||||
curl --retry 5 --connect-timeout 10 -Lf "$CURL_{n}_URL" -o "$CURL_{n}_PATH"
|
||||
""".format(n=n))
|
||||
|
||||
def with_curl_artifact_script(self, task_id, artifact_name, out_directory=""):
|
||||
return self \
|
||||
.with_dependencies(task_id) \
|
||||
.with_curl_script(
|
||||
"https://queue.taskcluster.net/v1/task/%s/artifacts/public/%s"
|
||||
% (task_id, artifact_name),
|
||||
os.path.join(out_directory, url_basename(artifact_name)),
|
||||
)
|
||||
|
||||
def with_repo(self):
|
||||
"""
|
||||
Make a shallow clone the git repository at the start of the task.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue