From d1dc731c79bdc728679d33c5cce176a1964da449 Mon Sep 17 00:00:00 2001 From: Gregory Hellings Date: Thu, 15 Apr 2021 00:26:44 -0500 Subject: [PATCH 1/2] Improve release process Release is now done by creating a release on GitHub Change testing environments to podman from Docker Add .cache to gitignore No need to putz with paths, as molecule and ansible-lint handle this now passwordless_ssh needs to run systemd Chrony test seems to need a VM --- .github/workflows/tox.yml | 71 +++++-------------- .gitignore | 1 + roles/chrony/molecule/container/molecule.yml | 10 +++ .../{docker => container}/molecule.yml | 0 .../{docker => container}/molecule.yml | 0 .../{docker => container}/molecule.yml | 0 .../{docker => container}/playbook.yml | 0 .../{docker => container}/molecule.yml | 0 .../{docker => container}/molecule.yml | 0 .../molecule/container}/molecule.yml | 2 +- .../molecule/docker/molecule.yml | 5 -- .../{docker => container}/molecule.yml | 0 .../{docker => container}/tests/test_null.py | 0 .../{docker => container}/molecule.yml | 0 .../{docker => container}/molecule.yml | 0 .../molecule/{docker => container}/tests | 0 .../molecule.yml | 0 .../playbook.yml | 0 .../tests/test_package_install.py | 0 .../{docker => container}/molecule.yml | 0 .../{docker => container}/molecule.yml | 0 21 files changed, 29 insertions(+), 60 deletions(-) create mode 100644 roles/chrony/molecule/container/molecule.yml rename roles/cockpit/molecule/{docker => container}/molecule.yml (100%) rename roles/disk_wipe/molecule/{docker => container}/molecule.yml (100%) rename roles/nfs_server/molecule/{docker => container}/molecule.yml (100%) rename roles/nfs_server/molecule/{docker => container}/playbook.yml (100%) rename roles/package_updater/molecule/{docker => container}/molecule.yml (100%) rename roles/passwd/molecule/{docker => container}/molecule.yml (100%) rename roles/{chrony/molecule/docker => passwordless_ssh/molecule/container}/molecule.yml (84%) delete mode 100644 roles/passwordless_ssh/molecule/docker/molecule.yml rename roles/register_idm/molecule/{docker => container}/molecule.yml (100%) rename roles/register_idm/molecule/{docker => container}/tests/test_null.py (100%) rename roles/sshd/molecule/{docker => container}/molecule.yml (100%) rename roles/system_repositories/molecule/{docker => container}/molecule.yml (100%) rename roles/system_repositories/molecule/{docker => container}/tests (100%) rename roles/system_repositories/molecule/{docker_fedora => container_fedora}/molecule.yml (100%) rename roles/system_repositories/molecule/{docker_fedora => container_fedora}/playbook.yml (100%) rename roles/system_repositories/molecule/{docker_fedora => container_fedora}/tests/test_package_install.py (100%) rename roles/update_ca_trust/molecule/{docker => container}/molecule.yml (100%) rename roles/users_and_groups/molecule/{docker => container}/molecule.yml (100%) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index c0004859..a68c6fdc 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -5,45 +5,34 @@ on: pull_request: {} schedule: - cron: '12 0 * * *' + release: + types: + - published + - prereleased env: TOX_ANSIBLE_DRIVER: docker - ANSIBLE_COLLECTIONS_PATHS: ~/.ansible/:~/work/ + ANSIBLE_COLLECTIONS_PATH: ~/.ansible:~/work checkout_path: ansible_collections/oasis_roles/system jobs: collect: runs-on: ubuntu-latest outputs: - scenarios: ${{ steps.collection.outputs.scenarios }} + scenarios: ${{ steps.collection.outputs.tox-envs }} steps: - uses: actions/checkout@v2 with: submodules: 'recursive' - - name: Setup pip cache - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: pip-modules - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 + - name: Set up Python + uses: actions/setup-python@v2 - name: Install dependencies run: | set -ex - python -m pip install --upgrade pip - pip install tox tox-ansible + python -m pip install --upgrade tox - name: collect depenencies id: collection - run: | - set -ex - json="[" - for x in $(tox -l --ansible-driver docker); do - json="${json}\"${x}\"," - done - json="${json%,}]" - echo "::set-output name=scenarios::${json}" + uses: greg-hellings/tox-list@v1 build: needs: collect @@ -61,15 +50,8 @@ jobs: run: | cd "${{ env.checkout_path }}" git submodule update --remote --recursive - - name: Setup pip cache - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: pip-modules - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 + - name: Set up Python + uses: actions/setup-python@v2 - name: Install dependencies run: | set -ex @@ -77,41 +59,22 @@ jobs: sudo apt-get install -y libapt-pkg-dev build-essential python3-setuptools python3-apt python -m pip install --upgrade pip pip install -U setuptools wheel - pip install tox tox-ansible + pip install tox - name: Run tox against ${{ matrix.scenario }} run: | set -ex - # There is some magic in the "mv" command that makes ansible-galaxy work - # I haven't found any logic for it, but if you don't do this mv, then - # the dependency step in molecule when run from tox will fail - mv ansible_collections ~/work/ + mv ansible_collections ~/work cd ~/work/${{ env.checkout_path }} tox -e ${{ matrix.scenario }} release: needs: build # Only release if the build is good - if: startsWith(github.ref, 'refs/tags/') # Only release if there is a tag that's been pushed to the repo + if: github.event_name == 'release' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: submodules: 'recursive' - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install pip - run: | - python -m pip install --upgrade pip - pip install ansible - - name: Create release artifacts - run: | - ansible-galaxy collection build - ansible-galaxy collection publish *.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }} - - name: Release artifacts to Git Hub - uses: ncipollo/release-action@v1 + - uses: artis3n/ansible_galaxy_collection@v2.2.1 with: - artifacts: ./oasis_roles-system*.tar.gz - allowUpdates: true - name: Release ${{ github.ref }} - token: ${{ secrets.GITHUB_TOKEN }} + api_key: ${{ secrets.GALAXY_API_KEY }} diff --git a/.gitignore b/.gitignore index 41667488..3e2377bd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ __pycache__ *.tar.gz .tox junit.xml +.cache # Ansible Tower license files roles/ansible_tower/molecule/default/license.json diff --git a/roles/chrony/molecule/container/molecule.yml b/roles/chrony/molecule/container/molecule.yml new file mode 100644 index 00000000..a35f8f15 --- /dev/null +++ b/roles/chrony/molecule/container/molecule.yml @@ -0,0 +1,10 @@ +driver: + name: vagrant + provider: + name: libvirt +platforms: + - name: chrony-vagrant + box: generic/rhel8 + config_options: + synced_folder: false + cachier: false diff --git a/roles/cockpit/molecule/docker/molecule.yml b/roles/cockpit/molecule/container/molecule.yml similarity index 100% rename from roles/cockpit/molecule/docker/molecule.yml rename to roles/cockpit/molecule/container/molecule.yml diff --git a/roles/disk_wipe/molecule/docker/molecule.yml b/roles/disk_wipe/molecule/container/molecule.yml similarity index 100% rename from roles/disk_wipe/molecule/docker/molecule.yml rename to roles/disk_wipe/molecule/container/molecule.yml diff --git a/roles/nfs_server/molecule/docker/molecule.yml b/roles/nfs_server/molecule/container/molecule.yml similarity index 100% rename from roles/nfs_server/molecule/docker/molecule.yml rename to roles/nfs_server/molecule/container/molecule.yml diff --git a/roles/nfs_server/molecule/docker/playbook.yml b/roles/nfs_server/molecule/container/playbook.yml similarity index 100% rename from roles/nfs_server/molecule/docker/playbook.yml rename to roles/nfs_server/molecule/container/playbook.yml diff --git a/roles/package_updater/molecule/docker/molecule.yml b/roles/package_updater/molecule/container/molecule.yml similarity index 100% rename from roles/package_updater/molecule/docker/molecule.yml rename to roles/package_updater/molecule/container/molecule.yml diff --git a/roles/passwd/molecule/docker/molecule.yml b/roles/passwd/molecule/container/molecule.yml similarity index 100% rename from roles/passwd/molecule/docker/molecule.yml rename to roles/passwd/molecule/container/molecule.yml diff --git a/roles/chrony/molecule/docker/molecule.yml b/roles/passwordless_ssh/molecule/container/molecule.yml similarity index 84% rename from roles/chrony/molecule/docker/molecule.yml rename to roles/passwordless_ssh/molecule/container/molecule.yml index a49e0d0b..07869b85 100644 --- a/roles/chrony/molecule/docker/molecule.yml +++ b/roles/passwordless_ssh/molecule/container/molecule.yml @@ -1,7 +1,7 @@ driver: name: docker platforms: - - name: chrony_docker + - name: passwordless_ssh_docker image: centos/systemd privileged: true command: /usr/lib/systemd/systemd --system diff --git a/roles/passwordless_ssh/molecule/docker/molecule.yml b/roles/passwordless_ssh/molecule/docker/molecule.yml deleted file mode 100644 index 6b540976..00000000 --- a/roles/passwordless_ssh/molecule/docker/molecule.yml +++ /dev/null @@ -1,5 +0,0 @@ -driver: - name: docker -platforms: - - name: passwordless_ssh_docker - image: centos:7 diff --git a/roles/register_idm/molecule/docker/molecule.yml b/roles/register_idm/molecule/container/molecule.yml similarity index 100% rename from roles/register_idm/molecule/docker/molecule.yml rename to roles/register_idm/molecule/container/molecule.yml diff --git a/roles/register_idm/molecule/docker/tests/test_null.py b/roles/register_idm/molecule/container/tests/test_null.py similarity index 100% rename from roles/register_idm/molecule/docker/tests/test_null.py rename to roles/register_idm/molecule/container/tests/test_null.py diff --git a/roles/sshd/molecule/docker/molecule.yml b/roles/sshd/molecule/container/molecule.yml similarity index 100% rename from roles/sshd/molecule/docker/molecule.yml rename to roles/sshd/molecule/container/molecule.yml diff --git a/roles/system_repositories/molecule/docker/molecule.yml b/roles/system_repositories/molecule/container/molecule.yml similarity index 100% rename from roles/system_repositories/molecule/docker/molecule.yml rename to roles/system_repositories/molecule/container/molecule.yml diff --git a/roles/system_repositories/molecule/docker/tests b/roles/system_repositories/molecule/container/tests similarity index 100% rename from roles/system_repositories/molecule/docker/tests rename to roles/system_repositories/molecule/container/tests diff --git a/roles/system_repositories/molecule/docker_fedora/molecule.yml b/roles/system_repositories/molecule/container_fedora/molecule.yml similarity index 100% rename from roles/system_repositories/molecule/docker_fedora/molecule.yml rename to roles/system_repositories/molecule/container_fedora/molecule.yml diff --git a/roles/system_repositories/molecule/docker_fedora/playbook.yml b/roles/system_repositories/molecule/container_fedora/playbook.yml similarity index 100% rename from roles/system_repositories/molecule/docker_fedora/playbook.yml rename to roles/system_repositories/molecule/container_fedora/playbook.yml diff --git a/roles/system_repositories/molecule/docker_fedora/tests/test_package_install.py b/roles/system_repositories/molecule/container_fedora/tests/test_package_install.py similarity index 100% rename from roles/system_repositories/molecule/docker_fedora/tests/test_package_install.py rename to roles/system_repositories/molecule/container_fedora/tests/test_package_install.py diff --git a/roles/update_ca_trust/molecule/docker/molecule.yml b/roles/update_ca_trust/molecule/container/molecule.yml similarity index 100% rename from roles/update_ca_trust/molecule/docker/molecule.yml rename to roles/update_ca_trust/molecule/container/molecule.yml diff --git a/roles/users_and_groups/molecule/docker/molecule.yml b/roles/users_and_groups/molecule/container/molecule.yml similarity index 100% rename from roles/users_and_groups/molecule/docker/molecule.yml rename to roles/users_and_groups/molecule/container/molecule.yml From 29fb598a1baa597ea87c63c9f23f318b00e064d4 Mon Sep 17 00:00:00 2001 From: Gregory Hellings Date: Thu, 15 Apr 2021 08:18:57 -0500 Subject: [PATCH 2/2] Update tests submodule --- tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests b/tests index fac26fc9..5baf21aa 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit fac26fc92cbba60eb2c5318308b745b70676a5fa +Subproject commit 5baf21aa0baf92334ce1088526ad6e0d998ac3a2