win test: add http tester container to Windows tests (#46606)

This commit is contained in:
Jordan Borean
2018-10-13 08:20:00 +10:00
committed by GitHub
parent c44860057e
commit 6e2897647c
8 changed files with 353 additions and 7 deletions

View File

@@ -3,6 +3,11 @@
- set_fact:
has_httptester: "{{ lookup('env', 'HTTPTESTER') != '' }}"
- name: make sure we have the ansible_os_family and ansible_distribution_version facts
setup:
gather_subset: distribution
when: ansible_facts == {}
# If we are running with access to a httptester container, grab it's cacert and install it
- block:
# Override hostname defaults with httptester linked names
@@ -22,6 +27,16 @@
get_url:
url: "http://ansible.http.tests/{{ item }}"
dest: "{{ output_dir }}/{{ item }}"
when: ansible_os_family != 'Windows'
with_items:
- client.pem
- client.key
- name: Windows - Get client cert/key
win_get_url:
url: http://ansible.http.tests/{{ item }}
dest: '{{ win_output_dir }}\{{ item }}'
when: ansible_os_family == 'Windows'
with_items:
- client.pem
- client.key
@@ -38,6 +53,12 @@
dest: "/usr/local/share/ca-certificates/ansible.crt"
when: ansible_os_family == 'Debian'
- name: Windows - Retrieve test cacert
win_get_url:
url: http://ansible.http.tests/cacert.pem
dest: '{{ win_output_dir }}\cacert.pem'
when: ansible_os_family == 'Windows'
- name: Redhat - Update ca trust
command: update-ca-trust extract
when: ansible_os_family == 'RedHat'
@@ -46,6 +67,14 @@
command: update-ca-certificates
when: ansible_os_family == 'Debian' or ansible_os_family == 'Suse'
- name: Windows - Update ca trust
win_certificate_store:
path: '{{ win_output_dir }}\cacert.pem'
state: present
store_location: LocalMachine
store_name: Root
when: ansible_os_family == 'Windows'
- name: FreeBSD - Retrieve test cacert
get_url:
url: "http://ansible.http.tests/cacert.pem"
@@ -68,4 +97,7 @@
command: /usr/local/opt/openssl/bin/c_rehash
when: ansible_os_family == 'Darwin'
when: has_httptester|bool
when:
- has_httptester|bool
# skip the setup if running on Windows Server 2008 as httptester is not available
- ansible_os_family != 'Windows' or (ansible_os_family == 'Windows' and not ansible_distribution_version.startswith("6.0."))

View File

@@ -1,3 +1,3 @@
shippable/windows/group3
unstable
needs/httptester
skip/windows/2008 # httptester requires SSH which doesn't work with 2008

View File

@@ -1,3 +1,2 @@
---
test_uri_path: C:\ansible\win_uri
httpbin_host: httpbin.org
test_uri_path: '{{ win_output_dir }}\win_uri'

View File

@@ -0,0 +1,3 @@
dependencies:
- prepare_win_tests
- prepare_http_tests