1
0
Fork 0

Allow staging releases on git branches

master
Johan Lorenzo 2019-02-07 14:50:46 +01:00 committed by Colin Lee
parent d621630ab8
commit 19dd468639
2 changed files with 25 additions and 12 deletions

View File

@ -12,6 +12,10 @@ tasks:
expires_in: {$fromNow: '1 year'} expires_in: {$fromNow: '1 year'}
repository: ${event.repository.html_url} repository: ${event.repository.html_url}
scheduler_id: focus-nightly-sched scheduler_id: focus-nightly-sched
head_rev: ${event.release.tag_name}
head_branch: ${event.release.target_commitish}
is_mozilla_mobile_repo: is_mozilla_mobile_repo:
$eval: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix' $eval: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix'
track: track:
@ -26,6 +30,7 @@ tasks:
$if: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix' $if: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix'
then: mobile-3-b-fenix then: mobile-3-b-fenix
else: mobile-1-b-fenix else: mobile-1-b-fenix
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
@ -66,9 +71,9 @@ tasks:
chainOfTrust: true chainOfTrust: true
env: env:
BUILD_WORKER_TYPE: ${build_worker_type} BUILD_WORKER_TYPE: ${build_worker_type}
MOBILE_HEAD_BRANCH: ${event.release.target_commitish} MOBILE_HEAD_BRANCH: ${head_branch}
MOBILE_HEAD_REPOSITORY: ${repository} MOBILE_HEAD_REPOSITORY: ${repository}
MOBILE_HEAD_REV: ${event.release.tag_name} MOBILE_HEAD_REV: ${head_rev}
MOBILE_TRIGGERED_BY: ${event.sender.login} MOBILE_TRIGGERED_BY: ${event.sender.login}
SCHEDULER_ID: ${scheduler_id} SCHEDULER_ID: ${scheduler_id}
TASK_ID: ${decision_task_id} TASK_ID: ${decision_task_id}
@ -77,28 +82,28 @@ tasks:
- --login - --login
- -cx - -cx
- >- - >-
cd .. git fetch ${repository} ${head_branch}
&& git clone ${repository} repository && git config advice.detachedHead false
&& cd repository && git checkout ${head_rev}
&& python automation/taskcluster/decision_task_nightly.py \ && python automation/taskcluster/decision_task_nightly.py \
--track ${track} \ --track ${track} \
--commit \ --commit \
--output /opt/repository/app/build/outputs/apk \ --output /opt/fenix/app/build/outputs/apk \
--apk arm/release/app-arm-release-unsigned.apk \ --apk arm/release/app-arm-release-unsigned.apk \
--apk x86/release/app-x86-release-unsigned.apk \ --apk x86/release/app-x86-release-unsigned.apk \
--date ${now} --date ${now}
artifacts: artifacts:
public/task-graph.json: public/task-graph.json:
type: file type: file
path: /opt/repository/task-graph.json path: /opt/fenix/task-graph.json
expires: ${expires_in} expires: ${expires_in}
public/actions.json: public/actions.json:
type: file type: file
path: /opt/repository/actions.json path: /opt/fenix/actions.json
expires: ${expires_in} expires: ${expires_in}
public/parameters.yml: public/parameters.yml:
type: file type: file
path: /opt/repository/parameters.yml path: /opt/fenix/parameters.yml
expires: ${expires_in} expires: ${expires_in}
extra: extra:
cron: {$json: {$eval: 'cron'}} cron: {$json: {$eval: 'cron'}}
@ -107,4 +112,4 @@ tasks:
name: Fenix Nightly Decision Task name: Fenix Nightly Decision Task
description: Decision task scheduled by cron task [${cron.task_id}](https://tools.taskcluster.net/tasks/${cron.task_id}) description: Decision task scheduled by cron task [${cron.task_id}](https://tools.taskcluster.net/tasks/${cron.task_id})
owner: ${event.sender.login}@users.noreply.github.com owner: ${event.sender.login}@users.noreply.github.com
source: ${repository}/raw/${event.release.tag_name}/.taskcluster.yml source: ${repository}/raw/${head_rev}/.taskcluster.yml

View File

@ -19,6 +19,7 @@ TASK_ID = os.environ.get('TASK_ID')
SCHEDULER_ID = os.environ.get('SCHEDULER_ID') SCHEDULER_ID = os.environ.get('SCHEDULER_ID')
GITHUB_HTTP_REPOSITORY = os.environ.get('MOBILE_HEAD_REPOSITORY') GITHUB_HTTP_REPOSITORY = os.environ.get('MOBILE_HEAD_REPOSITORY')
HEAD_REV = os.environ.get('MOBILE_HEAD_REV') HEAD_REV = os.environ.get('MOBILE_HEAD_REV')
HEAD_BRANCH = os.environ.get('MOBILE_HEAD_BRANCH')
BUILDER = lib.tasks.TaskBuilder( BUILDER = lib.tasks.TaskBuilder(
task_id=TASK_ID, task_id=TASK_ID,
@ -36,13 +37,20 @@ def generate_build_task(apks, is_staging):
"expires": taskcluster.stringDate(taskcluster.fromNow('1 year')), "expires": taskcluster.stringDate(taskcluster.fromNow('1 year')),
} for apk in apks} } for apk in apks}
checkout = 'git clone {} repository && cd repository'.format(GITHUB_HTTP_REPOSITORY) checkout = (
"export TERM=dumb && git fetch {} {} --tags && "
"git config advice.detachedHead false && "
"git checkout {}".format(
GITHUB_HTTP_REPOSITORY, HEAD_BRANCH, HEAD_REV
)
)
sentry_secret = '{}project/mobile/fenix/sentry'.format('garbage/staging/' if is_staging else '') sentry_secret = '{}project/mobile/fenix/sentry'.format('garbage/staging/' if is_staging else '')
return taskcluster.slugId(), BUILDER.build_task( return taskcluster.slugId(), BUILDER.build_task(
name="(Fenix) Build task", name="(Fenix) Build task",
description="Build Fenix from source code.", description="Build Fenix from source code.",
command=('cd .. && ' + checkout + command=(
checkout +
' && python automation/taskcluster/helper/get-secret.py' ' && python automation/taskcluster/helper/get-secret.py'
' -s {} -k dsn -f .sentry_token'.format(sentry_secret) + ' -s {} -k dsn -f .sentry_token'.format(sentry_secret) +
' && ./gradlew --no-daemon -PcrashReports=true clean test assembleRelease'), ' && ./gradlew --no-daemon -PcrashReports=true clean test assembleRelease'),