Habitat should install inspec-bin and activate inspec from that

Signed-off-by: tyler-ball <tball@chef.io>
This commit is contained in:
tyler-ball 2019-04-26 11:34:08 -06:00
parent 8bed893da2
commit 60125d890b
3 changed files with 15 additions and 4 deletions

View file

@ -6,6 +6,8 @@ product_key: inspec
rubygems:
- inspec
- inspec-core
- inspec-bin:
gemspec_path: ./inspec-bin/
docker_images:
- inspec:

View file

@ -5,9 +5,11 @@ ARG VERSION=3.9.0
ARG GEM_SOURCE=https://rubygems.org
RUN mkdir -p /share
RUN apk add --update build-base libxml2-dev libffi-dev git openssh-client && \
gem install --no-document --source ${GEM_SOURCE} --version ${VERSION} inspec && \
apk del build-base
RUN apk add --update build-base libxml2-dev libffi-dev git openssh-client
RUN gem install --no-document --source ${GEM_SOURCE} --version ${VERSION} inspec
RUN gem install --no-document --source ${GEM_SOURCE} --version ${VERSION} inspec-bin
RUN apk del build-base
ENTRYPOINT ["inspec"]
CMD ["help"]
VOLUME ["/share"]

View file

@ -39,12 +39,19 @@ do_build() {
pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname/"
gem build inspec.gemspec
popd
pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname/inspec-bin"
gem build inspec-bin.gemspec
popd
}
do_install() {
# MUST install inspec first because inspec-bin depends on it via gemspec
pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname/"
gem install inspec-*.gem --no-document
popd
pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname/inspec-bin"
gem install inspec-bin*.gem --no-document
popd
wrap_inspec_bin
@ -56,7 +63,7 @@ do_install() {
# Need to wrap the InSpec binary to ensure paths are correct
wrap_inspec_bin() {
local bin="$pkg_prefix/bin/$pkg_name"
local real_bin="$GEM_HOME/gems/inspec-${pkg_version}/bin/inspec"
local real_bin="$GEM_HOME/gems/inspec-bin-${pkg_version}/bin/inspec"
build_line "Adding wrapper $bin to $real_bin"
cat <<EOF > "$bin"
#!$(pkg_path_for core/bash)/bin/bash