Skip to content

Ansible lint vars

Ansible lint vars #399

Workflow file for this run

---
name: VM lint workflow
on:
pull_request:
push:
branches:
- main
jobs:
Ansible:
name: Run Ansible lint tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
pip3 install ansible ansible-lint yamllint
- name: Create log directory
run: |
sudo mkdir /var/log/vmtools/
sudo chmod 777 /var/log/vmtools/
- name: Run ansible-lint
run: |
ansible-lint -R -r lintrules/ansible
- name: Run actions yamllint
run: |
yamllint .github/workflows/*yml
Packer:
name: Run Packer lint tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Hashicorp repo
run: >
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor |
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg &&
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg]
https://apt.releases.hashicorp.com $(lsb_release -cs) main" |
sudo tee /etc/apt/sources.list.d/hashicorp.list
- name: Install Packer
run: |
sudo apt-get update
sudo apt-get install -y -qq packer
- name: Packer validate
run: |
# Allow beta/test builds to fail validation
packer validate -var-file=mint-beta.pkrvars.hcl . || true
# This runs last to ensure it's exit status is captured
packer validate .
working-directory: packer
- name: Check Packer HCL formatting
run: |
packer fmt -diff -check .
working-directory: packer
Python:
name: Run Python lint tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get -q install python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev gir1.2-vte-2.91
- name: Install dependencies
run: |
pip3 install pyyaml pygobject pylint click PyGithub jinja2 aiohttp pyxdg
- name: Run pylint
run: |
pylint roles/*/*/*.py scripts/*.py
Shell:
name: Run Shell linting
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install shellcheck
run: |
sudo apt-get -q install shellcheck
# The profile is currently empty when placed on the machine; however, that
# may not always be the case. The file is shell code and should be linted
# as such.
- name: Run Shellcheck
run: |
shellcheck --shell=bash scripts/oem-build roles/user/files/csvmprofile
Hashes:
name: Validate file hashes
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
pip3 install aiohttp jinja2 pyyaml
- name: Configure download cache
uses: actions/cache@v3
with:
path: ~/.cache/hashlint
key: hashlint-cache-${{ github.sha }}
restore-keys:
hashlint-cache-
- name: Run hash validation
run: |
python3 scripts/hashlint.py