puppet-openstack-integration/playbooks/run-lint-tests.yaml
Takashi Kajinami c03f2eaf7a Unpin bundler
The bundler library has been pinned to 2.2.11 but this is quite old.
This attempts to remove that pin and use the latest version instead.

Depends-on: https://review.opendev.org/c/openstack/puppet-openstack_spec_helper/+/900787
Change-Id: I1575f435a1248762602c376a2fafca16b0a7958d
2023-12-19 07:56:57 +00:00

43 lines
1.8 KiB
YAML

- hosts: all
tasks:
- shell:
cmd: |
set -e
if [ -f metadata.json ]; then
MODULE=$(python3 -c 'import json;print(json.load(open("metadata.json"))["name"])')
if [ -z "$MODULE" ]; then
echo "Module name not defined in metadata.json"
else
mkdir -p "$MODULE"
rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE"
cd "$MODULE"
fi
fi
mkdir .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
export GEM_BIN_DIR=$GEM_HOME/bin
if [ -f Gemfile ]; then
ruby <<EOF
cmd = 'gem install bundler --no-document --verbose --no-user-install --bindir=${GEM_BIN_DIR}'
system(cmd)
EOF
$GEM_BIN_DIR/bundle config set --local without system_tests
$GEM_BIN_DIR/bundle install --retry 3
$GEM_BIN_DIR/bundle exec rake lint 2>&1
if [ -f metadata.json ]; then
$GEM_BIN_DIR/bundle exec rake metadata_lint 2>&1
fi
else
gem install rake -n ./.bundled_gems/ --no-document --no-user-install
gem install puppet-lint -n ./.bundled_gems/ --no-document --no-user-install
gem install metadata-json-lint -n ./.bundled_gems/ --no-document --no-user-install
gem install puppetlabs_spec_helper -n ./.bundled_gems/ --no-document --no-user-install
gem install puppet -n ./.bundled_gems/ --no-document --no-user-install
./.bundled_gems/rake lint 2>&1
if [ -f metadata.json ]; then
./.bundled_gems/metadata-json-lint
fi
fi
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'