diff --git a/Makefile b/Makefile index 34ca1a8ef9..d7c3b288bf 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ zip: addon bootstrap_zip: addon @rm -f build/screenshots-bootstrap.zip cd addon && zip -rq ../build/screenshots-bootstrap.zip . - # build/screenshots-bootstrap.js created + # build/screenshots-bootstrap.zip created .PHONY: signed_xpi signed_xpi: addon @@ -261,7 +261,9 @@ help: @echo " make clean" @echo " rm -rf build/ addon/webextension/build" @echo " make zip" - @echo " make a zip of the webextension in build/screenshots.zip" + @echo " make an unsigned zip of the webextension in build/screenshots.zip" + @echo " make bootstrap_zip" + @echo " make an unsigned zip of addon/ in build/screenshots.zip" @echo " make signed_xpi" @echo " make a signed xpi in build/screenshots.xpi" @echo "See also:" diff --git a/bin/build-docker-image b/bin/build-docker-image index cef8147682..606eb36c3e 100755 --- a/bin/build-docker-image +++ b/bin/build-docker-image @@ -6,16 +6,20 @@ export NODE_ENV=production cd "$(dirname ${BASH_SOURCE[0]})/.." if [[ $# = 0 ]] ; then - echo "Usage: $0 dockerhubusername" + echo "Usage: $0 dockerhubusername [version]" echo " builds the Screenshots docker image" echo " Determines version from package.json" - echo " tags and uploads it as [dockerhubusername]/pageshot:[version]" + echo " tags and uploads it as [dockerhubusername]/screenshots:[version]" echo " creates build/eb-app-latest.zip" - echo " version defaults to latest" + echo " version is read from package.json if not provided" exit 4 fi -version="$(node -e 'console.log(require("./package.json").version)')" +if [[ -n "$2" ]] ; then + version="$2" +else + version="$(node -e 'console.log(require("./package.json").version)')" +fi sed "s!USERNAME!$1!g" < Dockerrun.aws.json.template > Dockerrun.aws.json.tmp sed "s!VERSION!$version!g" < Dockerrun.aws.json.tmp > Dockerrun.aws.json @@ -29,6 +33,6 @@ if [[ ! -e "$xpi" ]] ; then make signed_xpi fi -echo "Creating docker image $1/pageshot:$version" -docker build -t $1/pageshot:"$version" . -docker push $1/pageshot:"$version" +echo "Creating docker image $1/screenshots:$version" +docker build -t $1/screenshots:"$version" . +docker push $1/screenshots:"$version" diff --git a/bin/release-version b/bin/release-version index d73665c758..c296c48b26 100755 --- a/bin/release-version +++ b/bin/release-version @@ -34,18 +34,17 @@ fi case "$channel" in dev) - if [[ -z "$DOCKER_USERNAME" ]] ; then - echo "Please set \$DOCKER_USERNAME to your dockerhub username" - exit 3 + if [[ "$(current_branch)" != "master" ]] ; then + echo "Note: deploying from branch $(current_branch) (master expected)" fi - rm -f build/screenshots.zip + rm -f build/screenshots.xpi # Forces update of the add-on version: mkdir -p build touch build/.backend.txt - SCREENSHOTS_BACKEND=https://pageshot.dev.mozaws.net SCREENSHOTS_SENTRY="$dev_sentry" make signed_xpi - ./bin/build-docker-image $DOCKER_USERNAME + SCREENSHOTS_BACKEND=https://screenshots.dev.mozaws.net SCREENSHOTS_SENTRY="$dev_sentry" make signed_xpi + ./bin/build-docker-image mozilla latest echo - echo "Next step: upload build/eb-app-latest.zip to http://amzn.to/1NuC3N9" + echo "Dev deployment automatically triggered, see #screenshots IRC for status" ;; stage) if [[ "$(current_branch)" != "stable" ]] && [[ -z "$IGNORE_BRANCH" ]] ; then @@ -55,7 +54,7 @@ case "$channel" in echo " IGNORE_BRANCH=1 $(basename $0) stage" exit 4 fi - rm -f build/screenshots.zip + rm -f build/screenshots.xpi # Forces update of the add-on version: touch build/.backend.txt SCREENSHOTS_BACKEND=https://screenshots.stage.mozaws.net SCREENSHOTS_SENTRY="$stage_sentry" make signed_xpi @@ -80,4 +79,4 @@ case "$channel" in exit 2 esac -which growlnotify > /dev/null && growlnotify -m "Screenshots Deploy/container for ${channel} completed" +which growlnotify > /dev/null && growlnotify -m "Screenshots Deploy/container for ${channel} completed" || true diff --git a/circle.yml b/circle.yml index 8ff53a7bd7..d648ea0c58 100644 --- a/circle.yml +++ b/circle.yml @@ -1,4 +1,6 @@ machine: + services: + - docker node: version: 6.10.0 environment: @@ -34,3 +36,10 @@ test: post: - bash <(curl -s https://codecov.io/bash) + +deployment: + dev: + branch: master + commands: + - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS + - ./bin/release-version dev diff --git a/docs/docker.md b/docs/docker.md index 74a51d049d..2d5c25b6f8 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,7 +1,9 @@ +**Note:** Most of what is described in these instructions is implemented in the `./bin/release-version` script. + To create the docker image, first run: make server - make xpi + make signed_xpi Then, manually sign the xpi (in the build directory) using the AMO website, download the signed copy, replace the unsigned copy, and use: