Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push mobile metrics to loading dock (#288)
Pushing binary size with every PR to AWS.
- Loading branch information
Showing
8 changed files
with
113 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
var cf = require('@mapbox/cloudfriend'); | ||
|
||
module.exports = { | ||
AWSTemplateFormatVersion: '2010-09-09', | ||
Resources: { | ||
User: { | ||
Type: 'AWS::IAM::User', | ||
Properties: { | ||
Policies: [ | ||
{ | ||
PolicyName: 'devicefarm', | ||
PolicyDocument: { | ||
Statement: [ | ||
{ | ||
Action: ['devicefarm:*'], | ||
Effect: 'Allow', | ||
Resource: '*' | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
PolicyName: 'publish-metrics', | ||
PolicyDocument: { | ||
Statement: [ | ||
{ | ||
Action: ['s3:PutObject'], | ||
Effect: 'Allow', | ||
Resource: ['arn:aws:s3:::mapbox-loading-dock/raw/mobile.binarysize/*', | ||
'arn:aws:s3:::mapbox-loading-dock/raw/mobile.codecoverage/*'] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
PolicyName: 'get-signing-key', | ||
PolicyDocument: { | ||
Statement: [ | ||
{ | ||
Action: ['s3:GetObject'], | ||
Effect: 'Allow', | ||
Resource: ['arn:aws:s3:::mapbox/android/signing-credentials/secring.gpg'] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
AccessKey: { | ||
Type: 'AWS::IAM::AccessKey', | ||
Properties: { | ||
UserName: cf.ref('User') | ||
} | ||
} | ||
}, | ||
Outputs: { | ||
AccessKeyId: { Value: cf.ref('AccessKey') }, | ||
SecretAccessKey: { Value: cf.getAtt('AccessKey', 'SecretAccessKey') } | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,8 @@ | |
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"dependencies": { | ||
"@mapbox/cloudfriend": "^2.5.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
file_path="libtelemetry/build/outputs/aar/libtelemetry-release.aar" | ||
file_size=$(wc -c <"$file_path" | sed -e 's/^[[:space:]]*//') | ||
date=`date '+%Y-%m-%d'` | ||
utc_iso_date=`date -u +'%Y-%m-%dT%H:%M:%SZ'` | ||
label="Telemetry AAR" | ||
source="mobile.binarysize" | ||
scripts_path="scripts" | ||
json_name="$scripts_path/android-binarysize.json" | ||
json_gz="$scripts_path/android-binarysize.json.gz" | ||
|
||
# Publish to github | ||
"$scripts_path"/publish_to_sizechecker.js "$file_size" "$label" | ||
|
||
# Write binary size to json file | ||
cat >"$json_name" <<EOL | ||
{"sdk": "telemetry", "platform": "android", "size": ${file_size}, "created_at": "${utc_iso_date}"} | ||
EOL | ||
|
||
# Compress json file | ||
gzip -f "$json_name" > "$json_gz" | ||
|
||
# Publish to aws | ||
"$scripts_path"/publish_to_aws.sh $source $date $json_gz |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
source="$1" | ||
date="$2" | ||
file_path="$3" | ||
if [ -z "$file_path" ] || [ -z "$source" ] || [ -z "$date" ]; then | ||
>&2 echo "Usage: publish.sh source date filepath" | ||
>&2 echo "" | ||
>&2 echo "Example: publish.sh mobile_binarysize 2018-11-01 android-binarysize.json.gz" | ||
exit 1 | ||
fi | ||
|
||
filename="${file_path##*/}" | ||
aws s3 cp $file_path s3://mapbox-loading-dock/raw/$source/$date/$filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters