From 178723795e4516091823159147c1aef486b86c42 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Fri, 11 Jan 2019 14:38:55 -0800 Subject: [PATCH] Uses new workers, renames some variables --- .taskcluster.yml | 18 +++++++++++++----- automation/gradle/versionCode.gradle | 2 +- .../taskcluster/decision_task_nightly.py | 18 +++++++++--------- automation/taskcluster/lib/tasks.py | 13 ++++--------- .../taskcluster/schedule_nightly_graph.py | 10 +++++----- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/.taskcluster.yml b/.taskcluster.yml index 9d25b1bf6..b19235780 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -10,14 +10,22 @@ tasks: $let: decision_task_id: {$eval: as_slugid("decision_task")} expires_in: {$fromNow: '1 year'} - repository: ${event.repository.clone_url} + repository: ${event.repository.html_url} scheduler_id: focus-nightly-sched is_mozilla_mobile_repo: - $eval: event.repository.clone_url == 'https://github.com/mozilla-mobile/fenix' + $eval: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix' track: - $if: event.repository.clone_url == 'https://github.com/mozilla-mobile/fenix' + $if: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix' then: 'nightly' else: 'staging-nightly' + decision_worker_type: + $if: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix' + then: mobile-3-decision + else: mobile-1-decision + build_worker_type: + $if: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix' + then: gecko-focus + else: android-components-g in: taskId: ${decision_task_id} taskGroupId: ${decision_task_id} # Must be explicit because of Chain of Trust @@ -26,14 +34,14 @@ tasks: expires: ${expires_in} schedulerId: ${scheduler_id} # Must be explicit because of Chain of Trust provisionerId: aws-provisioner-v1 - workerType: gecko-focus # This workerType has ChainOfTrust enabled + workerType: ${decision_worker_type} requires: all-completed # Must be explicit because of Chain of Trust priority: medium retries: 5 scopes: $flatten: - queue:scheduler-id:${scheduler_id} - - queue:create-task:highest:aws-provisioner-v1/gecko-focus + - queue:create-task:highest:aws-provisioner-v1/${build_worker_type} - project:mobile:fenix:releng:signing:format:autograph_apk - $if: is_mozilla_mobile_repo then: diff --git a/automation/gradle/versionCode.gradle b/automation/gradle/versionCode.gradle index 40c6f239d..e13354999 100644 --- a/automation/gradle/versionCode.gradle +++ b/automation/gradle/versionCode.gradle @@ -24,7 +24,7 @@ import java.text.SimpleDateFormat ext { def today = new Date() - // We use the current year (double digit) and subtract 18. We first released Reference Browser in + // We use the current year (double digit) and subtract 18. We first released Fenix in // 2018 so this value will start counting at 0 and increment by one every year. def year = String.valueOf((new SimpleDateFormat("yy").format(today) as int) - 18) diff --git a/automation/taskcluster/decision_task_nightly.py b/automation/taskcluster/decision_task_nightly.py index 742c809b1..9c7c1a787 100644 --- a/automation/taskcluster/decision_task_nightly.py +++ b/automation/taskcluster/decision_task_nightly.py @@ -22,13 +22,13 @@ HEAD_REV = os.environ.get('MOBILE_HEAD_REV') BUILDER = lib.tasks.TaskBuilder( task_id=TASK_ID, - owner="android-components-team@mozilla.com", + owner="fenix-eng-notifications@mozilla.com", source='{}/raw/{}/.taskcluster.yml'.format(GITHUB_HTTP_REPOSITORY, HEAD_REV), scheduler_id=SCHEDULER_ID ) -def generate_build_task(apks): +def generate_build_task(apks, is_staging): artifacts = {'public/{}'.format(os.path.basename(apk)): { "type": 'file', "path": apk, @@ -42,10 +42,10 @@ def generate_build_task(apks): description="Build Fenix from source code.", command='cd .. && {} && ./gradlew --no-daemon clean test assembleRelease'.format(checkout), features={ - "chainOfTrust": True, - "taskClusterProxy": True + "chainOfTrust": True }, - artifacts=artifacts + artifacts=artifacts, + worker_type='android-components-g' if is_staging else 'gecko-focus', ) @@ -64,7 +64,7 @@ def generate_signing_task(build_task_id, apks, date, is_staging): "project:mobile:fenix:releng:signing:cert:{}".format('dep-signing' if is_staging else 'release-signing') ] - return taskcluster.slugId(), BUILDER.build_signing_task( + return taskcluster.slugId(), BUILDER.craft_signing_task( build_task_id, name="(Fenix) Signing task", description="Sign release builds of Fenix", @@ -79,7 +79,7 @@ def generate_signing_task(build_task_id, apks, date, is_staging): def generate_push_task(signing_task_id, apks, commit, is_staging): artifacts = ["public/{}".format(os.path.basename(apk)) for apk in apks] - return taskcluster.slugId(), BUILDER.build_push_task( + return taskcluster.slugId(), BUILDER.craft_push_task( signing_task_id, name="(Fenix) Push task", description="Upload signed release builds of Fenix to Google Play", @@ -93,7 +93,7 @@ def generate_push_task(signing_task_id, apks, commit, is_staging): def populate_chain_of_trust_required_but_unused_files(): - # These files are needed to keep chainOfTrust happy. However, they have no need for Reference Browser + # These files are needed to keep chainOfTrust happy. However, they have no need for Fenix # at the moment. For more details, see: https://github.com/mozilla-releng/scriptworker/pull/209/files#r184180585 for file_name in ('actions.json', 'parameters.yml'): @@ -108,7 +108,7 @@ def nightly(apks, track, commit, date_string): task_graph = {} - build_task_id, build_task = generate_build_task(apks) + build_task_id, build_task = generate_build_task(apks, is_staging) lib.tasks.schedule_task(queue, build_task_id, build_task) task_graph[build_task_id] = {} diff --git a/automation/taskcluster/lib/tasks.py b/automation/taskcluster/lib/tasks.py index 8d3d37076..bdb78224c 100644 --- a/automation/taskcluster/lib/tasks.py +++ b/automation/taskcluster/lib/tasks.py @@ -14,18 +14,13 @@ class TaskBuilder(object): self.source = source self.scheduler_id = scheduler_id - def build_task(self, name, description, command, artifacts, features): + def build_task(self, name, description, command, artifacts, features, worker_type): created = datetime.datetime.now() expires = taskcluster.fromNow('1 year') deadline = taskcluster.fromNow('1 day') - features = features.copy() - features.update({ - "taskclusterProxy": True - }) - return { - "workerType": 'gecko-focus', + "workerType": worker_type, "taskGroupId": self.task_id, "schedulerId": self.scheduler_id, "expires": taskcluster.stringDate(expires), @@ -60,7 +55,7 @@ class TaskBuilder(object): } } - def build_signing_task(self, build_task_id, name, description, signing_format, is_staging, apks, scopes, routes): + def craft_signing_task(self, build_task_id, name, description, signing_format, is_staging, apks, scopes, routes): created = datetime.datetime.now() expires = taskcluster.fromNow('1 year') deadline = taskcluster.fromNow('1 day') @@ -99,7 +94,7 @@ class TaskBuilder(object): } } - def build_push_task(self, signing_task_id, name, description, is_staging, apks, scopes, commit): + def craft_push_task(self, signing_task_id, name, description, is_staging, apks, scopes, commit): created = datetime.datetime.now() expires = taskcluster.fromNow('1 year') deadline = taskcluster.fromNow('1 day') diff --git a/automation/taskcluster/schedule_nightly_graph.py b/automation/taskcluster/schedule_nightly_graph.py index ef5c527de..876207408 100644 --- a/automation/taskcluster/schedule_nightly_graph.py +++ b/automation/taskcluster/schedule_nightly_graph.py @@ -28,8 +28,8 @@ def calculate_git_references(root): if not remote.url.startswith('https://github.com'): raise InvalidGithubRepositoryError('expected remote to be a GitHub repository (accessed via HTTPs)') - url = remote.url[:-4] if remote.url.endswith('.git') else remote.url - return url, str(branch), str(branch.commit) + html_url = remote.url[:-4] if remote.url.endswith('.git') else remote.url + return html_url, str(branch), str(branch.commit) def make_decision_task(params): @@ -54,7 +54,7 @@ def make_decision_task(params): 'as_slugid': as_slugid, 'event': { 'repository': { - 'clone_url': params['repository_github_http_url'] + 'html_url': params['html_url'] }, 'release': { 'tag_name': params['head_rev'], @@ -78,10 +78,10 @@ def make_decision_task(params): def schedule(is_staging): queue = taskcluster.Queue({'baseUrl': 'http://taskcluster/queue/v1'}) - repository_github_http_url, branch, head_rev = calculate_git_references(ROOT) + html_url, branch, head_rev = calculate_git_references(ROOT) params = { 'is_staging': is_staging, - 'repository_github_http_url': repository_github_http_url, + 'html_url': html_url, 'head_rev': head_rev, 'branch': branch, 'cron_task_id': os.environ.get('CRON_TASK_ID', '')