puppet-openstack-integration/playbooks/run-lint-tests.yaml
Takashi Kajinami 4d2d86e0df pin bundler to 2.2.11
It seems the latest 2.2.12 requires rake>13.0 installed and that
requirement doesn't work well in current our CI jobs.
Let's pin it to the previous version until we resolve the issue.

This change also removes the pin for the very old Ruby version.

Closes-Bug: #1917457
Change-Id: I62f35dce338ae186a217dd1d0a141d3a737243a0
2021-03-02 23:03:10 +09:00

47 lines
1.9 KiB
YAML

- hosts: all
tasks:
- shell:
cmd: |
set -e
if [ -f Modulefile -o -f metadata.json ]; then
if [ -f Modulefile ]; then
MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
elif [ -f metadata.json ]; then
MODULE=$(python3 -c 'import json;print(json.load(open("metadata.json"))["name"])')
fi
if [ -z "$MODULE" ]; then
echo "Module name not defined in Modulefile or 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}'
cmd += ' -v 2.2.11'
system(cmd)
EOF
$GEM_BIN_DIR/bundle install --without system_tests --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 }}'