Skip to content

Commit

Permalink
Bug 1677020 - Always cap try tasks to a 28 days expiry. r=taskgraph-r…
Browse files Browse the repository at this point in the history
…eviewers,jmaher

Currently, if a task defines its own expiry with a very large value,
that will be respected even on try, where we actually don't want that to
happen.

This also helps simplify the setup for docker images.

We also take on the occasion to remove the discrepancy between the
default expiry for tasks in general and tests in particular. Bug 1258497
set the original expiry to 14 days, bug 1281004 added another place
where the expiry was set to 14 days for tests specifically, and then bug
1304180 changed the expiry to 28 days, but it just seems the location
for tests was overlooked rather than deliberately left to 14 days.

Differential Revision: https://phabricator.services.mozilla.com/D96962
  • Loading branch information
glandium committed Nov 16, 2020
1 parent f08f065 commit 033119b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/transforms/docker_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def fill_template(config, tasks):
"image_name": image_name,
"artifact_prefix": "public",
},
"expires-after": "28 days" if config.params.is_try() else "1 year",
"expires-after": "1 year",
"scopes": [],
"treeherder": {
"symbol": job_symbol,
Expand Down
8 changes: 7 additions & 1 deletion taskcluster/taskgraph/transforms/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
get_release_config,
)
from taskgraph.util.signed_artifacts import get_signed_artifacts
from taskgraph.util.time import value_of
from taskgraph.util.workertypes import worker_type_implementation
from voluptuous import Any, Required, Optional, Extra, Match, All, NotIn
from taskgraph import GECKO, MAX_DEPENDENCIES
Expand Down Expand Up @@ -1839,7 +1840,12 @@ def build_task(config, tasks):
)
)

if "expires-after" not in task:
if "expires-after" in task:
if config.params.is_try():
delta = value_of(task["expires-after"])
if delta.days >= 28:
task["expires-after"] = "28 days"
else:
task["expires-after"] = "28 days" if config.params.is_try() else "1 year"

if "deadline-after" not in task:
Expand Down
17 changes: 3 additions & 14 deletions taskcluster/taskgraph/transforms/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,19 +939,6 @@ def set_tier(config, tasks):
yield task


@transforms.add
def set_expires_after(config, tasks):
"""Try jobs expire after 2 weeks; everything else lasts 1 year. This helps
keep storage costs low."""
for task in tasks:
if "expires-after" not in task:
if config.params.is_try():
task["expires-after"] = "14 days"
else:
task["expires-after"] = "1 year"
yield task


@transforms.add
def set_download_symbols(config, tasks):
"""In general, we download symbols immediately for debug builds, but only
Expand Down Expand Up @@ -1878,7 +1865,9 @@ def make_job_description(config, tasks):
if task["mozharness"]["requires-signed-builds"] is True:
jobdesc["dependencies"]["build-signing"] = task["build-signing-label"]

jobdesc["expires-after"] = task["expires-after"]
if "expires-after" in task:
jobdesc["expires-after"] = task["expires-after"]

jobdesc["routes"] = []
jobdesc["run-on-projects"] = sorted(task["run-on-projects"])
jobdesc["scopes"] = []
Expand Down

0 comments on commit 033119b

Please sign in to comment.