Skip to content
Permalink
Browse files

Compute the "task ID" only when needed

  • Loading branch information...
SimonSapin authored and jdm committed May 23, 2019
1 parent 0edf865 commit 0ed6cdbb4256d40c15df2058c66098658f997373
Showing with 27 additions and 27 deletions.
  1. +21 −23 etc/taskcluster/decision_task.py
  2. +6 −4 etc/taskcluster/decisionlib.py
@@ -17,8 +17,6 @@ def main(task_for):
)

if task_for == "github-push":
CONFIG.init_task_id()

# FIXME https://github.com/servo/servo/issues/22325 implement these:
linux_arm32_dev = linux_arm64_dev = lambda: None

@@ -195,12 +193,12 @@ def linux_tidy_unit_docs():
git bundle create docs.bundle HEAD
""")
.with_artifacts("/repo/target/doc/docs.bundle")
.find_or_create("docs." + CONFIG.task_id)
.find_or_create("docs." + CONFIG.task_id())
)


def upload_docs():
docs_build_task_id = decisionlib.Task.find("docs." + CONFIG.task_id)
docs_build_task_id = decisionlib.Task.find("docs." + CONFIG.task_id())
return (
linux_task("Upload docs to GitHub Pages")
.with_treeherder("Linux x64", "DocUpload")
@@ -235,7 +233,7 @@ def macos_unit():
./mach package --dev
./etc/ci/lockfile_changed.sh
""")
.find_or_create("macos_unit." + CONFIG.task_id)
.find_or_create("macos_unit." + CONFIG.task_id())
)


@@ -268,7 +266,7 @@ def android_arm32_dev_from_macos():
./mach bootstrap-android --accept-all-licences --build
./mach build --android --dev --verbose
""")
.find_or_create("android_arm32_dev.macos." + CONFIG.task_id)
.find_or_create("android_arm32_dev.macos." + CONFIG.task_id())
)


@@ -281,7 +279,7 @@ def android_arm32_dev():
./etc/ci/lockfile_changed.sh
python ./etc/ci/check_dynamic_symbols.py
""")
.find_or_create("android_arm32_dev." + CONFIG.task_id)
.find_or_create("android_arm32_dev." + CONFIG.task_id())
)


@@ -305,7 +303,7 @@ def android_nightly():
"/repo/target/android/i686-linux-android/release/servoapp.apk",
"/repo/target/android/i686-linux-android/release/servoview.aar",
)
.find_or_create("build.android_nightlies." + CONFIG.task_id)
.find_or_create("build.android_nightlies." + CONFIG.task_id())
)


@@ -318,7 +316,7 @@ def android_arm32_release():
"/repo/target/android/armv7-linux-androideabi/release/servoapp.apk",
"/repo/target/android/armv7-linux-androideabi/release/servoview.aar",
)
.find_or_create("build.android_armv7_release." + CONFIG.task_id)
.find_or_create("build.android_armv7_release." + CONFIG.task_id())
)


@@ -331,7 +329,7 @@ def android_x86_release():
"/repo/target/android/i686-linux-android/release/servoapp.apk",
"/repo/target/android/i686-linux-android/release/servoview.aar",
)
.find_or_create("build.android_x86_release." + CONFIG.task_id)
.find_or_create("build.android_x86_release." + CONFIG.task_id())
)


