├── images ├── ubuntu1404 │ ├── .dockerignore │ ├── Dockerfile │ └── README.md └── alpine33 │ ├── Dockerfile │ └── README.md ├── .travis.yml ├── scripts ├── test │ ├── test-docker.sh │ ├── test-infra.sh │ └── test.sh ├── update │ └── update.sh └── docker │ ├── docker-build.sh │ └── docker-test.sh ├── ISSUE_TEMPLATE.md ├── test ├── data │ ├── HTTPBinNewmanTestEnv.json.postman_environment │ ├── HTTPBinNewmanTest.json.postman_collection │ └── HTTPBinNewmanTestNoEnv.json.postman_collection └── infra │ ├── dockerfiles.test.js │ └── dockerfile_rules.yml ├── .gitignore ├── package.json ├── README.md ├── CONTRIBUTING.md └── LICENSE.md /images/ubuntu1404/.dockerignore: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "4" 4 | 5 | services: 6 | - docker 7 | 8 | install: 9 | - npm install 10 | 11 | script: 12 | - npm test 13 | 14 | after_success: 15 | - echo "All done!" 16 | -------------------------------------------------------------------------------- /scripts/test/test-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # stop on first error 4 | set -e; 5 | 6 | echo -e "\n\n\033[93mBuilding docker images...\033[0m"; 7 | npm run docker-build; 8 | 9 | echo -e "\n\n\033[93mTesting docker images...\033[0m"; 10 | npm run docker-test; 11 | -------------------------------------------------------------------------------- /scripts/test/test-infra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # stop on first error 4 | set -e; 5 | 6 | echo -e "\n\n\033[93mRunning infrastructure tests...\033[0m"; 7 | echo -e "\033[0m\033[2mmocha `mocha --version`\033[0m"; 8 | 9 | # run mocha tests 10 | mocha test/infra/**/*.test.js --recursive; 11 | -------------------------------------------------------------------------------- /scripts/test/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e; 4 | 5 | echo ""; 6 | echo " ,-————,"; 7 | echo " / _____ \\"; 8 | echo " ( | > | )"; 9 | echo " \\ — /"; 10 | echo " \`—————‘"; 11 | echo ""; 12 | 13 | echo "Newman Docker Tests"; 14 | 15 | # run infra tests 16 | npm run test-infra; 17 | 18 | # run docker tests 19 | npm run test-docker; 20 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /test/data/HTTPBinNewmanTestEnv.json.postman_environment: -------------------------------------------------------------------------------- 1 | { 2 | "id": "25c52d73-03ce-0305-ab32-3c50f9795895", 3 | "name": "HttpBin Env", 4 | "values": [ 5 | { 6 | "key": "serverloc", 7 | "value": "httpbin.org", 8 | "type": "text", 9 | "name": "serverloc", 10 | "enabled": true 11 | } 12 | ], 13 | "timestamp": 1437635065317, 14 | "synced": false, 15 | "syncedFilename": "" 16 | } 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.exe~ 3 | *.orig 4 | *.rej 5 | *.test 6 | .*.swp 7 | .DS_Store 8 | .bashrc 9 | .dotcloud 10 | .flymake* 11 | .git/ 12 | .gopath/ 13 | .hg/ 14 | .vagrant* 15 | Vagrantfile 16 | a.out 17 | autogen/ 18 | bin 19 | build_src 20 | bundles/ 21 | docker/docker 22 | docs/AWS_S3_BUCKET 23 | docs/GITCOMMIT 24 | docs/GIT_BRANCH 25 | docs/VERSION 26 | docs/_build 27 | docs/_static 28 | docs/_templates 29 | docs/changed-files 30 | # generated by man/man/md2man-all.sh 31 | man/man1 32 | man/man5 33 | pyenv 34 | vendor/pkg/ 35 | .idea 36 | node_modules 37 | npm-debug.log* 38 | -------------------------------------------------------------------------------- /scripts/update/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # A simple script to automagically bump the newman-docker image version to the latest counterpart from npmjs.org 4 | 5 | # Stop on first error 6 | set -e; 7 | 8 | echo "Determining the latest version of Newman from npmjs.org..."; 9 | 10 | CURRENT_VERSION=$npm_config_package_version; 11 | LATEST_VERSION=$(npm show newman version); 12 | 13 | if [ -z $CURRENT_VERSION ]; then 14 | CURRENT_VERSION=$(grep "\"version\":\ " package.json | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" | cat); 15 | fi 16 | 17 | if [ $CURRENT_VERSION = $LATEST_VERSION ]; then 18 | echo "The current version is the latest"; 19 | exit 0; 20 | fi 21 | 22 | git grep -l $CURRENT_VERSION | xargs sed -i 's/$CURRENT_VERSION/$LATEST_VERSION/g' images/**/*.*; 23 | echo "Bumped newman-docker version to v$LATEST_VERSION"; 24 | -------------------------------------------------------------------------------- /scripts/docker/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e; 4 | 5 | IMAGES_BASE_PATH="./images"; 6 | CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') 7 | 8 | function build_docker_image { 9 | TAG=$(grep -oP "(?<=ENV\ NEWMAN_VERSION\ ).+" ${1}/Dockerfile); 10 | BASENAME=$(basename $1); 11 | 12 | if [ $CURRENT_BRANCH = "master" ]; then 13 | docker build -t postman/newman_${BASENAME}:${TAG} -t postman/newman_${BASENAME}:latest ${1}; 14 | else 15 | docker build -t postman/newman_${BASENAME}:${TAG} ${1}; 16 | fi 17 | } 18 | 19 | if [ -z "$1" ]; then 20 | for image in $IMAGES_BASE_PATH/*; do 21 | if [ -d "${image}" ] && [ -f "${image}/Dockerfile" ]; then 22 | build_docker_image ${image}; 23 | fi 24 | done 25 | else 26 | if [ -d "${IMAGES_BASE_PATH}/${1}" ] && [ -f "${IMAGES_BASE_PATH}/${1}/Dockerfile" ]; then 27 | build_docker_image ${IMAGES_BASE_PATH}/${1}; 28 | else 29 | echo "Invalid image"; 30 | exit 1; 31 | fi 32 | fi 33 | -------------------------------------------------------------------------------- /scripts/docker/docker-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e; 4 | 5 | IMAGES_BASE_PATH="./images"; 6 | 7 | function test_docker_image { 8 | TAG=$(grep -oP "(?<=ENV\ NEWMAN_VERSION\ ).+" ${1}/Dockerfile); 9 | BASENAME=$(basename $1); 10 | 11 | docker run -v $PWD/test/data:/etc/newman -t postman/newman_${BASENAME}:${TAG} \ 12 | run HTTPBinNewmanTest.json.postman_collection \ 13 | -e HTTPBinNewmanTestEnv.json.postman_environment \ 14 | --suppress-exit-code; 15 | 16 | docker run -t postman/newman_${BASENAME}:${TAG} \ 17 | run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda \ 18 | --suppress-exit-code; 19 | } 20 | 21 | if [ -z "$1" ]; then 22 | for image in $IMAGES_BASE_PATH/*; do 23 | if [ -d "${image}" ] && [ -f "${image}/Dockerfile" ]; then 24 | test_docker_image ${image}; 25 | fi 26 | done 27 | else 28 | if [ -d "${IMAGES_BASE_PATH}/${1}" ] && [ -f "${IMAGES_BASE_PATH}/${1}/Dockerfile" ]; then 29 | test_docker_image ${IMAGES_BASE_PATH}/${1}; 30 | else 31 | echo "Invalid image"; 32 | exit 1; 33 | fi 34 | fi 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "newman-docker", 3 | "version": "3.9.2", 4 | "description": "This repository contains the Dockerfiles and tests for the Newman Docker images.", 5 | "scripts": { 6 | "update": "./scripts/update/update.sh", 7 | "docker-build": "./scripts/docker/docker-build.sh", 8 | "docker-test": "./scripts/docker/docker-test.sh", 9 | "test": "./scripts/test/test.sh", 10 | "test-docker": "./scripts/test/test-docker.sh", 11 | "test-infra": "./scripts/test/test-infra.sh" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/postmanlabs/newman-docker.git" 16 | }, 17 | "keywords": [ 18 | "postman", 19 | "newman", 20 | "docker", 21 | "image" 22 | ], 23 | "author": "Postman Labs ", 24 | "license": "Apache-2.0", 25 | "bugs": { 26 | "url": "https://github.com/postmanlabs/newman-docker/issues" 27 | }, 28 | "homepage": "https://github.com/postmanlabs/newman-docker#readme", 29 | "devDependencies": { 30 | "dockerfile_lint": "0.0.8", 31 | "dockerode": "2.2.2", 32 | "expect.js": "0.3.1", 33 | "mocha": "2.2.5" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/infra/dockerfiles.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview This test suite runs tests on the various versions of newman-docker. 3 | */ 4 | 5 | var expect = require('expect.js'), 6 | fs = require('fs'), 7 | path = require('path'), 8 | DockerFileValidator = require('dockerfile_lint'); 9 | 10 | /* global describe, it */ 11 | describe('Validate Dockerfiles', function () { 12 | var imagesBaseDirectory = path.join(__dirname, '../../images'), 13 | versions = fs.readdirSync(imagesBaseDirectory).filter(function (item) { 14 | return fs.statSync(path.join(imagesBaseDirectory, item)).isDirectory(); 15 | }), 16 | rules = fs.readFileSync(path.join(__dirname, 'dockerfile_rules.yml')), 17 | validator = new DockerFileValidator(rules); 18 | 19 | versions.map(function (version) { 20 | var dockerFilePath = path.join(imagesBaseDirectory, version, 'Dockerfile'), 21 | dockerFileContent = fs.readFileSync(dockerFilePath); 22 | 23 | it('Docker file for "' + version + '" must be valid', function () { 24 | var result = validator.validate(dockerFileContent.toString()), 25 | numBadThings = result.error.count + result.warn.count; 26 | 27 | if (!(numBadThings == 0)) { 28 | console.log(JSON.stringify(result, null, 4)); // Helps debugging on the CI 29 | } 30 | expect(numBadThings).to.be(0); 31 | }); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /images/alpine33/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.3 2 | MAINTAINER Postman Labs 3 | 4 | # Set node version 5 | ENV NODE_VERSION 4.3.2 6 | 7 | # Set locale 8 | ENV LC_ALL en_US.UTF-8 9 | ENV LANG en_US.UTF-8 10 | ENV LANGUAGE en_US.UTF-8 11 | 12 | # Install node 13 | RUN apk add --update nodejs=${NODE_VERSION}-r1; 14 | 15 | # Set newman version 16 | ENV NEWMAN_VERSION 3.9.2 17 | 18 | # Install newman 19 | RUN npm install -g newman@${NEWMAN_VERSION}; 20 | 21 | # Set workdir to /etc/newman 22 | # When running the image, mount the directory containing your collection to this location 23 | # 24 | # docker run -v :/etc/newman ... 25 | # 26 | # In case you mount your collections directory to a different location, you will need to give absolute paths to any 27 | # collection, environment files you want to pass to newman, and if you want newman reports to be saved to your disk. 28 | # Or you can change the workdir by using the -w or --workdir flag 29 | 30 | WORKDIR /etc/newman 31 | 32 | # Set newman as the default container command 33 | # Now you can run the container via 34 | # 35 | # docker run -v /home/collections:/etc/newman -t postman/newman_alpine33 -c YourCollection.json.postman_collection \ 36 | # -e YourEnvironment.postman_environment \ 37 | # -H newman_report.html 38 | 39 | ENTRYPOINT ["newman"] 40 | -------------------------------------------------------------------------------- /images/ubuntu1404/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04.2 2 | MAINTAINER Postman Labs 3 | 4 | # Install curl and npm 5 | RUN apt-get install -y curl; 6 | 7 | RUN curl -sS https://deb.nodesource.com/setup_8.x | sudo -E bash - 8 | 9 | RUN apt-get clean && apt-get upgrade -y && apt-get update -y --fix-missing && apt-get install -y nodejs 10 | 11 | # Set node version 12 | ENV NODE_VERSION 8 13 | 14 | # Set locale 15 | ENV LC_ALL en_US.UTF-8 16 | ENV LANG en_US.UTF-8 17 | ENV LANGUAGE en_US.UTF-8 18 | 19 | # Install node 20 | RUN npm install -g n; 21 | RUN n ${NODE_VERSION}; 22 | 23 | # Set newman version 24 | ENV NEWMAN_VERSION 3.9.2 25 | 26 | # Install newman 27 | RUN npm install -g newman@${NEWMAN_VERSION}; 28 | 29 | # Set workdir to /etc/newman 30 | # When running the image, mount the directory containing your collection to this location 31 | # 32 | # docker run -v :/etc/newman ... 33 | # 34 | # In case you mount your collections directory to a different location, you will need to give absolute paths to any 35 | # collection, environment files you want to pass to newman, and if you want newman reports to be saved to your disk. 36 | # Or you can change the workdir by using the -w or --workdir flag 37 | 38 | WORKDIR /etc/newman 39 | 40 | # Set newman as the default container command 41 | # Now you can run the container via 42 | # 43 | # docker run -v /home/collections:/etc/newman -t postman/newman_ubuntu1404 -c YourCollection.json.postman_collection \ 44 | # -e YourEnvironment.postman_environment \ 45 | # -H newman_report.html 46 | 47 | ENTRYPOINT ["newman"] 48 | -------------------------------------------------------------------------------- /images/alpine33/README.md: -------------------------------------------------------------------------------- 1 | # newman_alpine33 2 | 3 | This image runs newman 3.9.2 on node 4.3.0 on Alpine 3.3 4 | 5 | Build the image: 6 | 7 | ```terminal 8 | docker build -t postman/newman_alpine33 . 9 | ``` 10 | 11 | Or get it from [Docker Hub](https://registry.hub.docker.com/u/postman/newman_alpine33/): 12 | 13 | ```terminal 14 | docker pull postman/newman_alpine33:3.9.2 15 | ``` 16 | 17 | Then run it: 18 | 19 | ```terminal 20 | docker --volume="/home/postman/collections:/etc/newman" -t postman/newman_alpine33 --collection="JSONBlobCoreAPI.json.postman_collection" --html="newman-report.html" 21 | ``` 22 | For newman-docker to be able to use collections and environment files saved on the host machine, and to save reports generated by newman, a directory containing the collection and environment needs to be mounted on to the docker instance on run time, preferably at `/etc/newman`, which is the default working directory. If you mount to a different location, then: 23 | - You can pass the full path to your collection and environment files to newman. For instance, if you mount to `/var/newman`, 24 | 25 | ```terminal 26 | docker --volume="/home/postman/collection:/var/newman" -t postman/newman_alpine33 --collection="/var/newman/JSONBlobCoreAPI.json.postman_collection" --html="/var/newman/newman-report.html" 27 | ``` 28 | - You can change the working directory while running the image to the location you mounted to, using the `-w` or `--workdir` flag. 29 | 30 | ```terminal 31 | docker run --volume="/home/postman/collections:/var/newman" --workdir="/var/newman" -t postman/newman_alpine33 --collection="JSONBlobCoreAPI.json.postman_collection" --html="newman-report.html" 32 | ``` 33 | 34 | In case you don't need to save newman's report to the host, and your collection is available online and does not require any environment, then you can forgo mounting your collections directory and directly pass the collection URL to newman: 35 | 36 | ```terminal 37 | docker run -t postman/newman_alpine33 --url="https://www.getpostman.com/collections/8a0c9bc08f062d12dcda" 38 | ``` 39 | -------------------------------------------------------------------------------- /images/ubuntu1404/README.md: -------------------------------------------------------------------------------- 1 | # newman_ubuntu1404 2 | 3 | This image runs newman 3.9.2 on node 4.3.0 on Ubuntu 14.04.2 4 | 5 | Build the image, 6 | 7 | ```terminal 8 | docker build -t postman/newman_ubuntu1404 . 9 | ``` 10 | 11 | Or get it from [docker hub](https://registry.hub.docker.com/u/postman/newman_ubuntu1404/) 12 | 13 | ```terminal 14 | docker pull postman/newman_ubuntu1404:3.9.2 15 | ``` 16 | 17 | then run it 18 | 19 | ```terminal 20 | docker --volume="/home/postman/collections:/etc/newman" -t postman/newman_ubuntu1404 --collection="JSONBlobCoreAPI.json.postman_collection" --html="newman-report.html" 21 | ``` 22 | For newman-docker to be able to use collections and environment files saved on the host machine, and to save reports generated by newman, a directory containing the collection and environment needs to be mounted on to the docker instance on run time, preferably at `/etc/newman`, which is the default working directory. If you mount to a different location, then 23 | - You can either pass the full path to your collection and environment files to newman. For instance, if you mount to `/var/newman`, 24 | 25 | ```terminal 26 | docker --volume="/home/postman/collection:/var/newman" -t postman/newman_ubuntu1404 --collection="/var/newman/JSONBlobCoreAPI.json.postman_collection" --html="/var/newman/newman-report.html" 27 | ``` 28 | - You can change the working directory while running the image to the location you mounted to, using the `-w` or `--workdir` flag. 29 | 30 | ```terminal 31 | docker run --volume="/home/postman/collections:/var/newman" --workdir="/var/newman" -t postman/newman_ubuntu1404 --collection="JSONBlobCoreAPI.json.postman_collection" --html="newman-report.html" 32 | ``` 33 | 34 | In case you don't need to save newmans report to the host, and your collection is available online and it does not require any environment, then you can forgo mounting your collections directory, and directly pass the collection url to newman 35 | 36 | ```terminal 37 | docker run -t postman/newman_ubuntu1404 --url="https://www.getpostman.com/collections/8a0c9bc08f062d12dcda" 38 | ``` 39 | -------------------------------------------------------------------------------- /test/data/HTTPBinNewmanTest.json.postman_collection: -------------------------------------------------------------------------------- 1 | { 2 | "id": "99315123-992f-c284-d6dc-b00be1d6be62", 3 | "name": "newmanTest", 4 | "description": "Makes four requests to HTTPBin (httpbin.org) and tests Newman", 5 | "order": [ 6 | "9f169dc0-7444-b89e-a7e0-950af47bd7da", 7 | "d83dcc96-27f1-47d7-b35f-2095ef5fddc8", 8 | "0f22ce8f-df9b-af6d-6c5a-5aef8a81e272", 9 | "3dca05d0-7060-8ad9-1e28-0b63fed60715" 10 | ], 11 | "folders": [], 12 | "timestamp": 1438249510749, 13 | "owner": "1260", 14 | "remoteLink": "", 15 | "public": false, 16 | "requests": [ 17 | { 18 | "id": "0f22ce8f-df9b-af6d-6c5a-5aef8a81e272", 19 | "headers": "", 20 | "url": "http://{{serverloc}}/delete", 21 | "pathVariables": {}, 22 | "preRequestScript": "", 23 | "method": "DELETE", 24 | "collectionId": "99315123-992f-c284-d6dc-b00be1d6be62", 25 | "data": [], 26 | "dataMode": "params", 27 | "name": "DELETE request", 28 | "description": "", 29 | "descriptionFormat": "html", 30 | "time": 1438250164765, 31 | "version": 2, 32 | "responses": [], 33 | "tests": "tests[\"Status code is 200\"] = responseCode.code === 200;", 34 | "currentHelper": "normal", 35 | "helperAttributes": {} 36 | }, 37 | { 38 | "id": "3dca05d0-7060-8ad9-1e28-0b63fed60715", 39 | "headers": "", 40 | "url": "http://{{serverloc}}/put", 41 | "pathVariables": {}, 42 | "preRequestScript": "", 43 | "method": "PUT", 44 | "collectionId": "99315123-992f-c284-d6dc-b00be1d6be62", 45 | "data": [ 46 | { 47 | "key": "quotient", 48 | "value": "223", 49 | "type": "text", 50 | "enabled": true 51 | } 52 | ], 53 | "dataMode": "urlencoded", 54 | "name": "PUT with form data", 55 | "description": "", 56 | "descriptionFormat": "html", 57 | "time": 1438250517000, 58 | "version": 2, 59 | "responses": [], 60 | "tests": "var data = JSON.parse(responseBody);\ntests[\"Test form data\"] = data.form.quotient === \"223\";", 61 | "currentHelper": "normal", 62 | "helperAttributes": {} 63 | }, 64 | { 65 | "id": "9f169dc0-7444-b89e-a7e0-950af47bd7da", 66 | "headers": "", 67 | "url": "http://{{serverloc}}/get?lol=true", 68 | "preRequestScript": "", 69 | "pathVariables": {}, 70 | "method": "GET", 71 | "data": [], 72 | "dataMode": "params", 73 | "version": 2, 74 | "tests": "var data = JSON.parse(responseBody);\ntests[\"Response contains params\"] = data.args.lol === \"true\";", 75 | "currentHelper": "normal", 76 | "helperAttributes": {}, 77 | "time": 1438250908857, 78 | "name": "GET with URL Params", 79 | "description": "Simple GET request with URL Parameters", 80 | "collectionId": "99315123-992f-c284-d6dc-b00be1d6be62", 81 | "responses": [] 82 | }, 83 | { 84 | "id": "d83dcc96-27f1-47d7-b35f-2095ef5fddc8", 85 | "headers": "Content-Type: application/json\n", 86 | "url": "http://{{serverloc}}/post", 87 | "pathVariables": {}, 88 | "preRequestScript": "", 89 | "method": "POST", 90 | "collectionId": "99315123-992f-c284-d6dc-b00be1d6be62", 91 | "data": [], 92 | "dataMode": "raw", 93 | "name": "POST with JSON body", 94 | "description": "", 95 | "descriptionFormat": "html", 96 | "time": 1438250049106, 97 | "version": 2, 98 | "responses": [], 99 | "tests": "var data = JSON.parse(responseBody);\ntests[\"Check POST param in response\"] = data.json.something === \"cool\";", 100 | "currentHelper": "normal", 101 | "helperAttributes": {}, 102 | "rawModeData": "{\n \"something\": \"cool\"\n}" 103 | } 104 | ] 105 | } -------------------------------------------------------------------------------- /test/data/HTTPBinNewmanTestNoEnv.json.postman_collection: -------------------------------------------------------------------------------- 1 | { 2 | "id": "99315123-992f-c284-d6dc-b00be1d6be62", 3 | "name": "newmanTest", 4 | "description": "Makes four requests to HTTPBin (httpbin.org) and tests Newman", 5 | "order": [ 6 | "9f169dc0-7444-b89e-a7e0-950af47bd7da", 7 | "d83dcc96-27f1-47d7-b35f-2095ef5fddc8", 8 | "0f22ce8f-df9b-af6d-6c5a-5aef8a81e272", 9 | "3dca05d0-7060-8ad9-1e28-0b63fed60715" 10 | ], 11 | "folders": [], 12 | "timestamp": 1438249510749, 13 | "owner": "1260", 14 | "remoteLink": "", 15 | "public": false, 16 | "requests": [ 17 | { 18 | "id": "0f22ce8f-df9b-af6d-6c5a-5aef8a81e272", 19 | "headers": "", 20 | "url": "http://httpbin.org/delete", 21 | "pathVariables": {}, 22 | "preRequestScript": "", 23 | "method": "DELETE", 24 | "collectionId": "99315123-992f-c284-d6dc-b00be1d6be62", 25 | "data": [], 26 | "dataMode": "params", 27 | "name": "DELETE request", 28 | "description": "", 29 | "descriptionFormat": "html", 30 | "time": 1438250164765, 31 | "version": 2, 32 | "responses": [], 33 | "tests": "tests[\"Status code is 200\"] = responseCode.code === 200;", 34 | "currentHelper": "normal", 35 | "helperAttributes": {} 36 | }, 37 | { 38 | "id": "3dca05d0-7060-8ad9-1e28-0b63fed60715", 39 | "headers": "", 40 | "url": "http://httpbin.org/put", 41 | "pathVariables": {}, 42 | "preRequestScript": "", 43 | "method": "PUT", 44 | "collectionId": "99315123-992f-c284-d6dc-b00be1d6be62", 45 | "data": [ 46 | { 47 | "key": "quotient", 48 | "value": "223", 49 | "type": "text", 50 | "enabled": true 51 | } 52 | ], 53 | "dataMode": "urlencoded", 54 | "name": "PUT with form data", 55 | "description": "", 56 | "descriptionFormat": "html", 57 | "time": 1438250517000, 58 | "version": 2, 59 | "responses": [], 60 | "tests": "var data = JSON.parse(responseBody);\ntests[\"Test form data\"] = data.form.quotient === \"223\";", 61 | "currentHelper": "normal", 62 | "helperAttributes": {} 63 | }, 64 | { 65 | "id": "9f169dc0-7444-b89e-a7e0-950af47bd7da", 66 | "headers": "", 67 | "url": "http://httpbin.org/get?lol=true", 68 | "preRequestScript": "", 69 | "pathVariables": {}, 70 | "method": "GET", 71 | "data": [], 72 | "dataMode": "params", 73 | "version": 2, 74 | "tests": "var data = JSON.parse(responseBody);\ntests[\"Response contains params\"] = data.args.lol === \"true\";", 75 | "currentHelper": "normal", 76 | "helperAttributes": {}, 77 | "time": 1438250908857, 78 | "name": "GET with URL Params", 79 | "description": "Simple GET request with URL Parameters", 80 | "collectionId": "99315123-992f-c284-d6dc-b00be1d6be62", 81 | "responses": [] 82 | }, 83 | { 84 | "id": "d83dcc96-27f1-47d7-b35f-2095ef5fddc8", 85 | "headers": "Content-Type: application/json\n", 86 | "url": "http://httpbin.org/post", 87 | "pathVariables": {}, 88 | "preRequestScript": "", 89 | "method": "POST", 90 | "collectionId": "99315123-992f-c284-d6dc-b00be1d6be62", 91 | "data": [], 92 | "dataMode": "raw", 93 | "name": "POST with JSON body", 94 | "description": "", 95 | "descriptionFormat": "html", 96 | "time": 1438250049106, 97 | "version": 2, 98 | "responses": [], 99 | "tests": "var data = JSON.parse(responseBody);\ntests[\"Check POST param in response\"] = data.json.something === \"cool\";", 100 | "currentHelper": "normal", 101 | "helperAttributes": {}, 102 | "rawModeData": "{\n \"something\": \"cool\"\n}" 103 | } 104 | ] 105 | } 106 | -------------------------------------------------------------------------------- /test/infra/dockerfile_rules.yml: -------------------------------------------------------------------------------- 1 | --- 2 | profile: 3 | name: "Default" 4 | description: "Default Profile. Checks basic syntax." 5 | general: 6 | ref_url_base: "https://docs.docker.com/reference/builder/" 7 | valid_instructions: 8 | - "FROM" 9 | - "MAINTAINER" 10 | - "RUN" 11 | - "CMD" 12 | - "EXPOSE" 13 | - "ENV" 14 | - "ADD" 15 | - "COPY" 16 | - "ENTRYPOINT" 17 | - "VOLUME" 18 | - "USER" 19 | - "WORKDIR" 20 | - "ONBUILD" 21 | instruction_regex: /(\\w+)\\s(.+$)/ 22 | valid_instruction_regex: /^(CMD|FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)(\s)?/i 23 | ignore_regex: /^#/ 24 | multiline_regex: /\\$/ 25 | line_rules: 26 | FROM: 27 | paramSyntaxRegex: /^[a-z0-9./-]+(:[a-z0-9.]+)?$/ 28 | rules: 29 | - 30 | label: "is_latest_tag" 31 | regex: /latest/ 32 | level: "info" 33 | message: "base image uses 'latest' tag" 34 | description: "using the 'latest' tag may cause unpredictable builds. It is recommended that a specific tag is used in the FROM line." 35 | reference_url: 36 | - "https://docs.docker.com/reference/builder/" 37 | - "#from" 38 | - 39 | label: "no_tag" 40 | regex: /^[:]/ 41 | level: "warn" 42 | message: "No tag is used" 43 | description: "lorem ipsum tar" 44 | reference_url: 45 | - "https://docs.docker.com/reference/builder/" 46 | - "#from" 47 | MAINTAINER: 48 | paramSyntaxRegex: /.+/ 49 | rules: [] 50 | RUN: 51 | paramSyntaxRegex: /.+/ 52 | rules: 53 | - 54 | label: "no_yum_clean_all" 55 | regex: /yum ((?!clean all).)* .+/ 56 | level: "warn" 57 | message: "yum clean all is not used" 58 | description: "the yum cache will remain in this layer making the layer unnecessarily large" 59 | reference_url: "None" 60 | - 61 | label: "installing_ssh" 62 | regex: /ssh/ 63 | level: "warn" 64 | message: "installing SSH in a container is not recommended" 65 | description: "Do you really need SSH in this image?" 66 | reference_url: "https://github.com/jpetazzo/nsenter" 67 | CMD: 68 | paramSyntaxRegex: /.+/ 69 | rules: [] 70 | EXPOSE: 71 | paramSyntaxRegex: /^[0-9]+([0-9\s]+)?$/ 72 | rules: [] 73 | ENV: 74 | paramSyntaxRegex: /^[a-zA-Z_]+[a-zA-Z0-9_]* .+$/ 75 | rules: [] 76 | ADD: 77 | paramSyntaxRegex: /^(~?[A-z0-9\/_.-]+|https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*))\s~?[A-z0-9\/_.-]+$/ 78 | COPY: 79 | paramSyntaxRegex: /.+/ 80 | rules: [] 81 | ENTRYPOINT: 82 | paramSyntaxRegex: /.+/ 83 | rules: [] 84 | VOLUME: 85 | paramSyntaxRegex: /^~?([A-z0-9\/_.-]+|\["[A-z0-9\/_.-]+"\])$/ 86 | rules: [] 87 | USER: 88 | paramSyntaxRegex: /^[a-z_][a-z0-9_]{0,30}$/ 89 | rules: [] 90 | WORKDIR: 91 | paramSyntaxRegex: /^~?[A-z0-9\/_.-]+$/ 92 | rules: [] 93 | ONBUILD: 94 | paramSyntaxRegex: /.+/ 95 | rules: [] 96 | required_instructions: 97 | - 98 | instruction: "MAINTAINER" 99 | count: 1 100 | level: "info" 101 | message: "Maintainer is not defined" 102 | description: "The MAINTAINER line is useful for identifying the author in the form of MAINTAINER Joe Smith " 103 | reference_url: 104 | - "https://docs.docker.com/reference/builder/" 105 | - "#maintainer" 106 | - 107 | instruction: "ENTRYPOINT" 108 | count: 1 109 | level: "info" 110 | message: "There is no 'ENTRYPOINT' instruction" 111 | description: "None" 112 | reference_url: 113 | - "https://docs.docker.com/reference/builder/" 114 | - "#entrypoint" 115 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecation notice: 2 | ## This repository is now deprecated and will soon be archived. 3 | ## The Newman Docker images are now a part of https://github.com/postmanlabs/newman. For more context, see https://github.com/postmanlabs/newman/pull/1397. 4 | ## All issues, questions, feature requests or discussions about the Newman Docker image(s) should be shifted to https://github.com/postmanlabs/newman/issues 5 | 6 | 7 | 8 | # newman-docker 9 | 10 | This repository contains docker images for Newman. 11 | 12 | Newman is a command-line collection runner for 13 | Postman. It allows you to effortlessly run and test a 14 | Postman Collections directly from the 15 | command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous 16 | integration servers and build systems. 17 | 18 | **New to Docker?** Docker allows you to package an application with all of its dependencies into a standardised unit for 19 | software development. Visit 20 | https://www.docker.com/whatisdocker to read more about 21 | how docker can drastically simplify development and deployment. 22 | 23 | ## Using the docker image 24 | 25 | The docker image for Newman is available for download from our docker hub. You must have Docker installed in your 26 | system. Docker has extensive installation guideline for 27 | popular operating systems. Choose your operating system and follow the instructions. 28 | 29 | > Ensure you that you have docker installed and running in your system before proceeding with next steps. A quick test 30 | > to see if docker is installed correctly is to execute the command `docker run hello-world` and it should run without 31 | > errors. 32 | 33 | **Step 1:** 34 | 35 | Pull the newman docker 36 | image from docker hub: 37 | 38 | ```terminal 39 | docker pull postman/newman_ubuntu1404 40 | ``` 41 | 42 | **Step 2:** 43 | 44 | Run newman commands on the image: 45 | 46 | ```terminal 47 | docker run -t postman/newman_ubuntu1404 run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda" 48 | ``` 49 | 50 | ### Build the docker image from this repository 51 | 52 | 53 | **Step 1:** 54 | 55 | Clone this repository: 56 | 57 | ```terminal 58 | git clone https://github.com/postmanlabs/newman-docker.git 59 | ``` 60 | 61 | **Step 2:** 62 | 63 | Build the image: 64 | 65 | ```terminal 66 | docker build -t postman/newman_ubuntu1404 ubuntu1404 67 | ``` 68 | 69 | **Step 3:** 70 | 71 | Run a collection using the newman image: 72 | 73 | ```terminal 74 | docker run -t postman/newman_ubuntu1404 run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda" 75 | ``` 76 | 77 | 78 | ## Running local collection files 79 | 80 | This docker image is designed to pick files from the `/etc/newman` directory within the image. You may mount the 81 | directory of your collection files into that location and provide the file references in standard newman parameters. 82 | 83 | 84 | ```terminal 85 | # Mount host collections folder ~/collections, onto /etc/newman on the docker image, so that newman 86 | # has access to collections 87 | docker run -v ~/collections:/etc/newman -t postman/newman_ubuntu1404 run "HTTPBinNewmanTestNoEnv.json.postman_collection" 88 | ``` 89 | 90 | You are not required to mount a volume if you do not need to save newman report to the host, and your collection is 91 | available online, unless your collection requires an environment(as environments cannot be passed as URLs). 92 | 93 | To know more about mounting volumes, visit 94 | docker documentation on shared data volumes. 95 | 96 | 97 | ## Examples 98 | 99 | Run a local collection, pass an environment to it, and save the HTML report on the host. 100 | 101 | ```terminal 102 | docker run -v ~/collections:/etc/newman -t postman/newman_ubuntu1404 \ 103 | run "HTTPBinNewmanTest.json.postman_collection" \ 104 | --environment="HTTPBinNewmanTestEnv.json.postman_environment" \ 105 | --reporters="html,cli" --reporter-html-export="newman-results.html" 106 | ``` 107 | 108 |
Run a remote collection, pass it a local environment, and save JUnit XML test report on the host 109 | 110 | ```terminal 111 | docker run -v ~/collections:/etc/newman -t postman/newman_ubuntu1404 \ 112 | run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda" \ 113 | --environment="HTTPBinNewmanTestEnv.json.postman_environment" \ 114 | --reporters="junit,cli" --reporter-junit-export="newman-report.xml" 115 | ``` 116 | 117 |
Use a script to run a collection and do something, for example deploy the build, if all the tests pass 118 | 119 | ```bash 120 | #/bin/bash 121 | 122 | # stop on first error 123 | set -e; 124 | 125 | function onExit { 126 | if [ "$?" != "0" ]; then 127 | echo "Tests failed"; 128 | # build failed, don't deploy 129 | exit 1; 130 | else 131 | echo "Tests passed"; 132 | # deploy build 133 | fi 134 | } 135 | 136 | # call onExit when the script exits 137 | trap onExit EXIT; 138 | 139 | docker run -t postman/newman_ubuntu1404 run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda" --suppress-exit-code; 140 | ``` 141 | 142 | [![Analytics](https://ga-beacon.appspot.com/UA-43979731-9/newman-docker/readme)](https://www.getpostman.com) 143 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to newman-docker 2 | 3 | ## tl;dr 4 | 5 | Use [git-flow](http://nvie.com/posts/a-successful-git-branching-model/). 6 | 7 | - Create a feature branch off of `develop` 8 | 9 | ```bash 10 | git checkout develop 11 | git checkout -b feature/my-feature 12 | ``` 13 | 14 | - Make your changes, and run tests to ensure that everything works 15 | 16 | ```bash 17 | npm test 18 | ``` 19 | 20 | - If all checks out, push your code and create a pull with `develop` as the target 21 | 22 | ```bash 23 | git push feature/my-feature 24 | ``` 25 | 26 | ## Branching and Tagging Policy 27 | 28 | This repository uses standard `git-flow` branch management policy/strategy. If you want to learn more on `git-flow`, refer to [tutorial from Atlassian](https://www.atlassian.com/git/workflows#!workflow-gitflow) and more details at [http://nvie.com/posts/a-successful-git-branching-model/](http://nvie.com/posts/a-successful-git-branching-model/). 29 | 30 | 31 | ## Preferred IDE 32 | The preferred IDE for this project is SublimeText. You can download it from [http://www.sublimetext.com](http://www.sublimetext.com). 33 | 34 | The repository has a sublime project file included in `develop/` directory. This project is configured with the best practices recommended for `xt-edge`. Things like using 120 character ruler, addition of end-of-file newline, cleaning up of trailing whitespace has been configured in this project. 35 | 36 | There are a number of SublimeText Plugins that you can use to make your life simpler. One of them is the `jsDoc` autocompletion plugin. Download it from [https://github.com/spadgos/sublime-jsdocs](https://github.com/spadgos/sublime-jsdocs). 37 | 38 | > *It is expected that changes to the file `/postman-documentator.sublime-project` is not committed back in the repository without proper discussion with all primary contributors of this project.* 39 | 40 | ### Generic IDE Settings 41 | 42 | Most IDE settings for Sublime Text resides within the project configuration file `./develop/xt-edge.sublime-project`. In case you are using any other IDE, (not recommended,) setting the following defaults of the IDE should help. 43 | 44 | 1. Set to true to ensure the last line of the file ends in a newline character when saving. 45 | 2. Use 120the columns to display vertical ruler. 46 | 3. The number of spaces a tab is considered equal should be 4. 47 | 4. Insert spaces when tab is pressed. 48 | 5. Remove trailing white space on save. 49 | 6. Always use UTF-8 character encoding for reading and writing files. 50 | 7. Set IDE to not change file permissions upon editing. 51 | 52 | 53 | ## Commit Guidelines 54 | 55 | The following best practices, coupled with a pinch of common-sense will keep the repository clean and usable in future. The idea is that everything that goes into the repository is not for an individual, but someone else who will be directly or indirectly affected by it. 56 | 57 | ### Check for errors before committing 58 | 59 | Checking for errors should be done for each commit whether it is being pushed to remote or not. 60 | 61 | First, you don't want to submit any whitespace errors. Git provides an easy way to check for this — before you commit, run `git diff --check`, which identifies possible whitespace errors and lists them for you. If you run that command before committing, you can tell if you're about to commit whitespace issues that may annoy other developers. 62 | 63 | Secondly, you should ensure that your commit does not break builds. Run `npm test` on the repository to execute all sanity and smoke tests. If any test fail, do not change the test to pass your commit. The tests were there with a purpose. Discuss within your team to ensure that the changes that you do to test specs are valid. If you are adding a new feature, accompanying them with new tests are a good practice. 64 | 65 | ### Atomic commits 66 | 67 | Try to make each commit a logically separate changeset. If you can, try to make your changes digestible — don't code for a whole weekend on five different issues and then submit them all as one massive commit on Monday. Even if you don't commit during the weekend, use the staging area on Monday to split your work into at least one commit per issue, with a useful message per commit. If some of the changes modify the same file, try to use `git add --patch` to partially stage files. The project snapshot at the tip of the branch is identical whether you do one commit or five, as long as all the changes are added at some point, so try to make things easier on your fellow developers when they have to review your changes. This approach also makes it easier to pull out or revert one of the changesets if you need to later. There are a number of useful Git tricks for rewriting history and interactively staging files — use these tools to help craft a clean and understandable history. 68 | 69 | ### Clean commit message 70 | 71 | *More detailed explanation include your motivation for the change and contrast its implementation with previous behavior — this is a good guideline to follow.* 72 | 73 | Getting in the habit of creating quality commit messages makes using and collaborating with Git a lot easier. As a general rule, your messages should start with a single line that’s no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation. 74 | 75 | It's also a good idea to use the imperative present tense in these messages. In other words, use commands. Instead of "I added tests for" or "Adding tests for," use "Add tests for." 76 | 77 | You should see if your commit message answers the following questions: 78 | Answer the following questions: 79 | 80 | 1. **Why is this change necessary?** 81 | 2. **How does it address the issue?** 82 | 3. **What side effects does this change have?** 83 | 84 | The first question tells reviewers of your pull request what to expect in the commit, allowing them to more easily identify and point out unrelated changes. 85 | 86 | The second question describes, at a high level, what was done to affect change. If your change is obvious, you may be able to omit addressing this question. 87 | 88 | The third is the most important question to answer, as it can point out problems where you are making too many changes in one commit or branch. One or two bullet points for related changes may be okay, but five or six are likely indicators of a commit that is doing too many things. 89 | 90 | A good commit message template 91 | 92 | ``` 93 | Short (50 chars or less) summary of changes with relevant project management issue ID. 94 | 95 | More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. In some contexts, the first line is treated as the subject of an email and the rest of the text as the body. The blank line separating the summary from the body is critical (unless you omit the body entirely); tools like rebase can get confused if you run the two together. 96 | 97 | Further paragraphs come after blank lines. 98 | 99 | - Bullet points are okay, too 100 | 101 | - Typically a hyphen or asterisk is used for the bullet, preceded by a single space, with blank lines in between, but conventions vary here 102 | ``` 103 | 104 | Run `git log --no-merges` to see what a nicely formatted project-commit history looks like. 105 | 106 | ## Documentation guidelines 107 | 108 | ~~ to be documented further ~~ 109 | 110 | ## The CI Platform 111 | 112 | The CI system is built as a bunch of bash scripts to execute a set of tasks. These scripts are meant to execute tasks that can run on every local machine. In general, knowledge about these scripts are not necessary for development. 113 | 114 | **The scripts are to be only accessed using `npm run-script script name`.** This ensures that the execution point of the scripts (`pwd`) is always the repository root. 115 | 116 | ### Ensuring your commits will not fail build 117 | 118 | > `npm test` 119 | 120 | The script associated with `npm test` will run all tests that ensures that your commit does not break anything in the repository. As such run `npm test` before you push. 121 | 122 | --- 123 | *Sections of this document uses excerpts from various books and the Internet. [http://git-scm.com/book/](http://git-scm.com/book/) is one of the dominating influencers.* 124 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2015 Postdot Technologies Pvt. Ltd. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | --------------------------------------------------------------------------------