Skip to content

Commit fa5b288

Browse files
Bot Updating Templated Files
1 parent df5f5fa commit fa5b288

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

Jenkinsfile

+26-7
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,21 @@ pipeline {
5656
steps{
5757
echo "Running on node: ${NODE_NAME}"
5858
sh '''#! /bin/bash
59-
containers=$(docker ps -aq)
59+
echo "Pruning builder"
60+
docker builder prune -f --builder container || :
61+
containers=$(docker ps -q)
6062
if [[ -n "${containers}" ]]; then
61-
docker stop ${containers}
63+
BUILDX_CONTAINER_ID=$(docker ps -qf 'name=buildx_buildkit')
64+
for container in ${containers}; do
65+
if [[ "${container}" == "${BUILDX_CONTAINER_ID}" ]]; then
66+
echo "skipping buildx container in docker stop"
67+
else
68+
echo "Stopping container ${container}"
69+
docker stop ${container}
70+
fi
71+
done
6272
fi
63-
docker system prune -af --volumes || : '''
73+
docker system prune -f --volumes || : '''
6474
script{
6575
env.EXIT_STATUS = ''
6676
env.LS_RELEASE = sh(
@@ -1152,12 +1162,21 @@ EOF
11521162
}
11531163
cleanup {
11541164
sh '''#! /bin/bash
1155-
echo "Performing docker system prune!!"
1156-
containers=$(docker ps -aq)
1165+
echo "Pruning builder!!"
1166+
docker builder prune -f --builder container || :
1167+
containers=$(docker ps -q)
11571168
if [[ -n "${containers}" ]]; then
1158-
docker stop ${containers}
1169+
BUILDX_CONTAINER_ID=$(docker ps -qf 'name=buildx_buildkit')
1170+
for container in ${containers}; do
1171+
if [[ "${container}" == "${BUILDX_CONTAINER_ID}" ]]; then
1172+
echo "skipping buildx container in docker stop"
1173+
else
1174+
echo "Stopping container ${container}"
1175+
docker stop ${container}
1176+
fi
1177+
done
11591178
fi
1160-
docker system prune -af --volumes || :
1179+
docker system prune -f --volumes || :
11611180
'''
11621181
cleanWs()
11631182
}

0 commit comments

Comments
 (0)