Merge "Correct how the image_serve validation works" into stable/ussuri
This commit is contained in:
commit
766ac4c93d
21
ansible-role-requirements.yml
Normal file
21
ansible-role-requirements.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2019 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.
|
||||||
|
|
||||||
|
- name: tripleo-ansible
|
||||||
|
scm: git
|
||||||
|
src: https://opendev.org/openstack/tripleo-ansible
|
||||||
|
version: master
|
||||||
|
trackbranch: master
|
@ -1,2 +1,3 @@
|
|||||||
---
|
---
|
||||||
container_registry_port: 8787
|
container_registry_port: 8787
|
||||||
|
container_registry_httpd_config: "/etc/httpd/conf.d/image-serve.conf"
|
||||||
|
@ -35,8 +35,28 @@
|
|||||||
debug:
|
debug:
|
||||||
msg: "Detected faulty port!"
|
msg: "Detected faulty port!"
|
||||||
|
|
||||||
|
- name: Run validation for wrong config file
|
||||||
|
block:
|
||||||
|
- name: Run validation for wrong config file
|
||||||
|
include_role:
|
||||||
|
name: image_serve
|
||||||
|
vars:
|
||||||
|
container_registry_httpd_config: /fake-image-serve.conf
|
||||||
|
rescue:
|
||||||
|
- name: Clear host errors
|
||||||
|
meta: clear_host_errors
|
||||||
|
|
||||||
|
- name: Status message
|
||||||
|
debug:
|
||||||
|
msg: "Detected wrong config file!"
|
||||||
|
|
||||||
- name: Ensure we detect faulty tree
|
- name: Ensure we detect faulty tree
|
||||||
block:
|
block:
|
||||||
|
- name: Stopping httpd
|
||||||
|
systemd:
|
||||||
|
name: httpd
|
||||||
|
state: stopped
|
||||||
|
|
||||||
- name: run validation for 404
|
- name: run validation for 404
|
||||||
include_role:
|
include_role:
|
||||||
name: image_serve
|
name: image_serve
|
||||||
|
@ -7,9 +7,12 @@ log: true
|
|||||||
platforms:
|
platforms:
|
||||||
- name: centos7
|
- name: centos7
|
||||||
hostname: centos7
|
hostname: centos7
|
||||||
|
etc_hosts:
|
||||||
|
undercloud.ctlplane.mydomain.tld: "127.0.0.1"
|
||||||
image: centos:7
|
image: centos:7
|
||||||
override_command: true
|
override_command: true
|
||||||
command: python -m SimpleHTTPServer 8787
|
command: /sbin/init
|
||||||
|
privileged: true
|
||||||
pkg_extras: python-setuptools python-enum34 python-netaddr epel-release ruby PyYAML
|
pkg_extras: python-setuptools python-enum34 python-netaddr epel-release ruby PyYAML
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
||||||
@ -21,9 +24,12 @@ platforms:
|
|||||||
|
|
||||||
- name: centos8
|
- name: centos8
|
||||||
hostname: centos8
|
hostname: centos8
|
||||||
|
etc_hosts:
|
||||||
|
undercloud.ctlplane.mydomain.tld: "127.0.0.1"
|
||||||
image: centos:8
|
image: centos:8
|
||||||
override_command: true
|
override_command: true
|
||||||
command: python3 -m http.server 8787
|
command: /sbin/init
|
||||||
|
privileged: true
|
||||||
pkg_extras: python*-setuptools python*-enum34 python*-netaddr ruby epel-release python*-PyYAML
|
pkg_extras: python*-setuptools python*-enum34 python*-netaddr ruby epel-release python*-PyYAML
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
||||||
@ -35,7 +41,8 @@ provisioner:
|
|||||||
log: true
|
log: true
|
||||||
env:
|
env:
|
||||||
ANSIBLE_STDOUT_CALLBACK: yaml
|
ANSIBLE_STDOUT_CALLBACK: yaml
|
||||||
ANSIBLE_LIBRARY: "../../../../library"
|
ANSIBLE_LIBRARY: ../../../../library
|
||||||
|
ANSIBLE_ROLES_PATH: ../../../../roles/roles.galaxy/tripleo-ansible/tripleo-ansible/tripleo_ansible/roles
|
||||||
|
|
||||||
scenario:
|
scenario:
|
||||||
test_sequence:
|
test_sequence:
|
||||||
|
@ -17,38 +17,9 @@
|
|||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
hosts: all
|
hosts: all
|
||||||
gather_facts: false
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: install hiera
|
- name: Container registry installation
|
||||||
package:
|
include_role:
|
||||||
name: hiera
|
name: tripleo_image_serve
|
||||||
|
vars:
|
||||||
- name: create hiera tree
|
tripleo_container_registry_host: undercloud.ctlplane.mydomain.tld
|
||||||
file:
|
|
||||||
path: /etc/puppet
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: populate hiera.yaml
|
|
||||||
copy:
|
|
||||||
dest: /etc/puppet/hiera.yaml
|
|
||||||
content: |
|
|
||||||
:backends:
|
|
||||||
- yaml
|
|
||||||
:yaml:
|
|
||||||
:datadir: "/etc/puppet/"
|
|
||||||
:hierarchy:
|
|
||||||
- "common"
|
|
||||||
|
|
||||||
- name: populate hiera content
|
|
||||||
copy:
|
|
||||||
dest: /etc/puppet/common.yaml
|
|
||||||
content: |
|
|
||||||
tripleo_undercloud_conf_file: /undercloud.conf
|
|
||||||
|
|
||||||
- name: populate undercloud.conf
|
|
||||||
copy:
|
|
||||||
dest: /undercloud.conf
|
|
||||||
content: |
|
|
||||||
[DEFAULT]
|
|
||||||
local_ip = 127.0.0.1
|
|
||||||
|
@ -1,33 +1,29 @@
|
|||||||
---
|
---
|
||||||
- name: Get the path of tripleo undercloud config file
|
- name: Ensure we have the httpd config
|
||||||
become: true
|
stat:
|
||||||
hiera:
|
path: "{{ container_registry_httpd_config }}"
|
||||||
name: "tripleo_undercloud_conf_file"
|
register: registry_config
|
||||||
|
|
||||||
- name: Get local_ip value from the undercloud.conf file
|
- name: Fail early if no httpd config is present
|
||||||
become: true
|
when: not registry_config.stat.exists
|
||||||
validations_read_ini:
|
fail:
|
||||||
path: "{{ tripleo_undercloud_conf_file }}"
|
msg: "Unable to find vhost config {{ container_registry_httpd_config }}. Exiting now."
|
||||||
section: DEFAULT
|
|
||||||
key: local_ip
|
|
||||||
ignore_missing_file: true
|
|
||||||
register: local_ip
|
|
||||||
|
|
||||||
- name: Set container registry host
|
- name: Extract vhost name from httpd config
|
||||||
set_fact:
|
command: |
|
||||||
container_registry_host: >-
|
awk -F '[ >:]*' '/VirtualHost/ {print $2; exit}' {{ container_registry_httpd_config }}
|
||||||
{{ local_ip.value|default('0.0.0.0', true)|ipaddr('address') }}
|
register: virthost_name
|
||||||
|
|
||||||
- name: Ensure port is open
|
- name: Ensure port is open
|
||||||
wait_for:
|
wait_for:
|
||||||
port: "{{ container_registry_port }}"
|
port: "{{ container_registry_port }}"
|
||||||
host: "{{ container_registry_host }}"
|
host: "{{ virthost_name.stdout }}"
|
||||||
timeout: 10
|
timeout: 10
|
||||||
|
|
||||||
- name: Ensure registry does answer
|
- name: Ensure registry does answer
|
||||||
uri:
|
uri:
|
||||||
method: HEAD
|
method: HEAD
|
||||||
url: "http://{{ container_registry_host }}:{{ container_registry_port }}/v2/index.json"
|
url: "http://{{ virthost_name.stdout }}:{{ container_registry_port }}/v2/index.json"
|
||||||
status_code:
|
status_code:
|
||||||
- 200
|
- 200
|
||||||
- 204
|
- 204
|
||||||
|
0
roles/roles.galaxy/.gitkeep
Normal file
0
roles/roles.galaxy/.gitkeep
Normal file
@ -28,5 +28,15 @@
|
|||||||
requirements: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/molecule-requirements.txt"
|
requirements: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/molecule-requirements.txt"
|
||||||
virtualenv: "{{ ansible_user_dir }}/test-python"
|
virtualenv: "{{ ansible_user_dir }}/test-python"
|
||||||
virtualenv_site_packages: true
|
virtualenv_site_packages: true
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Get Ansible Galaxy roles
|
||||||
|
command: >-
|
||||||
|
{{ ansible_user_dir }}/test-python/bin/ansible-galaxy install
|
||||||
|
-fr
|
||||||
|
{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/ansible-role-requirements.yml
|
||||||
|
environment:
|
||||||
|
ANSIBLE_ROLES_PATH: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/roles/roles.galaxy"
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: ensure-docker
|
- role: ensure-docker
|
||||||
|
@ -3,17 +3,32 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
environment:
|
environment:
|
||||||
ANSIBLE_LOG_PATH: "{{ ansible_user_dir }}/zuul-output/logs/ansible-execution.log"
|
ANSIBLE_LOG_PATH: "{{ ansible_user_dir }}/zuul-output/logs/ansible-execution.log"
|
||||||
|
pre_tasks:
|
||||||
|
|
||||||
|
- name: Set project path fact
|
||||||
|
set_fact:
|
||||||
|
tripleo_validations_project_path: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/tripleo-validations'].src_dir }}"
|
||||||
|
|
||||||
|
- name: Set role path fact
|
||||||
|
set_fact:
|
||||||
|
tripleo_validations_roles_paths:
|
||||||
|
- "{{ tripleo_validations_project_path }}/roles/roles.galaxy/tripleo-ansible/tripleo_ansible/roles"
|
||||||
|
- "{{ tripleo_validations_project_path }}/roles/roles.galaxy/tripleo-ansible/tripleo-ansible/tripleo_ansible/roles"
|
||||||
|
- "{{ tripleo_validations_project_path }}/roles"
|
||||||
|
- "/usr/share/ansible/roles"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Run role test job
|
- name: Run role test job
|
||||||
shell: |-
|
shell: |-
|
||||||
. {{ ansible_user_dir }}/test-python/bin/activate
|
. {{ ansible_user_dir }}/test-python/bin/activate
|
||||||
. {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/ansible-test-env.rc
|
. {{ tripleo_validations_project_path }}/ansible-test-env.rc
|
||||||
pytest --color=no \
|
pytest --color=no \
|
||||||
--html={{ ansible_user_dir }}/zuul-output/logs/reports.html \
|
--html={{ ansible_user_dir }}/zuul-output/logs/reports.html \
|
||||||
--self-contained-html \
|
--self-contained-html \
|
||||||
--ansible-args='{{ tripleo_job_ansible_args | default("") }}' \
|
--ansible-args='{{ tripleo_job_ansible_args | default("") }}' \
|
||||||
{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/test_molecule.py
|
{{ tripleo_validations_project_path }}/tests/test_molecule.py
|
||||||
args:
|
args:
|
||||||
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/roles/{{ tripleo_validations_role_name }}"
|
chdir: "{{ tripleo_validations_project_path }}/roles/{{ tripleo_validations_role_name }}"
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
environment:
|
||||||
|
ANSIBLE_ROLE_PATH: "{{ tripleo_validations_roles_paths | join(':') }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user