Skip to content

Commit

Permalink
[#187411386] Simplify example and use python version for ANSIBLE_PYTH…
Browse files Browse the repository at this point in the history
…ON_INTERPRETER, remove requests PIN
  • Loading branch information
eifelmicha committed Jun 5, 2024
1 parent ef716c9 commit 92947d5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
18 changes: 9 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ inputs:
jinja2_version:
description: Jinaj2 version to use, leave empty for newest
default: ''
requests_version:
description: Requests version to use, leave empty for newest
default: ''
test_type:
description: 'Choose between: unit'
default: 'unit'
Expand All @@ -52,7 +49,6 @@ runs:
with:
repository: Rheinwerk/molecule
path: 'git_molecule'
ref: v2

- name: Set up Python 3
uses: actions/setup-python@v5
Expand All @@ -68,6 +64,10 @@ runs:
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
shell: bash

- name: Set ANSIBLE_PYTHON_INTERPRETER
run: echo "ANSIBLE_PYTHON_INTERPRETER=/usr/bin/python${{ inputs.python_version }}" >> $GITHUB_ENV
shell: bash

- name: Set CI_HOSTNAME
run: echo "CI_HOSTNAME=$(echo $MOLECULE_DISTRO | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
shell: bash
Expand All @@ -94,22 +94,22 @@ runs:

- name: Install software for 'ansible_current' scenario
if: "${{ inputs.ansible_scenario == 'ansible_current' }}"
run: pip install 'ansible-core${{ inputs.ansible_current_version }}' 'molecule${{ inputs.molecule_version }}' molecule-plugins[docker] docker netaddr jmespath dnspython 'Jinja2${{ inputs.jinja2_current_version }}' 'requests${{ inputs.requests_version }}'
run: pip install 'ansible-core${{ inputs.ansible_current_version }}' 'molecule${{ inputs.molecule_version }}' molecule-plugins[docker] docker netaddr jmespath dnspython 'Jinja2${{ inputs.jinja2_current_version }}'
shell: bash

- name: Install software for 'ansible_next' scenario
if: "${{ inputs.ansible_scenario == 'ansible_next' }}"
run: pip install 'ansible-core${{ inputs.ansible_next_version }}' 'molecule${{ inputs.molecule_version }}' molecule-plugins[docker] docker netaddr jmespath dnspython 'Jinja2${{ inputs.jinja2_version }}' 'requests${{ inputs.requests_version }}'
run: pip install 'ansible-core${{ inputs.ansible_next_version }}' 'molecule${{ inputs.molecule_version }}' molecule-plugins[docker] docker netaddr jmespath dnspython 'Jinja2${{ inputs.jinja2_version }}'
shell: bash

- name: Install software for 'ansible_latest' scenario
if: "${{ inputs.ansible_scenario == 'ansible_latest' }}"
run: pip install 'ansible-core${{ inputs.ansible_version }}' 'molecule${{ inputs.molecule_version }}' molecule-plugins[docker] docker netaddr jmespath dnspython 'Jinja2${{ inputs.jinja2_version }}' 'requests${{ inputs.requests_version }}'
run: pip install 'ansible-core${{ inputs.ansible_version }}' 'molecule${{ inputs.molecule_version }}' molecule-plugins[docker] docker netaddr jmespath dnspython 'Jinja2${{ inputs.jinja2_version }}'
shell: bash

- name: Install software for generic use case
if: "${{ inputs.ansible_scenario == '' }}"
run: pip install 'ansible-core${{ inputs.ansible_version }}' 'molecule${{ inputs.molecule_version }}' molecule-plugins[docker] docker netaddr jmespath dnspython 'Jinja2${{ inputs.jinja2_version }}' 'requests${{ inputs.requests_version }}'
run: pip install 'ansible-core${{ inputs.ansible_version }}' 'molecule${{ inputs.molecule_version }}' molecule-plugins[docker] docker netaddr jmespath dnspython 'Jinja2${{ inputs.jinja2_version }}'
shell: bash

- name: Pip list
Expand Down Expand Up @@ -140,4 +140,4 @@ runs:
MOLECULE_DISTRO: "${{ inputs.distro }}"
MOLECULE_SCENARIO_NAME: "${{ inputs.molecule_scenario }}"
PY_COLORS: '1'
TEST_TYPE: "${{ inputs.test_type }}"
TEST_TYPE: "${{ inputs.test_type }}"
8 changes: 7 additions & 1 deletion dockerfiles/Ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apt-get update \
python3-setuptools \
python3-simplejson \
rsyslog \
software-properties-common \
sudo \
systemd \
systemd-sysv \
Expand All @@ -45,7 +46,12 @@ RUN apt-get update \
rm -rf /lib/systemd/system/systemd-update-utmp* ; \
rm -rf /lib/systemd/system/getty.target

# Install Python 3.12
RUN add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update \
&& apt-get -y install python3.12

# Fix potential UTF-8 errors with ansible-test.
RUN locale-gen en_US.UTF-8

CMD ["/lib/systemd/systemd"]
CMD ["/lib/systemd/systemd"]
10 changes: 1 addition & 9 deletions examples/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,16 @@ jobs:
include:
- distro: ubuntu-20.04
ansible_scenario: ansible_current
test_type: unit
python_version: '3.8'
experimental: false
- distro: ubuntu-20.04
ansible_scenario: ansible_next
test_type: unit
python_version: '3.8'
experimental: true
- distro: ubuntu-22.04
ansible_scenario: ansible_latest
test_type: unit
python_version: '3.10'
experimental: true

steps:
- uses: Rheinwerk/molecule@v1
- uses: Rheinwerk/molecule@main
with:
distro: ${{ matrix.distro }}
ansible_scenario: ${{ matrix.ansible_scenario }}
test_type: ${{ matrix.test_type }}
python_version: ${{ matrix.python_version }}

0 comments on commit 92947d5

Please sign in to comment.