Add airship container cleanup

Closes: #546

Change-Id: I623694327bd6cc7dea616c109a7dcb7d97420be9
This commit is contained in:
Kostiantyn Kalynovskyi 2021-05-17 17:55:41 +00:00 committed by Kostyantyn Kalynovskyi
parent 8d882fcc85
commit a121a88a97
2 changed files with 5 additions and 3 deletions

View File

@ -112,6 +112,11 @@ func (c *clientV1Alpha1) runAirship() error {
if err != nil {
return err
}
defer func(container Container) {
if rmErr := container.RmContainer(); rmErr != nil {
log.Printf("Failed to remove container with id '%s', err is '%s'", container.GetID(), rmErr.Error())
}
}(cont)
// this will split the env vars into the ones to be exported and the ones that have values
contEnv := runtimeutil.NewContainerEnvFromStringSlice(c.conf.Spec.EnvVars)

View File

@ -37,9 +37,6 @@ done
echo "List generated images"
ls -lth ${IMAGE_DIR}
echo "Remove the container used for image generation"
sudo docker rm $(docker ps -a -f status=exited -q)
#cleanup the directories
if [ "${CLEANUP_SERVE_DIR}" == "true" ] || [ "${CLEANUP_SERVE_DIR}" == "True" ]; then
echo "Clean directories used by image-builder"