-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.xml
More file actions
29 lines (27 loc) · 1.05 KB
/
tasks.xml
File metadata and controls
29 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<task id="pull_docker_images">
for image in $(printenv | grep '_docker_image=' | grep -v "grep" | cut -f1 -d'='); do
image_value=${!image}
if [[ -n "$image_value" ]]; then
if docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^$image_value$"; then
echo "Docker image $image_value already exists locally. Skipping pull."
else
echo "Pulling Docker image: $image_value"
docker pull "$image_value"
fi
else
echo "Warning: Variable $image has an empty value"
fi
done
</task>
<task id="cleanup_docker_images">
for image in $(printenv | grep '_docker_image=' | grep -v "grep" | cut -f1 -d'='); do
image_value=${!image}
if [[ -n "$image_value" ]]; then
if docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^$image_value$"; then
docker rmi "$image_value"
fi
else
echo "Warning: Variable $image has an empty value"
fi
done
</task>