Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 918a522

Browse files
committed
Add support for feature branch builds on taskcluster (#1889)
1 parent 4bb48a8 commit 918a522

File tree

2 files changed

+61
-48
lines changed

2 files changed

+61
-48
lines changed

.taskcluster.yml

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ tasks:
1111
$if: 'tasks_for == "github-pull-request"'
1212
then: ${event.pull_request.head.repo.clone_url}
1313
else: ${event.repository.clone_url}
14-
14+
isFeatureBranch:
15+
$if: 'tasks_for == "github-push"'
16+
then: {$eval: 'event.ref[0:19] == "refs/heads/feature/"'}
17+
else: false
1518
in:
1619
###############################################################################
1720
# Task: Pull requests
@@ -53,50 +56,56 @@ tasks:
5356
# testing only and should not be uploaded to App Stores.
5457
#
5558
###############################################################################
56-
- $if: 'tasks_for == "github-push" && event["ref"] == "refs/heads/master"'
59+
- $if: 'tasks_for == "github-push" && (event["ref"] == "refs/heads/master" || isFeatureBranch == true)'
5760
then:
58-
provisionerId: 'aws-provisioner-v1'
59-
workerType: 'github-worker'
60-
deadline: {$fromNow: 1 day}
61-
expires: {$fromNow: 1 year}
62-
scopes:
63-
- "secrets:get:project/firefoxreality/github-deploy-key"
64-
- "secrets:get:project/firefoxreality/staging-signing-token"
65-
- "secrets:get:project/firefoxreality/symbols-token"
66-
routes:
67-
68-
payload:
69-
maxRunTime: 14400
70-
image: 'mozillamixedreality/firefoxreality:190312'
71-
features:
72-
taskclusterProxy: true
73-
command:
74-
- /bin/bash
75-
- '--login'
76-
- '-cx'
77-
- >-
78-
git fetch origin
79-
&& git config advice.detachedHead false
80-
&& git rebase origin/master
81-
&& rm -rf gvr-android-sdk && git clone https://github.com/MozillaReality/FirefoxReality-gvr-android-sdk.git gvr-android-sdk
82-
&& git submodule update
83-
&& . tools/taskcluster/get_third_party.sh
84-
&& cp tools/gradle/taskcluster.properties ./user.properties
85-
&& ./gradlew --no-daemon --console=plain clean `python tools/taskcluster/build_targets.py =all`
86-
&& python tools/taskcluster/fetch_secret.py -s project/firefoxreality/staging-signing-token -o token -n token
87-
&& python tools/taskcluster/sign_apk.py -t token
88-
&& python tools/taskcluster/archive_debug_apk.py
89-
&& . tools/taskcluster/upload_symbols.sh
90-
artifacts:
91-
'public':
92-
type: 'directory'
93-
path: '/opt/FirefoxReality/builds/'
94-
expires: {$fromNow: '1 month'}
95-
metadata:
96-
name: Firefox Reality for Android - Build - Master update
97-
description: Building Firefox Reality for Android (via Gradle) - triggered by update to master
98-
99-
source: ${repository}
61+
$let:
62+
featureName:
63+
$if: 'isFeatureBranch == true'
64+
then: "-f ${event.ref[19:]}"
65+
else: "-f master"
66+
in:
67+
provisionerId: 'aws-provisioner-v1'
68+
workerType: 'github-worker'
69+
deadline: {$fromNow: 1 day}
70+
expires: {$fromNow: 1 year}
71+
scopes:
72+
- "secrets:get:project/firefoxreality/github-deploy-key"
73+
- "secrets:get:project/firefoxreality/staging-signing-token"
74+
- "secrets:get:project/firefoxreality/symbols-token"
75+
routes:
76+
77+
payload:
78+
maxRunTime: 14400
79+
image: 'mozillamixedreality/firefoxreality:190312'
80+
features:
81+
taskclusterProxy: true
82+
command:
83+
- /bin/bash
84+
- '--login'
85+
- '-cx'
86+
- >-
87+
git fetch origin
88+
&& git config advice.detachedHead false
89+
&& git checkout ${event.ref}
90+
&& rm -rf gvr-android-sdk && git clone https://github.com/MozillaReality/FirefoxReality-gvr-android-sdk.git gvr-android-sdk
91+
&& git submodule update
92+
&& . tools/taskcluster/get_third_party.sh
93+
&& cp tools/gradle/taskcluster.properties ./user.properties
94+
&& ./gradlew --no-daemon --console=plain clean `python tools/taskcluster/build_targets.py =all`
95+
&& python tools/taskcluster/fetch_secret.py -s project/firefoxreality/staging-signing-token -o token -n token
96+
&& python tools/taskcluster/sign_apk.py -t token ${featureName}
97+
&& python tools/taskcluster/archive_debug_apk.py
98+
&& . tools/taskcluster/upload_symbols.sh
99+
artifacts:
100+
'public':
101+
type: 'directory'
102+
path: '/opt/FirefoxReality/builds/'
103+
expires: {$fromNow: '1 month'}
104+
metadata:
105+
name: Firefox Reality for Android - Build - Master update
106+
description: Building Firefox Reality for Android (via Gradle) - triggered by update to master or feature branch
107+
108+
source: ${repository}
100109
###############################################################################
101110
# Task: Release builds
102111
#

tools/taskcluster/sign_apk.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,33 @@ def main(name, argv):
1515
token = ''
1616
sign_url = 'https://edge.stage.autograph.services.mozaws.net/sign'
1717
release = False
18+
feature_name = ""
1819
try:
19-
opts, args = getopt.getopt(argv,"ht:r")
20+
opts, args = getopt.getopt(argv,"hrt:f:")
2021
except getopt.GetoptError:
21-
print name + '-t <token file name> -r'
22+
print name + ' -t <token file name> -r -f <feature name>'
2223
sys.exit(2)
2324
for opt, arg in opts:
2425
if opt == '-h':
25-
print name + '-t <token file name> -r'
26+
print name + ' -t <token file name> -r -f <feature name>'
2627
sys.exit()
2728
elif opt in ("-t"):
2829
with open(arg, 'r') as tokenfile:
2930
token = tokenfile.read().rstrip()
3031
elif opt in ('-r'):
3132
sign_url = 'https://edge.prod.autograph.services.mozaws.net/sign'
3233
release = True
34+
elif opt in ('-f'):
35+
feature_name = arg.replace('/','-') + '-'
36+
3337

3438
build_output_path = './app/build/outputs/apk'
3539

3640
# Sign APKs
3741
for apk in glob.glob(build_output_path + "/*/*/*-unsigned.apk"):
3842
target = apk.replace('-unsigned', '-signed')
3943
if not release:
40-
target = target.replace('-release-', '-staging-')
44+
target = target.replace('-release-', '-staging-' + feature_name)
4145
print "Signing", apk
4246
print "Target ", target
4347
print subprocess.check_output([

0 commit comments

Comments
 (0)