diff --git a/images/alpine33/Dockerfile b/images/alpine33/Dockerfile index dbccf68..825366f 100644 --- a/images/alpine33/Dockerfile +++ b/images/alpine33/Dockerfile @@ -13,7 +13,7 @@ ENV LANGUAGE en_US.UTF-8 RUN apk add --update nodejs=${NODE_VERSION}-r0; # Set newman version -ENV NEWMAN_VERSION 3.1.2 +ENV NEWMAN_VERSION 3.2.0 # Install newman RUN npm install -g newman@${NEWMAN_VERSION}; diff --git a/images/alpine33/README.md b/images/alpine33/README.md index 85439e6..64eef5a 100644 --- a/images/alpine33/README.md +++ b/images/alpine33/README.md @@ -1,6 +1,6 @@ # newman_alpine33 -This image runs newman 3.1.2 on node 4.3.0 on Alpine 3.3 +This image runs newman 3.2.0 on node 4.3.0 on Alpine 3.3 Build the image, @@ -11,7 +11,7 @@ docker build -t postman/newman_alpine33 . Or get it from [docker hub](https://registry.hub.docker.com/u/postman/newman_alpine33/) ```terminal -docker pull postman/newman_alpine33:3.1.2 +docker pull postman/newman_alpine33:3.2.0 ``` then run it diff --git a/images/ubuntu1404/Dockerfile b/images/ubuntu1404/Dockerfile index 3d27d6d..7b8d502 100644 --- a/images/ubuntu1404/Dockerfile +++ b/images/ubuntu1404/Dockerfile @@ -19,7 +19,7 @@ RUN npm install -g n; RUN n ${NODE_VERSION}; # Set newman version -ENV NEWMAN_VERSION 3.1.2 +ENV NEWMAN_VERSION 3.2.0 # Install newman RUN npm install -g newman@${NEWMAN_VERSION}; diff --git a/images/ubuntu1404/README.md b/images/ubuntu1404/README.md index 7cbf564..2606dd9 100644 --- a/images/ubuntu1404/README.md +++ b/images/ubuntu1404/README.md @@ -1,6 +1,6 @@ # newman_ubuntu1404 -This image runs newman 3.1.2 on node 4.3.0 on Ubuntu 14.04.2 +This image runs newman 3.2.0 on node 4.3.0 on Ubuntu 14.04.2 Build the image, @@ -11,7 +11,7 @@ docker build -t postman/newman_ubuntu1404 . Or get it from [docker hub](https://registry.hub.docker.com/u/postman/newman_ubuntu1404/) ```terminal -docker pull postman/newman_ubuntu1404:3.1.2 +docker pull postman/newman_ubuntu1404:3.2.0 ``` then run it diff --git a/package.json b/package.json index 3b91fe8..241ed53 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "newman-docker", - "version": "3.1.2", + "version": "3.2.0", "description": "This repository contains the Dockerfiles and tests for the Newman Docker images.", "scripts": { + "update": "./scripts/update/update.sh", "docker-build": "./scripts/docker/docker-build.sh", "docker-test": "./scripts/docker/docker-test.sh", "test": "./scripts/test/test.sh", diff --git a/scripts/docker/docker-build.sh b/scripts/docker/docker-build.sh index 823c150..a655fd1 100755 --- a/scripts/docker/docker-build.sh +++ b/scripts/docker/docker-build.sh @@ -3,11 +3,17 @@ set -e; IMAGES_BASE_PATH="./images"; +CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') function build_docker_image { TAG=$(grep -oP "(?<=ENV\ NEWMAN_VERSION\ ).+" ${1}/Dockerfile); BASENAME=$(basename $1); - docker build -t postman/newman_${BASENAME}:${TAG} ${1}; + + if [ $CURRENT_BRANCH = "master" ]; then + docker build -t postman/newman_${BASENAME}:${TAG} -t postman/newman_${BASENAME}:latest ${1}; + else + docker build -t postman/newman_${BASENAME}:${TAG} ${1}; + fi } if [ -z "$1" ]; then diff --git a/scripts/update/update.sh b/scripts/update/update.sh new file mode 100755 index 0000000..0f1ee53 --- /dev/null +++ b/scripts/update/update.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# A simple script to automagically bump the newman-docker image version to the latest counterpart from npmjs.org + +# Stop on first error +set -e; + +echo "Determining the latest version of Newman from npmjs.org..."; + +CURRENT_VERSION=$npm_config_package_version; +LATEST_VERSION=$(npm show newman version); + +if [ -z $CURRENT_VERSION ]; then + CURRENT_VERSION=$(grep "\"version\":\ " package.json | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" | cat); +fi + +if [ $CURRENT_VERSION = $LATEST_VERSION ]; then + echo "The current version is the latest"; + exit 0; +fi + +git grep -l $CURRENT_VERSION | xargs sed -i 's/$CURRENT_VERSION/$LATEST_VERSION/g' images/**/*.*; +echo "Bumped newman-docker version to v$LATEST_VERSION";