File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- set -xuo pipefail
2+ set -euo pipefail
3+ set -x
34#
45# Use this script to avoid image pull getting stuck once MicroShift tries to
56# do so in runtime.
67#
8+ PULL_CMD=${PULL_CMD:- " sudo crictl pull" }
79
810function pull_image() {
911 local -r image=$1
1012 local rc=0
1113 for _ in $( seq 3) ; do
12- timeout 5m sudo crictl pull " ${image} " && return
14+ # shellcheck disable=SC2086
15+ timeout 5m ${PULL_CMD} " ${image} " && return
1316 rc=$?
1417 sleep 1
1518 done
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
99# shellcheck source=test/bin/common.sh
1010source " ${SCRIPTDIR} /common.sh"
1111
12+ LOKI_IMAGE=" docker.io/grafana/loki"
1213DEFAULT_HOST_PORT=" 3100"
1314
1415usage () {
@@ -38,14 +39,17 @@ action_start() {
3839 local host_port=" ${1:- ${DEFAULT_HOST_PORT} } "
3940 local container_name=" loki"
4041
42+ # Prefetch the image with retries
43+ PULL_CMD=" podman pull" " ${SCRIPTDIR} /../../scripts/pull_retry.sh" " ${LOKI_IMAGE} "
44+
4145 echo " Stopping previous instance of Loki container ${container_name} (if any)"
4246 action_stop " ${host_port} "
4347
4448 echo " Starting Loki container ${container_name} on host port ${host_port} "
4549 podman run -d --rm --name " ${container_name} " \
4650 -p " ${host_port} :3100" \
4751 --user root \
48- docker.io/grafana/loki > /dev/null
52+ " ${LOKI_IMAGE} " > /dev/null
4953}
5054
5155if [ $# -eq 0 ]; then
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1010source " ${SCRIPTDIR} /common.sh"
1111
1212PROMETHEUS_DIR=" ${IMAGEDIR} /prometheus"
13+ PROMETHEUS_IMAGE=" quay.io/prometheus/prometheus"
1314DEFAULT_HOST_PORT=" 9091"
1415
1516usage () {
@@ -40,6 +41,9 @@ action_start() {
4041 local host_port=" ${1:- ${DEFAULT_HOST_PORT} } "
4142 local container_name=" prometheus"
4243
44+ # Prefetch the image with retries
45+ PULL_CMD=" podman pull" " ${SCRIPTDIR} /../../scripts/pull_retry.sh" " ${PROMETHEUS_IMAGE} "
46+
4347 mkdir -p " ${PROMETHEUS_DIR} "
4448 PROM_CONFIG=" ${PROMETHEUS_DIR} /prometheus.yml"
4549 # Empty configuration file will take all defaults.
@@ -54,7 +58,7 @@ action_start() {
5458 podman run -d --rm --name " ${container_name} " \
5559 -p " ${host_port} :9090" \
5660 -v " ${PROMETHEUS_DIR} :/etc/prometheus:Z" \
57- quay.io/prometheus/prometheus \
61+ " ${PROMETHEUS_IMAGE} " \
5862 --config.file=/etc/prometheus/prometheus.yml \
5963 --web.enable-remote-write-receiver > /dev/null
6064}
You can’t perform that action at this time.
0 commit comments