diff --git a/playbooks/roles/run-selenium/README.rst b/playbooks/roles/run-selenium/README.rst new file mode 100644 index 0000000000..66353630ef --- /dev/null +++ b/playbooks/roles/run-selenium/README.rst @@ -0,0 +1,6 @@ +run-selenium + +Run a selenium container that listens on port 4444 on a host. + +This is intended only for use during gate testing to capture +screenshots from a local service. Usually used from testinfra jobs. diff --git a/playbooks/roles/run-selenium/tasks/main.yaml b/playbooks/roles/run-selenium/tasks/main.yaml new file mode 100644 index 0000000000..24b0758a87 --- /dev/null +++ b/playbooks/roles/run-selenium/tasks/main.yaml @@ -0,0 +1,5 @@ +- name: Run selenium container + shell: + executable: /bin/sh + cmd: | + docker run -d --network="host" -v /dev/shm:/dev/shm selenium/standalone-firefox:4.0.0-beta-1-prerelease-20201202 diff --git a/playbooks/zuul/run-base.yaml b/playbooks/zuul/run-base.yaml index 683bbad2e1..f660335124 100644 --- a/playbooks/zuul/run-base.yaml +++ b/playbooks/zuul/run-base.yaml @@ -41,7 +41,11 @@ bastion_ipv4: "{{ nodepool['public_ipv4'] }}" bastion_ipv6: "{{ nodepool['public_ipv6'] }}" bastion_public_key: "{{ lookup('file', zuul.executor.work_root + '/' + zuul.build + '_id_rsa.pub') }}" - iptables_test_public_tcp_ports: [19885] + iptables_test_public_tcp_ports: + # Zuul web console + - 19885 + # selenium + - 4444 template: src: "templates/{{ item }}.j2" dest: "/etc/ansible/hosts/{{ item }}" @@ -107,6 +111,19 @@ content: "{{ testinfra_extra_data | default('') | to_nice_yaml(indent=2) }}" dest: '/home/zuul/testinfra_extra_data_fixture.yaml' + - name: Make screenshots directory + file: + path: '/var/log/screenshots' + state: directory + + - name: Return screenshots artifact + zuul_return: + data: + zuul: + artifacts: + - name: Screenshots + url: "bridge.openstack.org/screenshots" + - name: Run and collect testinfra block: - name: Run testinfra to validate configuration diff --git a/tox.ini b/tox.ini index e4334bebc1..bb5e97c319 100644 --- a/tox.ini +++ b/tox.ini @@ -41,6 +41,7 @@ deps = ansible-base # see install-ansible/tasks/main.yaml pytest-html # MPL-2.0 pytest-testinfra>=6.0.0 + selenium # This environment assumes a gate-hosts.yaml file has been written. passenv = diff --git a/zuul.d/system-config-run.yaml b/zuul.d/system-config-run.yaml index 3497b63c77..36bd21f46c 100644 --- a/zuul.d/system-config-run.yaml +++ b/zuul.d/system-config-run.yaml @@ -25,6 +25,7 @@ '{{ zuul.project.src_dir }}/junit.xml': logs '{{ zuul.project.src_dir }}/test-results.html': logs '{{ zuul.project.src_dir }}/inventory/base/gate-hosts.yaml': logs + '/var/log/screenshots': logs # Note: the following two jobs implement the variant-based multiple # inheritance trick. Both of these variants will always apply,