Change the entrypoint of the image to always use bash

To fix the kubectl version in the commit that it depends on, the
CUSTOMIZATION variable of the file
stx-platformclients.stable_docker_image had to be used.

But when we are building a new image with CUSTOMIZATION, the
build-stx-images.sh script put a CMD ["bash"] in the image, making the
old way to call commands in stx-platformclients to no longer work.

This commit solves this issue, by forcing the entrypoint to always
use bash and making all commands run as with "bash -c <command>"

Test Plan:
- Tested this change with new and old stx-platformclients versions.
  It work with the image that has the kubectl fix and the older ones.

Partial-Bug: #1955427
Depends-on: https://review.opendev.org/c/starlingx/upstream/+/822356

Signed-off-by: Thiago Miranda <ThiagoOliveira.Miranda@windriver.com>
Change-Id: Ieae227daee875bc4b4b42509cbcb78350360d02c
This commit is contained in:
Thiago Miranda 2021-12-20 14:33:45 -05:00
parent 34e46bcdd9
commit 2ca858a604
1 changed files with 4 additions and 4 deletions

View File

@ -85,11 +85,11 @@ else
fi
if [[ "$FORCE_SHELL" == "true" ]]; then
exec ${SHELL_COMMAND} run --rm --network host -ti ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
exec ${SHELL_COMMAND} run --rm --network host -ti ${COMMAND_ENV} ${VOLUME_LIST} --entrypoint /bin/bash --workdir /wd ${CLIENT_IMAGE_NAME} -c "$*"
elif [[ "$FORCE_NO_SHELL" == "true" ]]; then
exec ${SHELL_COMMAND} run --rm --network host -t ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
exec ${SHELL_COMMAND} run --rm --network host -t ${COMMAND_ENV} ${VOLUME_LIST} --entrypoint /bin/bash --workdir /wd ${CLIENT_IMAGE_NAME} -c "$*"
elif [ -z "$2" ]; then
exec ${SHELL_COMMAND} run --rm --network host -ti ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
exec ${SHELL_COMMAND} run --rm --network host -ti ${COMMAND_ENV} ${VOLUME_LIST} --entrypoint /bin/bash --workdir /wd ${CLIENT_IMAGE_NAME} -c "$*"
else
exec ${SHELL_COMMAND} run --rm --network host -t ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
exec ${SHELL_COMMAND} run --rm --network host -t ${COMMAND_ENV} ${VOLUME_LIST} --entrypoint /bin/bash --workdir /wd ${CLIENT_IMAGE_NAME} -c "$*"
fi