fix role tests

Ansible role tests were failing due to ansible-lint reporting
multiple errors.

Fixing those errors resolves the failing tests.

Switching gcsfuse to use gcloud's bootstrap to follow the current
docker install instructions.

Removing centos as it's a discontinued distribution.

Adding a check to ensure integration tests are skipped unless they
are run by a branch (a public fork does not pass required
integration test credentials).
This commit is contained in:
Yusuke Tsutsumi 2022-11-26 07:00:46 +00:00 committed by Yusuke Tsutsumi
commit f692dd4c76
21 changed files with 113 additions and 96 deletions

View file

@ -1,8 +1,5 @@
name: "Run integration tests for the cloud.google collection"
on:
# NOTE: GitHub does not allow secrets to be used
# in PRs sent from forks. As such, this configuration is for
# PRs that the maintainers would like to send to test.
pull_request: {}
push:
branches: master
@ -11,6 +8,10 @@ env:
GCP_PROJECT: "ansible-gcp-ci"
jobs:
integration:
# NOTE: GitHub does not allow secrets to be used
# in PRs sent from forks. As such, this configuration is for
# PRs that the maintainers would like to send to test.
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
defaults:
run:

View file

@ -22,17 +22,6 @@ jobs:
molecule_playbook:
- archive_playbook.yml
- package_playbook.yml
molecule_distro:
- distro: centos:7
command: /usr/sbin/init
- distro: centos:8
command: /usr/sbin/init
- distro: ubuntu:18.04
command: /lib/systemd/systemd
- distro: ubuntu:20.04
command: /lib/systemd/systemd
- distro: debian:9
command: /lib/systemd/systemd
collection_role:
- gcloud
steps:
@ -58,14 +47,12 @@ jobs:
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
python -m pip install --upgrade pip
pip install molecule yamllint ansible ansible-lint docker \
molecule[docker]
pip install molecule[docker] yamllint ansible ansible-lint docker
- name: Run role test
run: >-
molecule --version &&
ansible --version &&
MOLECULE_COMMAND=${{ matrix.molecule_distro.command }}
MOLECULE_DISTRO=${{ matrix.molecule_distro.distro }}
MOLECULE_PLAYBOOK=${{ matrix.molecule_playbook }}
MOLECULE_NO_LOG="false"
molecule --debug test -s ${{ matrix.collection_role }}

View file

@ -17,13 +17,6 @@ jobs:
strategy:
fail-fast: false
matrix:
molecule_distro:
- distro: ubuntu:16.04
command: /sbin/init
- distro: ubuntu:18.04
command: /lib/systemd/systemd
- distro: debian:9
command: /lib/systemd/systemd
collection_role:
- gcsfuse
steps:
@ -39,14 +32,21 @@ jobs:
- name: Install dependencies
run: |
sudo apt install docker
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg \
--dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
python -m pip install --upgrade pip
pip install molecule yamllint ansible-lint docker
pip install molecule[docker] yamllint ansible ansible-lint docker
- name: Run role test
run: >-
molecule --version &&
ansible --version &&
MOLECULE_COMMAND=${{ matrix.molecule_distro.command }}
MOLECULE_DISTRO=${{ matrix.molecule_distro.distro }}
MOLECULE_NO_LOG="false"
molecule --debug test -s ${{ matrix.collection_role }}