summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-02-20 16:35:27 -0700
committermo khan <mo.khan@gmail.com>2020-02-20 16:35:27 -0700
commit3bcad0265e0a00d083f44bc42adbdbca77cffbcd (patch)
treeeed70805982d718427540c202788d70cbaa0a738
parent87bc4c78940f28e3dd5a71ca549ae595c41e8351 (diff)
Extract TOOLS_IMAGE build arg
-rw-r--r--.gitlab-ci.yml3
-rw-r--r--Dockerfile4
-rw-r--r--Dockerfile.tools2
-rwxr-xr-xbin/docker-build4
-rwxr-xr-xbin/lint3
-rw-r--r--config/.bashrc7
-rwxr-xr-xrun.sh6
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:
diff --git a/Dockerfile b/Dockerfile
index dbb310e..daf9f32 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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" .
diff --git a/bin/lint b/bin/lint
index 3b6db15..faf1cd4 100755
--- a/bin/lint
+++ b/bin/lint
@@ -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}"
diff --git a/run.sh b/run.sh
index 139ffe8..3ca5583 100755
--- a/run.sh
+++ b/run.sh
@@ -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