aboutsummaryrefslogtreecommitdiff
path: root/test_image.sh
diff options
context:
space:
mode:
authorGiancarlo Rubio <gianrubio@gmail.com>2017-01-24 11:19:44 +0100
committerGiancarlo Rubio <gianrubio@gmail.com>2017-04-12 10:47:21 +0200
commit14382439345d42c8e6e449c3b271e91296d8a568 (patch)
tree2c19d6d3a925e89620a660c8d526a19fcb99854e /test_image.sh
parent6eafa51fa81b24b50dd819a47540db2db8948a39 (diff)
downloadprometheus_node_collector-14382439345d42c8e6e449c3b271e91296d8a568.tar.bz2
prometheus_node_collector-14382439345d42c8e6e449c3b271e91296d8a568.tar.xz
prometheus_node_collector-14382439345d42c8e6e449c3b271e91296d8a568.zip
test docker image before pushing
Diffstat (limited to 'test_image.sh')
-rwxr-xr-xtest_image.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/test_image.sh b/test_image.sh
new file mode 100755
index 0000000..c23523a
--- /dev/null
+++ b/test_image.sh
@@ -0,0 +1,29 @@
1#!/bin/bash
2set -exo pipefail
3
4docker_image=$1
5port=$2
6
7wait_start() {
8 for in in {1..10}; do
9 if /usr/bin/curl -s -m 5 -f "http://localhost:${port}/metrics" > /dev/null ; then exit 0 ;
10 else
11 sleep 1
12 fi
13 done
14
15 exit 1
16
17}
18
19docker_start() {
20 docker run -d -p "${port}":"${port}" "${docker_image}"
21}
22
23if [[ "$#" -ne 2 ]] ; then
24 echo "Usage: $0 quay.io/prometheus/node-exporter:v0.13.0 9100" >&2
25 exit 1
26fi
27
28docker_start
29wait_start