Skip to content

added vagrant logs #145

added vagrant logs

added vagrant logs #145

name: Verify the Baseline using Vagrant
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
my-job:
name: Validate my profile
runs-on: macos-12
env:
CHEF_LICENSE: accept-silent
KITCHEN_LOCAL_YAML: kitchen.vagrant.yml
VAGRANT_DISABLE_VBOXSYMLINKCREATE: 1
VAGRANT_LOG: debug
strategy:
matrix:
suite: ['vanilla', 'hardened']
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Vagrant boxes
# Caches that are not accessed within the last week will be evicted
# (see https://github.com/actions/cache#cache-limits)
uses: actions/cache@v3
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Cache Vagrant VMs
# Caches that are not accessed within the last week will be evicted
# (see https://github.com/actions/cache#cache-limits)
uses: actions/cache@v3
with:
path: "~/VirtualBox VMs"
key: ${{ runner.os }}-vagrant-vms-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-vms-
- name: Show Vagrant version
run: vagrant --version
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
- name: Disable ri and rdoc
run: 'echo "gem: --no-ri --no-rdoc" >> ~/.gemrc'
- run: bundle install
# - name: Regenerate current `profile.json`
# run: |
# bundle exec inspec json . | jq . > profile.json
# - name: Lint the Inspec profile
# run: bundle exec inspec check .
- name: Run kitchen test
run: bundle exec kitchen test --destroy=always ${{ matrix.suite }}-ubuntu-1804 || true
- name: Save Test Result JSON
uses: actions/upload-artifact@v2
with:
path: spec/results/
- name: Display our ${{ matrix.suite }} results summary
run: bundle exec inspec_tools summary -j spec/results/ubuntu-18.04_${{ matrix.suite }}.json --json-counts | jq .
- name: Ensure the scan meets our ${{ matrix.suite }} results threshold
run: bundle exec inspec_tools compliance -j spec/results/ubuntu-18.04_${{ matrix.suite }}.json -f ${{ matrix.suite }}.threshold.yml