1
0
Fork 0

Uses new workers, renames some variables

master
Mitchell Hentges 2019-01-11 14:38:55 -08:00 committed by Emily Kager
parent dae51c1f26
commit 178723795e
5 changed files with 32 additions and 29 deletions

View File

@ -10,14 +10,22 @@ tasks:
$let: $let:
decision_task_id: {$eval: as_slugid("decision_task")} decision_task_id: {$eval: as_slugid("decision_task")}
expires_in: {$fromNow: '1 year'} expires_in: {$fromNow: '1 year'}
repository: ${event.repository.clone_url} repository: ${event.repository.html_url}
scheduler_id: focus-nightly-sched scheduler_id: focus-nightly-sched
is_mozilla_mobile_repo: 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: 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' then: 'nightly'
else: 'staging-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: in:
taskId: ${decision_task_id} taskId: ${decision_task_id}
taskGroupId: ${decision_task_id} # Must be explicit because of Chain of Trust taskGroupId: ${decision_task_id} # Must be explicit because of Chain of Trust
@ -26,14 +34,14 @@ tasks:
expires: ${expires_in} expires: ${expires_in}
schedulerId: ${scheduler_id} # Must be explicit because of Chain of Trust schedulerId: ${scheduler_id} # Must be explicit because of Chain of Trust
provisionerId: aws-provisioner-v1 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 requires: all-completed # Must be explicit because of Chain of Trust
priority: medium priority: medium
retries: 5 retries: 5
scopes: scopes:
$flatten: $flatten:
- queue:scheduler-id:${scheduler_id} - 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 - project:mobile:fenix:releng:signing:format:autograph_apk
- $if: is_mozilla_mobile_repo - $if: is_mozilla_mobile_repo
then: then:

View File

@ -24,7 +24,7 @@ import java.text.SimpleDateFormat
ext { ext {
def today = new Date() 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. // 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) def year = String.valueOf((new SimpleDateFormat("yy").format(today) as int) - 18)

View File

@ -22,13 +22,13 @@ HEAD_REV = os.environ.get('MOBILE_HEAD_REV')
BUILDER = lib.tasks.TaskBuilder( BUILDER = lib.tasks.TaskBuilder(
task_id=TASK_ID, 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), source='{}/raw/{}/.taskcluster.yml'.format(GITHUB_HTTP_REPOSITORY, HEAD_REV),
scheduler_id=SCHEDULER_ID scheduler_id=SCHEDULER_ID
) )
def generate_build_task(apks): def generate_build_task(apks, is_staging):
artifacts = {'public/{}'.format(os.path.basename(apk)): { artifacts = {'public/{}'.format(os.path.basename(apk)): {
"type": 'file', "type": 'file',
"path": apk, "path": apk,
@ -42,10 +42,10 @@ def generate_build_task(apks):
description="Build Fenix from source code.", description="Build Fenix from source code.",
command='cd .. && {} && ./gradlew --no-daemon clean test assembleRelease'.format(checkout), command='cd .. && {} && ./gradlew --no-daemon clean test assembleRelease'.format(checkout),
features={ features={
"chainOfTrust": True, "chainOfTrust": True
"taskClusterProxy": 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') "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, build_task_id,
name="(Fenix) Signing task", name="(Fenix) Signing task",
description="Sign release builds of Fenix", 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): def generate_push_task(signing_task_id, apks, commit, is_staging):
artifacts = ["public/{}".format(os.path.basename(apk)) for apk in apks] 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, signing_task_id,
name="(Fenix) Push task", name="(Fenix) Push task",
description="Upload signed release builds of Fenix to Google Play", 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(): 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 # 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'): for file_name in ('actions.json', 'parameters.yml'):
@ -108,7 +108,7 @@ def nightly(apks, track, commit, date_string):
task_graph = {} 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) lib.tasks.schedule_task(queue, build_task_id, build_task)
task_graph[build_task_id] = {} task_graph[build_task_id] = {}

View File

@ -14,18 +14,13 @@ class TaskBuilder(object):
self.source = source self.source = source
self.scheduler_id = scheduler_id 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() created = datetime.datetime.now()
expires = taskcluster.fromNow('1 year') expires = taskcluster.fromNow('1 year')
deadline = taskcluster.fromNow('1 day') deadline = taskcluster.fromNow('1 day')
features = features.copy()
features.update({
"taskclusterProxy": True
})
return { return {
"workerType": 'gecko-focus', "workerType": worker_type,
"taskGroupId": self.task_id, "taskGroupId": self.task_id,
"schedulerId": self.scheduler_id, "schedulerId": self.scheduler_id,
"expires": taskcluster.stringDate(expires), "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() created = datetime.datetime.now()
expires = taskcluster.fromNow('1 year') expires = taskcluster.fromNow('1 year')
deadline = taskcluster.fromNow('1 day') 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() created = datetime.datetime.now()
expires = taskcluster.fromNow('1 year') expires = taskcluster.fromNow('1 year')
deadline = taskcluster.fromNow('1 day') deadline = taskcluster.fromNow('1 day')

View File

@ -28,8 +28,8 @@ def calculate_git_references(root):
if not remote.url.startswith('https://github.com'): if not remote.url.startswith('https://github.com'):
raise InvalidGithubRepositoryError('expected remote to be a GitHub repository (accessed via HTTPs)') raise InvalidGithubRepositoryError('expected remote to be a GitHub repository (accessed via HTTPs)')
url = remote.url[:-4] if remote.url.endswith('.git') else remote.url html_url = remote.url[:-4] if remote.url.endswith('.git') else remote.url
return url, str(branch), str(branch.commit) return html_url, str(branch), str(branch.commit)
def make_decision_task(params): def make_decision_task(params):
@ -54,7 +54,7 @@ def make_decision_task(params):
'as_slugid': as_slugid, 'as_slugid': as_slugid,
'event': { 'event': {
'repository': { 'repository': {
'clone_url': params['repository_github_http_url'] 'html_url': params['html_url']
}, },
'release': { 'release': {
'tag_name': params['head_rev'], 'tag_name': params['head_rev'],
@ -78,10 +78,10 @@ def make_decision_task(params):
def schedule(is_staging): def schedule(is_staging):
queue = taskcluster.Queue({'baseUrl': 'http://taskcluster/queue/v1'}) 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 = { params = {
'is_staging': is_staging, 'is_staging': is_staging,
'repository_github_http_url': repository_github_http_url, 'html_url': html_url,
'head_rev': head_rev, 'head_rev': head_rev,
'branch': branch, 'branch': branch,
'cron_task_id': os.environ.get('CRON_TASK_ID', '<cron_task_id>') 'cron_task_id': os.environ.get('CRON_TASK_ID', '<cron_task_id>')