Skip to content

Commit

Permalink
Update container-login role to use edpm-ansible role
Browse files Browse the repository at this point in the history
Since tripleo-ansible is now deprecated, we need to replace
with edpm-ansible roles that container edpm_podman role, needed
for container-login to do multiple registry login.
Updates bindep.txt and molecule job to support centos-9 nodeset.

Change-Id: I74d656ca97ab561b524792d838059a97987032cb
  • Loading branch information
viroel committed Apr 17, 2024
1 parent 0fbbe75 commit 945306b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 48 deletions.
4 changes: 2 additions & 2 deletions bindep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ openssl-devel [compile test platform:rpm]
python3-devel [compile test platform:rpm]
python3-netifaces [compile test platform:rpm]
python3-pip [compile test platform:rpm]
python3-virtualenv [compile test platform:rpm]
python36 [compile test platform:rpm]
python3-virtualenv [compile test platform:rpm !platform:rhel-9 !platform:centos-9]
python36 [compile test platform:rpm !platform:rhel-9 !platform:centos-9]
bzip2 [compile test platform:rpm]
4 changes: 2 additions & 2 deletions molecule/container-login/collections.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
roles:
- name: tripleo_ansible
src: git+https://opendev.org/openstack/tripleo-ansible
- name: edpm_ansible
src: git+https://github.com/openstack-k8s-operators/edpm-ansible

collections:
- containers.podman
Expand Down
4 changes: 2 additions & 2 deletions molecule/container-login/converge.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
- hosts: all
vars:
tripleo_container_registry_insecure_registries:
edpm_container_registry_insecure_registries:
- localhost:5000
- localhost:5001
tasks:
- name: Testing container-login role
include_role:
name: container-login
vars:
tripleo_podman_tls_verify: false
edpm_podman_tls_verify: false
registry_secrets:
localhost:5000: "test_secret0"
localhost:5001: "test_secret1"
Expand Down
5 changes: 1 addition & 4 deletions molecule/container-login/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
---
driver:
name: delegated
log: true
platforms:
- name: instance
provisioner:
name: ansible
env:
# tripleo_ansible is not a single role repo
ANSIBLE_ROLES_PATH: "../../roles:${MOLECULE_EPHEMERAL_DIRECTORY}/roles/tripleo_ansible/tripleo_ansible/roles/"
ANSIBLE_ROLES_PATH: "../../roles:../../roles/edpm_ansible/edpm_ansible/roles"

dependency:
name: galaxy
Expand Down
10 changes: 5 additions & 5 deletions roles/container-login/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# container-login

Role to login into registries, using Zuul's secrets or any other defined credential. It uses `tripleo_podman`_ role to
Role to login into registries, using Zuul's secrets or any other defined credential. It uses `edpm_podman`_ role to
login into registries using `podman`.

## Variables
Expand All @@ -12,10 +12,10 @@ login into registries using `podman`.
* The role accepts as *password* key: `password`, `passwd` or `token`.
* 'push_containers': (Boolean) When set to true, podman buildah login is also performed. Default: False.

See additional variables in `tripleo_podman`_ role documentation.
See additional variables in `edpm_podman`_ role documentation.

## Dependencies
This role depends on `tripleo_podman`_ role to work. Make sure that you have this role on your ROLES path before make
This role depends on `edpm_podman`_ role to work. Make sure that you have this role on your ROLES path before make
use of it.

Example 1:
Expand All @@ -26,7 +26,7 @@ Example 1:
include_role:
name: container-login
vars:
tripleo_podman_tls_verify: false
edpm_podman_tls_verify: false
registry_secrets:
localhost:5000: "test_secret"
localhost:5001: "test_secret_2"
Expand All @@ -38,4 +38,4 @@ Example 1:
token: "testpassword2"
```
.. _tripleo_podman: https://docs.openstack.org/tripleo-ansible/latest/roles/role-tripleo_podman.html
.. _edpm_podman: https://github.com/openstack-k8s-operators/edpm-ansible/tree/main/roles/edpm_podman
42 changes: 9 additions & 33 deletions roles/container-login/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,54 +23,30 @@
- name: Registry login
no_log: true
vars:
tripleo_container_registry_logins: "{{ container_registry_logins }}"
tripleo_podman_buildah_login: "{{ push_containers|default(false)|bool }}"
edpm_container_registry_logins: "{{ container_registry_logins }}"
edpm_podman_buildah_login: "{{ push_containers|default(false)|bool }}"
block:
- name: Set tripleo podman role name for train
no_log: false
set_fact:
tripleo_podman_role_name: tripleo-podman
when:
(release is defined and release == 'train')
or (branch_override is defined and branch_override == 'stable/train')
or (zuul.branch is defined and zuul.branch == 'stable/train')

- name: set tripleo podman task name prefix for train/wallaby/zed
no_log: false
set_fact:
tripleo_podman_task_prefix: tripleo_podman_
when:
(release is defined and release in ['train', 'wallaby', 'zed'] )
or (branch_override is defined and branch_override in ['stable/train', 'stable/wallaby', 'stable/zed'])
or (zuul.branch is defined and zuul.branch in ['stable/train', 'stable/wallaby', 'stable/zed'])

- name: Load vars and install podman
no_log: false
block:
- name: Load var file for Installing and configuring podman
include_role:
name: "{{ tripleo_podman_role_name | default('tripleo_podman') }}"
tasks_from: load_vars.yaml

- name: Install podman
include_role:
name: "{{ tripleo_podman_role_name | default('tripleo_podman') }}"
tasks_from: "{{ tripleo_podman_task_prefix | default('') }}install.yml"
vars_from: "{{ ansible_os_family | lower }}.yml"
name: edpm_podman
tasks_from: install.yml
when:
- ansible_distribution_major_version is version(8, '>=')

- name: Perform podman login
include_role:
name: "{{ tripleo_podman_role_name | default('tripleo_podman') }}"
tasks_from: "{{ tripleo_podman_task_prefix | default('') }}login.yml"
name: edpm_podman
tasks_from: login.yml

- name: Perform podman buildah login
include_role:
name: "{{ tripleo_podman_role_name | default('tripleo_podman') }}"
tasks_from: "{{ tripleo_podman_task_prefix | default('') }}buildah_login.yml"
name: edpm_podman
tasks_from: buildah_login.yml
when:
- tripleo_podman_buildah_login | bool
- edpm_podman_buildah_login | bool

always:
- name: Assert which issue happened in login step
Expand Down
1 change: 1 addition & 0 deletions zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
name: rdo-mol-container-login
description: Tests container-login role.
parent: rdo-molecule-base
nodeset: rdo-centos-9-stream
vars:
mol_scenario: container-login

Expand Down

0 comments on commit 945306b

Please sign in to comment.