Skip to content

Commit

Permalink
fix: proper initialize v2 tools
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Nov 12, 2024
1 parent 9598048 commit dfaf7ae
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
33 changes: 20 additions & 13 deletions src/usr/local/containerbase/bin/init-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@ set -e
# shellcheck source=/dev/null
. /usr/local/containerbase/util.sh

function main() {
local TOOL_NAME

TOOL_NAME=${1}
check TOOL_NAME true

V2_TOOL="${CONTAINERBASE_DIR}/tools/v2/${TOOL_NAME}.sh"
V2_TOOL="${CONTAINERBASE_DIR}/tools/v2/${TOOL_NAME}.sh"

if [[ -f "$V2_TOOL" ]]; then
# init v2 tool
# load overrides needed for v2 tools
# shellcheck source=/dev/null
. "${CONTAINERBASE_DIR}/utils/v2/overrides.sh"
# shellcheck source=/dev/null
. "${V2_TOOL}"
init_v2_tool
else
echo "No tool defined - skipping: ${TOOL_NAME}" >&2
exit 1;
fi
if [[ -f "$V2_TOOL" ]]; then
# init v2 tool
# load overrides needed for v2 tools
# shellcheck source=/dev/null
. "${CONTAINERBASE_DIR}/utils/v2/overrides.sh"
# shellcheck source=/dev/null
. "${V2_TOOL}"
init_v2_tool
else
echo "No tool defined - skipping: ${TOOL_NAME}" >&2
exit 1;
fi
}

main "$@"
16 changes: 16 additions & 0 deletions test/golang/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,24 @@ FROM base AS testc

RUN prepare-tool golang

# emulate emtpy containerbase folders
RUN set -ex; \
ls -la /tmp/containerbase/cache; \
rm -rf /opt/containerbase/*; \
ls -la /opt/containerbase/; \
rm -rf /tmp/*; \
ls -la /tmp/; \
ls -la /var/lib/containerbase/; \
cat /var/lib/containerbase/tool.prep; \
true

USER 12021

RUN [[ ! -d /tmp/containerbase ]] || (echo "/tmp/containerbase should not exist"; exit 1 )
RUN containerbase-cli init tool golang
RUN [[ -d /tmp/containerbase ]] || (echo "/tmp/containerbase should exist"; exit 1)
RUN rm -rf /tmp/*;

# renovate: datasource=github-releases packageName=containerbase/golang-prebuild
RUN install-tool golang 1.23.3

Expand Down
2 changes: 1 addition & 1 deletion test/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ RUN set -ex; \
ls -la /opt/containerbase; \
ls -la /tmp/containerbase; \
ls -la /tmp/containerbase/cache; \
true;true
true

RUN prepare-tool node

Expand Down

0 comments on commit dfaf7ae

Please sign in to comment.