mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Decision taks: add artifacts of the repository’s contents
This commit is contained in:
parent
a11dc7006f
commit
55a8158d17
4 changed files with 30 additions and 1 deletions
|
@ -27,6 +27,11 @@ tasks:
|
||||||
sha256:7471a998e4462638c8d3e2cf0b4a99c9a5c8ca9f2ec0ae01cc069473b35cde10"
|
sha256:7471a998e4462638c8d3e2cf0b4a99c9a5c8ca9f2ec0ae01cc069473b35cde10"
|
||||||
features:
|
features:
|
||||||
taskclusterProxy: true
|
taskclusterProxy: true
|
||||||
|
artifacts:
|
||||||
|
public/repo.bundle:
|
||||||
|
type: file
|
||||||
|
path: /repo.bundle
|
||||||
|
expires: {$fromNow: '1 day'}
|
||||||
env:
|
env:
|
||||||
GIT_URL: ${event.repository.clone_url}
|
GIT_URL: ${event.repository.clone_url}
|
||||||
TASK_FOR: ${tasks_for}
|
TASK_FOR: ${tasks_for}
|
||||||
|
|
|
@ -10,6 +10,11 @@ from decisionlib import CONFIG, SHARED
|
||||||
|
|
||||||
|
|
||||||
def main(task_for):
|
def main(task_for):
|
||||||
|
with decisionlib.make_repo_bundle():
|
||||||
|
tasks(task_for)
|
||||||
|
|
||||||
|
|
||||||
|
def tasks(task_for):
|
||||||
if CONFIG.git_ref.startswith("refs/heads/"):
|
if CONFIG.git_ref.startswith("refs/heads/"):
|
||||||
branch = CONFIG.git_ref[len("refs/heads/"):]
|
branch = CONFIG.git_ref[len("refs/heads/"):]
|
||||||
CONFIG.treeherder_repository_name = "servo-" + (
|
CONFIG.treeherder_repository_name = "servo-" + (
|
||||||
|
|
|
@ -14,6 +14,7 @@ Project-independent library for Taskcluster decision tasks
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import contextlib
|
||||||
import datetime
|
import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
@ -28,6 +29,7 @@ import taskcluster
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"CONFIG", "SHARED", "Task", "DockerWorkerTask",
|
"CONFIG", "SHARED", "Task", "DockerWorkerTask",
|
||||||
"GenericWorkerTask", "WindowsGenericWorkerTask", "MacOsGenericWorkerTask",
|
"GenericWorkerTask", "WindowsGenericWorkerTask", "MacOsGenericWorkerTask",
|
||||||
|
"make_repo_bundle",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -842,3 +844,19 @@ def deindent(string):
|
||||||
|
|
||||||
def url_basename(url):
|
def url_basename(url):
|
||||||
return url.rpartition("/")[-1]
|
return url.rpartition("/")[-1]
|
||||||
|
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def make_repo_bundle():
|
||||||
|
subprocess.check_call(["git", "config", "user.name", "Decision task"])
|
||||||
|
subprocess.check_call(["git", "config", "user.email", "nobody@mozilla.com"])
|
||||||
|
tree = subprocess.check_output(["git", "show", CONFIG.git_sha, "--pretty=%T", "--no-patch"])
|
||||||
|
message = "Shallow version of commit " + CONFIG.git_sha
|
||||||
|
commit = subprocess.check_output(["git", "commit-tree", tree.strip(), "-m", message])
|
||||||
|
subprocess.check_call(["git", "update-ref", "refs/heads/shallow", commit.strip()])
|
||||||
|
subprocess.check_call(["git", "show-ref"])
|
||||||
|
with subprocess.Popen(["git", "bundle", "create", "../repo.bundle", "refs/heads/shallow"]) as p:
|
||||||
|
yield
|
||||||
|
exit_code = p.wait()
|
||||||
|
if exit_code:
|
||||||
|
sys.exit(exit_code)
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Index:
|
||||||
|
|
||||||
stringDate = str
|
stringDate = str
|
||||||
slugId = b"<new id>".lower
|
slugId = b"<new id>".lower
|
||||||
Queue = fromNow = MagicMock()
|
sys.exit = Queue = fromNow = MagicMock()
|
||||||
sys.modules["taskcluster"] = sys.modules[__name__]
|
sys.modules["taskcluster"] = sys.modules[__name__]
|
||||||
sys.dont_write_bytecode = True
|
sys.dont_write_bytecode = True
|
||||||
os.environ.update(**{k: k for k in "TASK_ID TASK_OWNER TASK_SOURCE GIT_URL GIT_SHA".split()})
|
os.environ.update(**{k: k for k in "TASK_ID TASK_OWNER TASK_SOURCE GIT_URL GIT_SHA".split()})
|
||||||
|
@ -48,6 +48,7 @@ os.environ["TASKCLUSTER_ROOT_URL"] = "https://community-tc.services.mozilla.com"
|
||||||
os.environ["TASKCLUSTER_PROXY_URL"] = "http://taskcluster"
|
os.environ["TASKCLUSTER_PROXY_URL"] = "http://taskcluster"
|
||||||
os.environ["NEW_AMI_WORKER_TYPE"] = "-"
|
os.environ["NEW_AMI_WORKER_TYPE"] = "-"
|
||||||
import decision_task
|
import decision_task
|
||||||
|
decision_task.decisionlib.subprocess = MagicMock()
|
||||||
|
|
||||||
print("\n# Push:")
|
print("\n# Push:")
|
||||||
decision_task.main("github-push")
|
decision_task.main("github-push")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue