summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorCan Eldem <celdem@gitlab.com>2020-07-10 16:41:15 +0000
committerCan Eldem <celdem@gitlab.com>2020-07-10 16:41:15 +0000
commitc17546f6cfccf07d27f7984321fe62a7788e8da1 (patch)
tree54093c956c0f4dcf4c2ad352847017aee9a88edc /bin
parentc7385965b4166fb6ab2db3387c67cd54aef1b8df (diff)
parent36cdb0040abda394264455a1fdf3d6782af95ceb (diff)
Merge branch '217897-isolated-omnibus-lm' into 'master'v3.17.0
Isolate license_management ruby from project ruby See merge request gitlab-org/security-products/license-management!181
Diffstat (limited to 'bin')
-rwxr-xr-xbin/docker-build4
-rwxr-xr-xbin/docker-shell4
-rwxr-xr-xbin/lint4
-rwxr-xr-xbin/omnibus46
-rwxr-xr-xbin/setup11
-rwxr-xr-xbin/test9
6 files changed, 67 insertions, 11 deletions
diff --git a/bin/docker-build b/bin/docker-build
index ba694f1..6f111fe 100755
--- a/bin/docker-build
+++ b/bin/docker-build
@@ -6,10 +6,10 @@ cd "$(dirname "$0")/.."
LATEST_IMAGE=${LATEST_IMAGE:='registry.gitlab.com/gitlab-org/security-products/license-management:latest'}
IMAGE_NAME=${IMAGE_NAME:-$(basename "$PWD"):latest}
+export DOCKER_BUILDKIT=1
if command -v docker; then
- docker pull $LATEST_IMAGE
- docker build --network=host --cache-from "$LATEST_IMAGE" -t "$IMAGE_NAME" .
+ docker build --progress=plain --network=host --cache-from "$LATEST_IMAGE" -t "$IMAGE_NAME" .
else
echo "Install docker: https://docs.docker.com/engine/installation/"
exit 1
diff --git a/bin/docker-shell b/bin/docker-shell
index 617492a..c6c03a0 100755
--- a/bin/docker-shell
+++ b/bin/docker-shell
@@ -9,5 +9,5 @@ IMAGE_NAME=${IMAGE_NAME:-$(basename "$PWD"):latest}
docker run --rm -it \
--entrypoint='' \
--network=host \
- --volume "$PWD":/opt/license-management \
- "$IMAGE_NAME" /bin/bash -l
+ --volume "$PWD":/builds/gitlab-org/security-products/license-management \
+ "$IMAGE_NAME" sh -c 'cd /builds/gitlab-org/security-products/license-management && exec bash -l'
diff --git a/bin/lint b/bin/lint
index 97cb1c3..dada38c 100755
--- a/bin/lint
+++ b/bin/lint
@@ -5,8 +5,8 @@ set -e
cd "$(dirname "$0")/.."
shellcheck bin/*
-shellcheck config/.bashrc
-shellcheck config/.profile
+shellcheck config/files/.bashrc
+shellcheck config/files/.profile
shellcheck config/*.sh
shellcheck run.sh
bundle exec rubocop
diff --git a/bin/omnibus b/bin/omnibus
new file mode 100755
index 0000000..526b8d7
--- /dev/null
+++ b/bin/omnibus
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+cd "$(dirname "$0")/.."
+
+case $1 in
+ setup)
+ apt-get update -q
+ apt-get install -y --no-install-recommends \
+ autoconf \
+ automake \
+ bison \
+ build-essential \
+ ca-certificates \
+ cmake \
+ curl \
+ fakeroot \
+ gettext \
+ git \
+ libdb-dev \
+ libffi-dev \
+ libgdbm-dev \
+ libgdbm6 \
+ libncurses5-dev \
+ libreadline6-dev \
+ libssl-dev \
+ libtool \
+ libtool-bin \
+ libyaml-dev \
+ maven \
+ python3 \
+ ruby \
+ ruby-dev \
+ zlib1g-dev \
+ zstd
+
+ gem install bundler
+ bundle install
+ ;;
+
+ build)
+ for i in "$@"; do :; done
+ bundle exec omnibus build -l debug "$i"
+ ;;
+esac
diff --git a/bin/setup b/bin/setup
index b54a99f..03f0938 100755
--- a/bin/setup
+++ b/bin/setup
@@ -1,11 +1,16 @@
-#!/bin/sh
+#!/bin/bash -l
set -e
cd "$(dirname "$0")/.."
-gem install bundler --conservative -v '~> 2.0' -q
-bundle install --quiet
+export PATH="/builds/gitlab-org/security-products/license-management/exe:/opt/gitlab/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
if [ ! -f /usr/sbin/haproxy ] && command -v apt-get; then
apt-get update -y && apt-get install -y --no-install-recommends haproxy
fi
+
+[[ -z "$CI_JOB_ID" ]] && enable_dev_mode
+bundle config --local path vendor
+bundle config --local jobs "$(nproc)"
+bundle install
diff --git a/bin/test b/bin/test
index 218224d..a05c7e7 100755
--- a/bin/test
+++ b/bin/test
@@ -1,8 +1,13 @@
-#!/bin/sh
+#!/bin/bash -l
set -e
cd "$(dirname "$0")/.."
-./bin/setup
+export PATH="/builds/gitlab-org/security-products/license-management/exe:/opt/gitlab/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+export RUBYLIB="/builds/gitlab-org/security-products/license-management/lib"
+
+if ! command -v bundle; then
+ ./bin/setup
+fi
bundle exec rspec "$@" --format=progress --tag ~environment:offline