Skip to content

Commit f9b3681

Browse files
committed
scripts: Add set-image-pull-policy.sh script
1 parent 5180380 commit f9b3681

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

scripts/set-image-pull-policy.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2019-2020 Intel Corporation.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
# Invoke this script with a imagePullPolicy as parameter
8+
# and it will update all hard-coded imagePullPolicy
9+
# in the deployments, demos and controller code
10+
#
11+
# Adapted from https://github.com/intel/pmem-csi/
12+
13+
if [[ $# != 1 ]] || [[ "$1" == "?" ]] || [[ "$1" == "--help" ]] ||
14+
[[ ! $1 =~ IfNotPresent|Always ]]; then
15+
echo "Usage: $0 <IfNotPresent|Always>" >&2
16+
exit 1
17+
fi
18+
19+
IMAGE_PULL_POLICY=$1
20+
21+
echo IMAGE_PULL_POLICY=$IMAGE_PULL_POLICY
22+
23+
sed -i -e "s;\(imagePullPolicy\:\ \).*;\1$IMAGE_PULL_POLICY;" $(git grep -l 'imagePullPolicy' deployments/*.yaml demo/*.yaml)
24+
25+
sed -i -e "s;\(ImagePullPolicy\:\ \).*;\1\"$IMAGE_PULL_POLICY\",;" $(git grep -l 'ImagePullPolicy' pkg/controllers/*/*.go)

0 commit comments

Comments
 (0)