Clean the _skeleton_role_ content
The Dockerfile.j2 is deprecated, replaced by a common one, and the molecule.yml "platform" section is optional, usually we can rely on the default content. This patch also introduces a new playbook dedicated for zuul, allowing to prepare the env for the "role-addition" test env. Change-Id: I9bfa945abeebed1e0c46c27732d6c4bb398a2538
This commit is contained in:
parent
59f5e3a8e6
commit
698d8dea9a
@ -1,37 +0,0 @@
|
||||
# Molecule managed
|
||||
# Copyright 2022 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
{% raw %}
|
||||
{% if item.registry is defined %}
|
||||
FROM {{ item.registry.url }}/{{ item.image }}
|
||||
{% else %}
|
||||
FROM {{ item.image }}
|
||||
{% endif %}
|
||||
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
|
||||
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install sudo python*-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
|
||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
|
||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
|
||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
|
||||
|
||||
{% for pkg in item.easy_install | default([]) %}
|
||||
# install pip for centos where there is no python-pip rpm in default repos
|
||||
RUN easy_install {{ pkg }}
|
||||
{% endfor %}
|
||||
{% endraw %}
|
||||
|
||||
CMD ["sh", "-c", "while true; do sleep 10000; done"]
|
@ -2,27 +2,6 @@
|
||||
driver:
|
||||
name: podman
|
||||
|
||||
log: true
|
||||
|
||||
platforms:
|
||||
- name: centos
|
||||
hostname: centos
|
||||
image: centos/centos:stream9
|
||||
registry:
|
||||
url: quay.io
|
||||
dockerfile: Dockerfile.j2
|
||||
pkg_extras: python*setuptools
|
||||
volumes:
|
||||
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
||||
- /etc/pki/rpm-gpg:/etc/pki/rpm-gpg
|
||||
- /etc/dnf/vars:/etc/dnf/vars
|
||||
privileged: true
|
||||
environment: &env
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
ulimits: &ulimit
|
||||
- host
|
||||
|
||||
provisioner:
|
||||
inventory:
|
||||
hosts:
|
||||
|
4
tox.ini
4
tox.ini
@ -103,10 +103,10 @@ deps =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
commands =
|
||||
ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-collections-requirements.yml
|
||||
bash -c "ansible-playbook -i localhost, role-addition.yml -e role_name=skeleton_test"
|
||||
ansible-playbook -i localhost, -c local zuul.d/playbooks/run-role-addition.yml -e tripleo_src={toxinidir}
|
||||
bash -c "if podman ps 2> /dev/null; then \
|
||||
cd {toxinidir}/tripleo_ansible/roles/skeleton_test; \
|
||||
molecule test --all; \
|
||||
molecule --base-config {toxinidir}/.config/molecule/config_podman.yml test --all; \
|
||||
else \
|
||||
echo -e '\n\nNo molecule tests have been executed\nSee https://docs.openstack.org/tripleo-ansible/latest/contributing.html#local-testing-of-new-roles\n\n'; \
|
||||
fi"
|
||||
|
25
zuul.d/playbooks/directories.yml
Normal file
25
zuul.d/playbooks/directories.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Ensure output dirs
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/zuul-output/logs"
|
||||
state: directory
|
||||
|
||||
- name: Directories needing root
|
||||
become: true
|
||||
block:
|
||||
- name: Ensure ci directories
|
||||
file:
|
||||
path: "/etc/ci"
|
||||
state: "directory"
|
||||
|
||||
- name: Ensure ci mirror file
|
||||
file:
|
||||
path: "/etc/ci/mirror_info.sh"
|
||||
state: "touch"
|
||||
|
||||
- name: Copy repos directory to opt workspace
|
||||
copy:
|
||||
src: /etc/yum.repos.d
|
||||
dest: /opt/
|
||||
remote_src: true
|
||||
mode: "0777"
|
@ -2,15 +2,12 @@
|
||||
|
||||
- hosts: all
|
||||
pre_tasks:
|
||||
- name: Create directories
|
||||
import_tasks: directories.yml
|
||||
- name: Set project path fact
|
||||
set_fact:
|
||||
tripleo_ansible_project_path: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/tripleo-ansible'].src_dir }}"
|
||||
|
||||
- name: Ensure output dirs
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/zuul-output/logs"
|
||||
state: directory
|
||||
|
||||
- name: Ensure pip is available
|
||||
include_role:
|
||||
name: ensure-pip
|
||||
@ -52,16 +49,6 @@
|
||||
- name: Basic ci setup
|
||||
become: true
|
||||
block:
|
||||
- name: Ensure ci directories
|
||||
file:
|
||||
path: "/etc/ci"
|
||||
state: "directory"
|
||||
|
||||
- name: Ensure ci mirror file
|
||||
file:
|
||||
path: "/etc/ci/mirror_info.sh"
|
||||
state: "touch"
|
||||
|
||||
- name: Set an appropriate fs.file-max
|
||||
sysctl:
|
||||
name: fs.file-max
|
||||
@ -86,13 +73,6 @@
|
||||
* hard nproc 4096
|
||||
dest: /etc/security/limits.d/containers.conf
|
||||
|
||||
- name: Copy repos directory to opt workspace
|
||||
copy:
|
||||
src: /etc/yum.repos.d
|
||||
dest: /opt/
|
||||
remote_src: true
|
||||
mode: "0777"
|
||||
|
||||
- name: Reset ssh connection
|
||||
meta: reset_connection
|
||||
tasks:
|
||||
|
16
zuul.d/playbooks/run-role-addition.yml
Normal file
16
zuul.d/playbooks/run-role-addition.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: set basic zuul fact
|
||||
set_fact:
|
||||
zuul:
|
||||
projects:
|
||||
"opendev.org/openstack/tripleo-ansible":
|
||||
src_dir: "{{ tripleo_src }}"
|
||||
|
||||
- name: Create directories
|
||||
import_tasks: directories.yml
|
||||
|
||||
- import_playbook: ../../role-addition.yml
|
||||
vars:
|
||||
role_name: "skeleton_test"
|
Loading…
Reference in New Issue
Block a user