From 218e19bbdd87b9d23f6562b31222d2813d0d00a9 Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Thu, 9 Jan 2020 07:15:21 +0100 Subject: [PATCH] Add a mapping from `meta/main.yml` to `.travis.yml` and GitHub Actions. --- templates/ansible.yml.j2 | 92 ++++++--------------------------------- templates/molecule.yml.j2 | 2 +- templates/travis.yml.j2 | 73 +------------------------------ vars/main.yml | 56 ++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 151 deletions(-) diff --git a/templates/ansible.yml.j2 b/templates/ansible.yml.j2 index 789dba0..581b82c 100644 --- a/templates/ansible.yml.j2 +++ b/templates/ansible.yml.j2 @@ -17,8 +17,6 @@ jobs: - name: molecule uses: robertdebock/molecule-action@1.1.3 with: - image: {% raw %}${{ matrix.image }}{% endraw %} - entrypoint: /usr/local/bin/molecule args: lint test: @@ -26,85 +24,17 @@ jobs: - lint runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - image: + config: {% for platform in meta.galaxy_info.platforms %} -{% if platform.name == "Amazon" %} - - amazonlinux -{% elif platform.name == "EL" %} - - centos -{% else %} - - {{ platform.name | lower }} -{% endif %} +{% for version in platform.versions %} +{% for tag in distribution_version_mapping[platform.name][version] %} + - image: "{{ platform_image_mapping[platform.name] }}" + tag: "{{ tag }}" +{% endfor %} +{% endfor %} {% endfor %} - tag: - - 1 - - 7 - - edge - - latest - - rawhide - - unstable - exclude: - - image: alpine - tag: 1 - - image: alpine - tag: 7 - - image: alpine - tag: rawhide - - image: alpine - tag: unstable - - image: amazonlinux - tag: 7 - - image: amazonlinux - tag: edge - - image: amazonlinux - tag: rawhide - - image: amazonlinux - tag: unstable - - image: debian - tag: 1 - - image: debian - tag: 7 - - image: debian - tag: edge - - image: debian - tag: rawhide - - image: centos - tag: 1 - - image: centos - tag: edge - - image: centos - tag: rawhide - - image: centos - tag: unstable - - image: fedora - tag: 1 - - image: fedora - tag: 7 - - image: fedora - tag: edge - - image: fedora - tag: unstable - - image: opensuse - tag: 1 - - image: opensuse - tag: 7 - - image: opensuse - tag: edge - - image: opensuse - tag: rawhide - - image: opensuse - tag: unstable - - image: ubuntu - tag: 1 - - image: ubuntu - tag: 7 - - image: ubuntu - tag: edge - - image: ubuntu - tag: rawhide - - image: ubuntu - tag: unstable steps: - name: checkout uses: actions/checkout@v2 @@ -118,10 +48,14 @@ jobs: - name: molecule uses: robertdebock/molecule-action@1.1.3 with: - image: {% raw %}${{ matrix.image }}{% endraw %} + image: {% raw %}${{ matrix.config.image }}{% endraw %} + + tag: {% raw %}${{ matrix.config.tag }}{% endraw %} {% if tox_parallel is defined %} {% if tox_parallel %} options: "--parallel all" + env: + TOX_PARALLEL_NO_SPINNER: 1 {% endif %} {% endif %} diff --git a/templates/molecule.yml.j2 b/templates/molecule.yml.j2 index 2b0d86f..05c6110 100644 --- a/templates/molecule.yml.j2 +++ b/templates/molecule.yml.j2 @@ -21,7 +21,7 @@ provisioner: config_options: defaults: stdout_callback: yaml - bin_ansible_callbacks: true + bin_ansible_callbacks: yes {% if verify.stat.exists %} verifier: name: ansible diff --git a/templates/travis.yml.j2 b/templates/travis.yml.j2 index d9a7db7..541a25b 100644 --- a/templates/travis.yml.j2 +++ b/templates/travis.yml.j2 @@ -13,80 +13,11 @@ env: namespace="{{ docker_namespace }}" matrix: {% for platform in meta.galaxy_info.platforms %} -{% if platform.name == "Amazon" %} {% for version in platform.versions %} -{% if version == "1" or version == "all" %} - - image="amazonlinux" tag="1" -{% endif %} -{% if version == "Candidate" or version == "all" %} - - image="amazonlinux" -{% endif %} +{% for tag in distribution_version_mapping[platform.name][version] %} + - image="{{ platform_image_mapping[platform.name] }}" tag="{{ tag }}" {% endfor %} -{% endif %} -{% if platform.name == "Alpine" %} - - image="alpine" - - image="alpine" tag="edge" -{% endif %} -{% if platform.name =="ArchLinux" %} - # - namespace="archlinux" image="base" -{% endif %} -{% if platform.name =="Debian" %} - - image="debian" tag="unstable" - - image="debian" -{% endif %} -{% if platform.name == "OpenSUSE" %} - - image="opensuse" -{% endif %} -{% if platform.name == "Ubuntu" %} - - image="ubuntu" -{% endif %} -{% if platform.name == "EL" %} -{% for version in platform.versions %} -{% if version != 8 %} -{% for tag in meta.galaxy_info.galaxy_tags %} -{% if tag == "redhat" %} - - image="redhat" tag="{{ version }}" -{% endif %} -{% if tag == "centos" %} - - image="centos" tag="{{ version }}" -{% endif %} -{% if tag == "oraclelinux" %} - - image="oraclelinux" tag="{{ version }}" -{% endif %} {% endfor %} -{% else %} -{% for tag in meta.galaxy_info.galaxy_tags %} -{% if tag == "redhat" %} - - image="redhat" -{% endif %} -{% if tag == "centos" %} - - image="centos" -{% endif %} -{% if tag == "oraclelinux" %} - - image="oraclelinux" -{% endif %} -{% endfor %} -{% endif %} -{% endfor %} -{% endif %} -{% if platform.name == "Fedora" %} - - image="fedora" - - image="fedora" tag="rawhide" -{% endif %} -{% endfor %} - -matrix: - allow_failures: -{% for platform in meta.galaxy_info.platforms %} -{% if platform.name == "Alpine" %} - - env: image="alpine" tag="edge" -{% endif %} -{% if platform.name =="Debian" %} - - env: image="debian" tag="unstable" -{% endif %} -{% if platform.name == "Fedora" %} - - env: image="fedora" tag="rawhide" -{% endif %} {% endfor %} cache: diff --git a/vars/main.yml b/vars/main.yml index 76c74cb..5182ffd 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -20,3 +20,59 @@ author: Robert de Bock (robert@meinit.nl) # The full URL to your website. author_website: "https://robertdebock.nl/" + +platform_image_mapping: + Fedora: fedora + OpenSUSE: opensuse + Amazon: amazonlinux + EL: centos + Alpine: alpine + Debian: debian + Ubuntu: ubuntu + +distribution_version_mapping: + Alpine: + all: + - latest + - edge + Amazon: + all: + - 1 + - latest + 1: + - 1 + 2: + - latest + Debian: + all: + - latest + - unstable + buster: + - latest + sid: + - unstable + EL: + all: + - 7 + - latest + 7: + - 7 + 8: + - latest + Fedora: + all: + - 30 + - latest + - rawhide + 30: + - 30 + 31: + - 31 + OpenSUSE: + all: + - latest + Ubuntu: + all: + - latest + bionic: + - latest