diff --git a/.taskcluster.yml b/.taskcluster.yml index 8116488b8..b7f10ba06 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -12,6 +12,10 @@ tasks: expires_in: {$fromNow: '1 year'} repository: ${event.repository.html_url} scheduler_id: focus-nightly-sched + + head_rev: ${event.release.tag_name} + head_branch: ${event.release.target_commitish} + is_mozilla_mobile_repo: $eval: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix' track: @@ -26,6 +30,7 @@ tasks: $if: event.repository.html_url == 'https://github.com/mozilla-mobile/fenix' then: mobile-3-b-fenix else: mobile-1-b-fenix + in: taskId: ${decision_task_id} taskGroupId: ${decision_task_id} # Must be explicit because of Chain of Trust @@ -66,9 +71,9 @@ tasks: chainOfTrust: true env: BUILD_WORKER_TYPE: ${build_worker_type} - MOBILE_HEAD_BRANCH: ${event.release.target_commitish} + MOBILE_HEAD_BRANCH: ${head_branch} MOBILE_HEAD_REPOSITORY: ${repository} - MOBILE_HEAD_REV: ${event.release.tag_name} + MOBILE_HEAD_REV: ${head_rev} MOBILE_TRIGGERED_BY: ${event.sender.login} SCHEDULER_ID: ${scheduler_id} TASK_ID: ${decision_task_id} @@ -77,28 +82,28 @@ tasks: - --login - -cx - >- - cd .. - && git clone ${repository} repository - && cd repository + git fetch ${repository} ${head_branch} + && git config advice.detachedHead false + && git checkout ${head_rev} && python automation/taskcluster/decision_task_nightly.py \ --track ${track} \ --commit \ - --output /opt/repository/app/build/outputs/apk \ + --output /opt/fenix/app/build/outputs/apk \ --apk arm/release/app-arm-release-unsigned.apk \ --apk x86/release/app-x86-release-unsigned.apk \ --date ${now} artifacts: public/task-graph.json: type: file - path: /opt/repository/task-graph.json + path: /opt/fenix/task-graph.json expires: ${expires_in} public/actions.json: type: file - path: /opt/repository/actions.json + path: /opt/fenix/actions.json expires: ${expires_in} public/parameters.yml: type: file - path: /opt/repository/parameters.yml + path: /opt/fenix/parameters.yml expires: ${expires_in} extra: cron: {$json: {$eval: 'cron'}} @@ -107,4 +112,4 @@ tasks: name: Fenix Nightly Decision Task 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 - source: ${repository}/raw/${event.release.tag_name}/.taskcluster.yml + source: ${repository}/raw/${head_rev}/.taskcluster.yml diff --git a/automation/taskcluster/decision_task_nightly.py b/automation/taskcluster/decision_task_nightly.py index 963e5ad32..a573e0ba9 100644 --- a/automation/taskcluster/decision_task_nightly.py +++ b/automation/taskcluster/decision_task_nightly.py @@ -19,6 +19,7 @@ TASK_ID = os.environ.get('TASK_ID') SCHEDULER_ID = os.environ.get('SCHEDULER_ID') GITHUB_HTTP_REPOSITORY = os.environ.get('MOBILE_HEAD_REPOSITORY') HEAD_REV = os.environ.get('MOBILE_HEAD_REV') +HEAD_BRANCH = os.environ.get('MOBILE_HEAD_BRANCH') BUILDER = lib.tasks.TaskBuilder( task_id=TASK_ID, @@ -36,13 +37,20 @@ def generate_build_task(apks, is_staging): "expires": taskcluster.stringDate(taskcluster.fromNow('1 year')), } 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 '') return taskcluster.slugId(), BUILDER.build_task( name="(Fenix) Build task", description="Build Fenix from source code.", - command=('cd .. && ' + checkout + + command=( + checkout + ' && python automation/taskcluster/helper/get-secret.py' ' -s {} -k dsn -f .sentry_token'.format(sentry_secret) + ' && ./gradlew --no-daemon -PcrashReports=true clean test assembleRelease'),