Skip to content

Commit

Permalink
Upload unsigned packaged add-on to dev & stage
Browse files Browse the repository at this point in the history
- For dev & stage only:
  - Restore the *.xpi and *.rdf upload removed in mozilla#2651
  - Restore creation of /static/addon/latest redirect with add-on hash
  - Configure frontend app to install add-on from /static/addon/latest

Issue mozilla#2865
  • Loading branch information
lmorchard committed Sep 18, 2017
1 parent bd4564d commit f69539f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 46 additions & 0 deletions bin/deploy.sh
Expand Up @@ -23,6 +23,8 @@ fi

if [ "$1" = "dev" ]; then
DEST="dev"
elif [ "$1" = "stage" ]; then
DEST="stage"
fi


Expand Down Expand Up @@ -92,6 +94,30 @@ aws s3 sync \
--acl "public-read" \
dist/ s3://${TESTPILOT_BUCKET}/

if [ "$DEST" = "dev" ] || [ "$DEST" = "stage" ]; then
# XPI; short cache; amazon won't detect the content-type correctly
aws s3 sync \
--cache-control "max-age=${TEN_MINUTES}" \
--content-type "application/x-xpinstall" \
--exclude "*" \
--include "*.xpi" \
--metadata "{${HPKP}, ${HSTS}, ${TYPE}}" \
--metadata-directive "REPLACE" \
--acl "public-read" \
dist/ s3://${TESTPILOT_BUCKET}/

# RDF; short cache; amazon won't detect the content-type correctly
aws s3 sync \
--cache-control "max-age=${TEN_MINUTES}" \
--content-type "text/rdf" \
--exclude "*" \
--include "*.rdf" \
--metadata "{${HPKP}, ${HSTS}, ${TYPE}}" \
--metadata-directive "REPLACE" \
--acl "public-read" \
dist/ s3://${TESTPILOT_BUCKET}/
fi

# l10n files; short cache;
aws s3 sync \
--cache-control "max-age=${TEN_MINUTES}" \
Expand Down Expand Up @@ -138,3 +164,23 @@ for fn in $(find dist -name 'index.html' -not -path 'dist/index.html'); do
--acl "public-read" \
$fn s3://${TESTPILOT_BUCKET}/${s3path}
done

if [ "$DEST" = "dev" ] || [ "$DEST" = "stage" ]; then
# The add-on lives at /static/addon/addon.xpi . Let's create a /latest/ URL so
# we can pass in the hash headers

# Make sure we have an empty latest file
> dist/static/addon/latest

HASH=($(sha256sum dist/static/addon/addon.xpi))
DIGEST="\"x-target-digest\": \"sha256:${HASH}\""
LOCATION="\"location\": \"/static/addon/addon.xpi\""

aws s3 cp \
--cache-control "max-age=${TEN_MINUTES}" \
--content-type "text/html" \
--metadata "{${HPKP}, ${HSTS}, ${TYPE}, ${LOCATION}, ${DIGEST}}" \
--metadata-directive "REPLACE" \
--acl "public-read" \
dist/static/addon/latest s3://${TESTPILOT_BUCKET}/static/addon/
fi
2 changes: 1 addition & 1 deletion frontend/src/app/config.js
Expand Up @@ -6,7 +6,7 @@ const defaultConfig = {
'https://analysis-output.telemetry.mozilla.org/testpilot/data/installation-counts/latest.json',
ravenPublicDSN:
'https://5ceef9a20a6e4cdd93cc9a935be78c73@sentry.prod.mozaws.net/169',
addonPath: '/static/addon/addon.xpi',
addonPath: '/static/addon/latest',
// Main production host
prodHost: 'testpilot.firefox.com',
// Hosts used for development purposes
Expand Down

0 comments on commit f69539f

Please sign in to comment.