diff options
| -rw-r--r-- | .gitlab-ci.yml | 3 | ||||
| -rw-r--r-- | Dockerfile | 4 | ||||
| -rw-r--r-- | Dockerfile.tools | 2 | ||||
| -rwxr-xr-x | bin/docker-build | 4 | ||||
| -rwxr-xr-x | bin/lint | 3 | ||||
| -rw-r--r-- | config/.bashrc | 7 | ||||
| -rwxr-xr-x | run.sh | 6 |
7 files changed, 15 insertions, 14 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c54db43..07dde62 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,8 +39,7 @@ build commit: script: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - - docker pull $TOOLS_IMAGE || true - - docker build --cache-from $TOOLS_IMAGE --build-arg IMAGE_VERSION=$CI_COMMIT_BRANCH -t $TMP_IMAGE . + - docker build --build-arg TOOLS_IMAGE=$TOOLS_IMAGE -t $TMP_IMAGE . - docker push $TMP_IMAGE container_scanning: @@ -1,4 +1,4 @@ -ARG IMAGE_VERSION=latest +ARG TOOLS_IMAGE=registry.gitlab.com/gitlab-org/security-products/license-management/tools:master FROM debian:stable-slim AS gem-builder ENV LM_HOME=/opt/license-management @@ -24,7 +24,7 @@ RUN apt-get update -q \ #COPY config/01_nodoc /etc/dpkg/dpkg.cfg.d/01_nodoc #RUN bash /root/install.sh && bash -lc 'scrub' -FROM registry.gitlab.com/gitlab-org/security-products/license-management/tools:${IMAGE_VERSION} +FROM ${TOOLS_IMAGE} ENV LM_HOME=/opt/license-management COPY --from=gem-builder /opt/license-management/*.gem $LM_HOME/ RUN bash -lc 'gem install "$LM_HOME/*.gem"' diff --git a/Dockerfile.tools b/Dockerfile.tools index 2bfc19a..9974dcf 100644 --- a/Dockerfile.tools +++ b/Dockerfile.tools @@ -6,4 +6,4 @@ ENV HOME=/root WORKDIR $HOME COPY config /root COPY config/01_nodoc /etc/dpkg/dpkg.cfg.d/01_nodoc -RUN bash /root/install.sh && bash -lc 'scrub' +RUN bash /root/install.sh diff --git a/bin/docker-build b/bin/docker-build index 1a4a985..64486b9 100755 --- a/bin/docker-build +++ b/bin/docker-build @@ -5,7 +5,7 @@ set -e cd "$(dirname "$0")/.." IMAGE_NAME=${IMAGE_NAME:-$(basename "$PWD"):latest} -TOOLS_IMAGE=${TOOLS_IMAGE:-registry.gitlab.com/gitlab-org/security-products/license-management/tools:latest} +TOOLS_IMAGE=${TOOLS_IMAGE:-$(basename "$PWD")/tools:master} docker build -t "$TOOLS_IMAGE" -f Dockerfile.tools --pull . -docker build --cache-from "$TOOLS_IMAGE" -t "$IMAGE_NAME" . +docker build --build-arg TOOLS_IMAGE="$TOOLS_IMAGE" -t "$IMAGE_NAME" . @@ -1,6 +1,7 @@ #!/bin/sh +shellcheck bin/* +shellcheck config/*.sh shellcheck config/.bashrc shellcheck config/.profile -shellcheck config/*.sh # shellcheck run.sh diff --git a/config/.bashrc b/config/.bashrc index 8d1ed76..d86120a 100644 --- a/config/.bashrc +++ b/config/.bashrc @@ -26,6 +26,7 @@ function switch_to() { } function scrub() { + rm -fr "$ASDF_DATA_DIR/docs" rm -fr "$ASDF_DATA_DIR/installs/**/**/share" rm -fr "$ASDF_DATA_DIR/installs/java/**/man" rm -fr "$ASDF_DATA_DIR/installs/python/**/lib/**/test" @@ -48,9 +49,9 @@ if [ -n "$LM_PYTHON_VERSION" ]; then switch_to python "$MAJOR_VERSION" python --version pip --version - #export LICENSE_FINDER_CLI_OPTS="--python-version $MAJOR_VERSION $LICENSE_FINDER_CLI_OPTS" -#else - #export LICENSE_FINDER_CLI_OPTS="--python-version 3 $LICENSE_FINDER_CLI_OPTS" + export LICENSE_FINDER_CLI_OPTS="--python-version $MAJOR_VERSION $LICENSE_FINDER_CLI_OPTS" +else + export LICENSE_FINDER_CLI_OPTS="--python-version 3 $LICENSE_FINDER_CLI_OPTS" fi switch_to java "adopt-openjdk-${LM_JAVA_VERSION:-8}" @@ -82,11 +82,11 @@ case "$COMMAND" in asdf current if [[ -z "${SETUP_CMD}" ]]; then asdf install + license_management ignored_groups add development + license_management ignored_groups add test + # Before running license_finder, we need to install dependencies for the project. if test -f Gemfile ; then - # Ignore test and development dependencies. - license_finder ignored_groups add development - license_finder ignored_groups add test bundle install --jobs $(nproc) skip_prepare=true fi |
