diff options
| author | mo khan <mo.khan@gmail.com> | 2020-07-06 11:03:35 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-07-10 08:53:37 -0600 |
| commit | 36cdb0040abda394264455a1fdf3d6782af95ceb (patch) | |
| tree | 54093c956c0f4dcf4c2ad352847017aee9a88edc /bin | |
| parent | c7385965b4166fb6ab2db3387c67cd54aef1b8df (diff) | |
Isolate license_management ruby from project
* Target ruby version 2.7.1
* Add spec to fetch gems from a custom source
* Add proxy to rubygems.org config
* Specify default env vars to support offline environment
* Cleanup custom certificates after spec
* Inline docker-test script
* Do not install license_finder with each installed ruby
* Increase gem log verbosity and include backtrace
* Extract test fixtures for the different ruby scenarios
* Find *.gemspec files in gems dir
* Use RUBYLIB to hijack src path
* Run scan from project path dir
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/docker-build | 4 | ||||
| -rwxr-xr-x | bin/docker-shell | 4 | ||||
| -rwxr-xr-x | bin/lint | 4 | ||||
| -rwxr-xr-x | bin/omnibus | 46 | ||||
| -rwxr-xr-x | bin/setup | 11 | ||||
| -rwxr-xr-x | bin/test | 9 |
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' @@ -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 @@ -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 @@ -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 |
