Skip to content

Commit

Permalink
[chore] Upgrade CI workers for ansible tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax committed Jan 13, 2025
1 parent 2036d5a commit a4b1ad5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 98 deletions.
39 changes: 18 additions & 21 deletions .github/workflows/ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ jobs:

lint:
name: Lint
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
Expand All @@ -56,8 +55,7 @@ jobs:
linux-test:
name: Linux Test
needs: lint
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
Expand All @@ -66,19 +64,19 @@ jobs:
- ansible~=9.2.0
- ansible~=8.7.0
distro:
- amazonlinux2
- amazonlinux2023
- centos8
- centos9
- debian9
- debian10
- debian11
- debian12
- opensuse12
- ubuntu1604
- ubuntu1804
- ubuntu2004
- ubuntu2204
- amazonlinux-2
- amazonlinux-2023
- centos-8.5
- centos-stream-9
- debian-9
- debian-10
- debian-11
- debian-12
- opensuse-13.2
- ubuntu-16.04
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-22.04
exclude:
# ansible-core used by ansible 9.2.0 requires a minimum of Python2 version 2.7 or Python3 version 3.6. Current version: 3.5.2
- distro: ubuntu1604
Expand Down Expand Up @@ -115,11 +113,11 @@ jobs:
pip3 install --use-pep517 -r ${GITHUB_WORKSPACE}/requirements.txt
- name: Run Molecule tests.
run: molecule --debug -v --base-config ./molecule/config/docker.yml test --all
run: molecule --debug -v --base-config ./molecule/config/linux.yml test --all
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
MOLECULE_VAGRANT_BOX: bento/${{ matrix.distro }}

windows-test:
name: Windows Test
Expand Down Expand Up @@ -196,8 +194,7 @@ jobs:
push-release-tag:
name: Push Release Tag
needs: lint
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
Expand Down
52 changes: 9 additions & 43 deletions deployments/ansible/contributing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if your change affects behavior of the Ansible collection.
Testing and validation of this Ansible role is based on
[Ansible Molecule](https://molecule.readthedocs.io).

### MacOS or Windows setup
### Setup

Development of the role can be done on MacOS or Windows machines. Make sure the
following software is installed:
Expand All @@ -37,22 +37,25 @@ pip3 install -r requirements-dev-macos.txt

#### Linux Testing

Use the following arguments with every molecule command
`--base-config ./molecule/config/vagrant.yml`.
Set `MOLECULE_VAGRANT_BOX` env var to the desired Vagrant box, e.g.:

```sh
export MOLECULE_VAGRANT_BOX=bento/ubuntu-24.04
```

To setup test VMs:
```sh
molecule --base-config ./molecule/config/vagrant.yml create
molecule --base-config ./molecule/config/linux.yml create
```

To apply Molecule test playbooks:
```sh
molecule --base-config ./molecule/config/vagrant.yml converge
molecule --base-config ./molecule/config/linux.yml converge
```

To run the full test suite:
```sh
molecule --base-config ./molecule/config/vagrant.yml test --all
molecule --base-config ./molecule/config/linux.yml test --all
```

#### Windows Testing
Expand Down Expand Up @@ -92,43 +95,6 @@ To add new Windows platform definitions or to modify/remove existing ones:
[ansible GitHub workflow](../../../.github/workflows/ansible.yml) when the
changes are ready for review.

### Linux setup

Development on a Linux machine is simpler, all you need is docker.

Make sure the following software is installed:

- [Docker](https://docs.docker.com/get-docker/)
- [Python3](https://www.python.org/downloads)
- Python packages:
- ansible
- molecule
- molecule-docker

Installation steps for Linux:

1. Make sure Python 3 and [pip](https://pip.pypa.io/en/stable/installing/) are installed : `pip3 --version`
1. Make sure Docker is installed and can be managed by the current user: `docker ps`
1. Install python packages: `pip3 install -r requirements-dev-linux.txt`

Use the following arguments with every molecule command
`--base-config ./molecule/config/docker.yml`.

To setup test docker containers:
```sh
molecule --base-config ./molecule/config/docker.yml create
```

To apply Molecule playbooks:
```sh
molecule --base-config ./molecule/config/docker.yml converge
```

To run the full test suite:
```sh
molecule --base-config ./molecule/config/docker.yml test --all
```

## Making new release of the Ansible Collection

To cut a new release of the Ansible Collection, just bump the version in
Expand Down
25 changes: 0 additions & 25 deletions deployments/ansible/molecule/config/docker.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ driver:
provider:
name: virtualbox
platforms:
- name: focal64
box: ubuntu/focal64
- name: centos8
box: centos/8
- name: buster64
box: debian/buster64
- name: amazonlinux
box: bento/amazonlinux-2
- name: instance
box: ${MOLECULE_VAGRANT_BOX}
cpus: 2
memory: 4096
provider_options:
gui: false
linked_clone: true
provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../roles
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}

0 comments on commit a4b1ad5

Please sign in to comment.