@@ -354,7 +352,7 @@ def android_x86_wpt():
/_mozilla/mozilla/DOMParser.html \
/_mozilla/mozilla/webgl/context_creation_error.html
""")
.find_or_create("android_x86_release." + CONFIG.task_id)
.find_or_create("android_x86_release." + CONFIG.task_id())
)


@@ -368,7 +366,7 @@ def windows_x86():
.with_script(
"python mach build --dev --target i686-pc-windows-msvc",
)
.find_or_create("build.windows_x86_dev." + CONFIG.task_id)
.find_or_create("build.windows_x86_dev." + CONFIG.task_id())
)


@@ -387,7 +385,7 @@ def windows_unit():
)
.with_artifacts("repo/target/debug/msi/Servo.exe",
"repo/target/debug/msi/Servo.zip")
.find_or_create("build.windows_x64_dev." + CONFIG.task_id)
.find_or_create("build.windows_x64_dev." + CONFIG.task_id())
)


@@ -399,7 +397,7 @@ def windows_release():
"mach package --release")
.with_artifacts("repo/target/release/msi/Servo.exe",
"repo/target/release/msi/Servo.zip")
.find_or_create("build.windows_x64_release." + CONFIG.task_id)
.find_or_create("build.windows_x64_release." + CONFIG.task_id())
)


@@ -415,7 +413,7 @@ def windows_nightly():
"mach upload-nightly windows-msvc --secret-from-taskcluster")
.with_artifacts("repo/target/release/msi/Servo.exe",
"repo/target/release/msi/Servo.zip")
.find_or_create("build.windows_x64_nightly." + CONFIG.task_id)
.find_or_create("build.windows_x64_nightly." + CONFIG.task_id())
)


@@ -432,7 +430,7 @@ def linux_nightly():
"./mach upload-nightly linux --secret-from-taskcluster",
)
.with_artifacts("/repo/target/release/servo-tech-demo.tar.gz")
.find_or_create("build.linux_x64_nightly" + CONFIG.task_id)
.find_or_create("build.linux_x64_nightly" + CONFIG.task_id())
)


@@ -449,7 +447,7 @@ def linux_wpt():
target/release/build/osmesa-src-*/out/lib/gallium
""")
.with_artifacts("/target.tar.gz")
.find_or_create("build.linux_x64_release~assertions" + CONFIG.task_id)
.find_or_create("build.linux_x64_release~assertions" + CONFIG.task_id())
)
def linux_run_task(name):
return linux_task(name).with_dockerfile(dockerfile_path("run"))
@@ -472,7 +470,7 @@ def macos_nightly():
"./mach upload-nightly mac --secret-from-taskcluster",
)
.with_artifacts("repo/target/release/servo-tech-demo.dmg")
.find_or_create("build.mac_x64_nightly." + CONFIG.task_id)
.find_or_create("build.mac_x64_nightly." + CONFIG.task_id())
)


@@ -502,7 +500,7 @@ def update_wpt():
./etc/ci/update-wpt-checkout open-pr
./etc/ci/update-wpt-checkout cleanup
""")
.find_or_create("wpt_update." + CONFIG.task_id)
.find_or_create("wpt_update." + CONFIG.task_id())
)


@@ -520,7 +518,7 @@ def macos_release_build():
target/release/build/osmesa-src-*/out/src/mapi/shared-glapi/.libs
""")
.with_artifacts("repo/target.tar.gz")
.find_or_create("build.macos_x64_release." + CONFIG.task_id)
.find_or_create("build.macos_x64_release." + CONFIG.task_id())
)


@@ -608,7 +606,7 @@ def wpt_chunks(platform, make_chunk_task, build_task, total_chunks, processes,
if word.endswith(".log")
])
platform_id = platform.replace(" ", "_").lower()
task.find_or_create("%s_wpt_%s.%s" % (platform_id, this_chunk, CONFIG.task_id))
task.find_or_create("%s_wpt_%s.%s" % (platform_id, this_chunk, CONFIG.task_id()))


def daily_tasks_setup():
@@ -847,7 +845,7 @@ def magicleap_dev():
./mach build --magicleap --dev
env -u DYLD_LIBRARY_PATH ./mach package --magicleap --dev
""")
.find_or_create("build.magicleap_dev." + CONFIG.git_sha)
.find_or_create("build.magicleap_dev." + CONFIG.task_id())
)


@@ -862,7 +860,7 @@ def magicleap_nightly():
./mach upload-nightly magicleap --secret-from-taskcluster
""")
.with_artifacts("repo/target/magicleap/aarch64-linux-android/release/Servo2D.mpk")
.find_or_create("build.magicleap_nightly." + CONFIG.git_sha)
.find_or_create("build.magicleap_nightly." + CONFIG.task_id())
)


@@ -57,21 +57,23 @@ def __init__(self):
self.git_ref = os.environ.get("GIT_REF")
self.git_sha = os.environ.get("GIT_SHA")

def init_task_id(self):
def task_id(self):
if hasattr(self, "_task_id"):
return self._task_id
# If the head commit is a merge, we want to generate a unique task id which incorporates
# the merge parents rather that the actual sha of the merge commit. This ensures that tasks
# can be reused if the tree is in an identical state. Otherwise, if the head commit is
# not a merge, we can rely on the head commit sha for that purpose.
merge_parents_output = subprocess.check_output(["git", "show", "--format=%P", "HEAD"])
merge_parents = merge_parents_output.decode("utf8").strip().split(' ')
self.task_id = self.git_sha
self._task_id = self.git_sha
if len(merge_parents) > 1:
self.task_id = '-'.join(merge_parents)
self._task_id = '-'.join(merge_parents)
return self._task_id

def git_sha_is_current_head(self):
output = subprocess.check_output(["git", "rev-parse", "HEAD"])
self.git_sha = output.decode("utf8").strip()
self.init_task_id()


class Shared:

0 comments on commit 0ed6cdb

Please sign in to comment.
You can’t perform that action at this time.