mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Add CI for podman_login module (#237)
This commit is contained in:
parent
8bb3d5d233
commit
16ab958a3a
3 changed files with 134 additions and 1 deletions
110
.github/workflows/podman_login.yml
vendored
Normal file
110
.github/workflows/podman_login.yml
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
name: Podman login
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/podman_login.yml'
|
||||||
|
- 'ci/*.yml'
|
||||||
|
- 'ci/run_containers_tests.sh'
|
||||||
|
- 'ci/playbooks/containers/podman_login.yml'
|
||||||
|
- 'plugins/modules/podman_login.py'
|
||||||
|
- 'tests/integration/targets/podman_login/**'
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/podman_login.yml'
|
||||||
|
- 'ci/*.yml'
|
||||||
|
- 'ci/run_containers_tests.sh'
|
||||||
|
- 'ci/playbooks/containers/podman_login.yml'
|
||||||
|
- 'plugins/modules/podman_login.py'
|
||||||
|
- 'tests/integration/targets/podman_login/**'
|
||||||
|
schedule:
|
||||||
|
- cron: 4 0 * * * # Run daily at 0:03 UTC
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test_podman_login:
|
||||||
|
name: Podman login ${{ matrix.ansible-version }}-${{ matrix.os || 'ubuntu-latest' }}
|
||||||
|
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ansible-version:
|
||||||
|
- ansible<2.10
|
||||||
|
# - git+https://github.com/ansible/ansible.git@stable-2.10
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
python-version:
|
||||||
|
- 3.7
|
||||||
|
include:
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
ansible-version: git+https://github.com/ansible/ansible.git@devel
|
||||||
|
python-version: 3.7
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Upgrade pip and display Python and PIP versions
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y python*-wheel python*-yaml
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -V
|
||||||
|
pip --version
|
||||||
|
|
||||||
|
- name: Set up pip cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ github.ref }}-units-VMs
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
${{ runner.os }}-
|
||||||
|
|
||||||
|
- name: Install Ansible ${{ matrix.ansible-version }}
|
||||||
|
run: python3 -m pip install --user --force-reinstall --upgrade '${{ matrix.ansible-version }}'
|
||||||
|
|
||||||
|
- name: Build and install the collection tarball
|
||||||
|
run: |
|
||||||
|
rm -rf /tmp/just_new_collection
|
||||||
|
~/.local/bin/ansible-galaxy collection build --output-path /tmp/just_new_collection --force
|
||||||
|
~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz
|
||||||
|
|
||||||
|
- name: Run collection tests for Podman login
|
||||||
|
run: |
|
||||||
|
export PATH=~/.local/bin:$PATH
|
||||||
|
|
||||||
|
echo "Run ansible version"
|
||||||
|
command -v ansible
|
||||||
|
ansible --version
|
||||||
|
|
||||||
|
if [[ '${{ matrix.ansible-version }}' == 'git+https://github.com/ansible/ansible.git@devel' ]]; then
|
||||||
|
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg
|
||||||
|
elif [[ '${{ matrix.ansible-version }}' == 'ansible<2.10' ]]; then
|
||||||
|
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-2.9.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $ANSIBLE_CONFIG
|
||||||
|
command -v ansible-playbook
|
||||||
|
pip --version
|
||||||
|
python --version
|
||||||
|
ansible-playbook --version
|
||||||
|
|
||||||
|
ansible-playbook -vv ci/playbooks/pre.yml \
|
||||||
|
-e host=localhost \
|
||||||
|
-i localhost, \
|
||||||
|
-e ansible_connection=local \
|
||||||
|
-e setup_python=false
|
||||||
|
|
||||||
|
TEST2RUN=podman_login ./ci/run_containers_tests.sh
|
||||||
|
shell: bash
|
||||||
8
ci/playbooks/containers/podman_login.yml
Normal file
8
ci/playbooks/containers/podman_login.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
gather_facts: true
|
||||||
|
tasks:
|
||||||
|
- include_role:
|
||||||
|
name: podman_login
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: "{{ _ansible_python_interpreter }}"
|
||||||
|
|
@ -11,6 +11,8 @@
|
||||||
- name: Login with invalid executable
|
- name: Login with invalid executable
|
||||||
containers.podman.podman_login:
|
containers.podman.podman_login:
|
||||||
executable: podman_invalid
|
executable: podman_invalid
|
||||||
|
username: doesntmatter
|
||||||
|
password: nopassword
|
||||||
register: invalid_executable
|
register: invalid_executable
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
|
|
@ -19,11 +21,24 @@
|
||||||
that:
|
that:
|
||||||
- invalid_executable is failed
|
- invalid_executable is failed
|
||||||
|
|
||||||
|
- name: Wrong login to registry.fedoraproject.org
|
||||||
|
containers.podman.podman_login:
|
||||||
|
username: notexist
|
||||||
|
password: notexistaswell
|
||||||
|
registry: docker.io
|
||||||
|
register: loginf
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Check login
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- loginf is failed
|
||||||
|
|
||||||
- name: Login to registry.fedoraproject.org
|
- name: Login to registry.fedoraproject.org
|
||||||
containers.podman.podman_login:
|
containers.podman.podman_login:
|
||||||
username: foo
|
username: foo
|
||||||
password: bar
|
password: bar
|
||||||
registry: registry.fedoraproject.org
|
registry: registry.fedoraproject.org
|
||||||
register: login
|
register: login
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue