Skip to content

Commit 094eafd

Browse files
Bot Updating Templated Files
1 parent 2c5af2e commit 094eafd

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

Jenkinsfile

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,21 @@ pipeline {
5858
steps{
5959
echo "Running on node: ${NODE_NAME}"
6060
sh '''#! /bin/bash
61-
containers=$(docker ps -aq)
61+
echo "Pruning builder"
62+
docker builder prune -f --builder container || :
63+
containers=$(docker ps -q)
6264
if [[ -n "${containers}" ]]; then
63-
docker stop ${containers}
65+
BUILDX_CONTAINER_ID=$(docker ps -qf 'name=buildx_buildkit')
66+
for container in ${containers}; do
67+
if [[ "${container}" == "${BUILDX_CONTAINER_ID}" ]]; then
68+
echo "skipping buildx container in docker stop"
69+
else
70+
echo "Stopping container ${container}"
71+
docker stop ${container}
72+
fi
73+
done
6474
fi
65-
docker system prune -af --volumes || : '''
75+
docker system prune -f --volumes || : '''
6676
script{
6777
env.EXIT_STATUS = ''
6878
env.LS_RELEASE = sh(
@@ -1092,12 +1102,21 @@ EOF
10921102
}
10931103
cleanup {
10941104
sh '''#! /bin/bash
1095-
echo "Performing docker system prune!!"
1096-
containers=$(docker ps -aq)
1105+
echo "Pruning builder!!"
1106+
docker builder prune -f --builder container || :
1107+
containers=$(docker ps -q)
10971108
if [[ -n "${containers}" ]]; then
1098-
docker stop ${containers}
1109+
BUILDX_CONTAINER_ID=$(docker ps -qf 'name=buildx_buildkit')
1110+
for container in ${containers}; do
1111+
if [[ "${container}" == "${BUILDX_CONTAINER_ID}" ]]; then
1112+
echo "skipping buildx container in docker stop"
1113+
else
1114+
echo "Stopping container ${container}"
1115+
docker stop ${container}
1116+
fi
1117+
done
10991118
fi
1100-
docker system prune -af --volumes || :
1119+
docker system prune -f --volumes || :
11011120
'''
11021121
cleanWs()
11031122
}

0 commit comments

Comments
 (0)