5358c6dc0e
Allow the user to specify an image prefix and a version tag. This updates the functional test to account for a recent change in Zuul which returns incomplete builds on the API endpoint. Change-Id: I49e82c790a518c1c9f5a463250b5b785eacde55a
156 lines
4.6 KiB
YAML
156 lines
4.6 KiB
YAML
- name: run functional tst
|
|
hosts: all
|
|
tasks:
|
|
- name: Install ingress
|
|
include_tasks: tasks/ingress.yaml
|
|
|
|
- name: Create temp git root directory
|
|
tempfile:
|
|
state: directory
|
|
register: git_root
|
|
|
|
- name: get cluster ip
|
|
command: /tmp/minikube ip
|
|
register: minikube_ip
|
|
failed_when: false
|
|
|
|
- name: set cluster ip
|
|
set_fact:
|
|
cluster_ip: "{{ cluster_ip | default(minikube_ip.stdout_lines[0]) }}"
|
|
|
|
- name: set fact zuul_web_url
|
|
set_fact:
|
|
zuul_web_url: "http://{{ cluster_ip }}"
|
|
zuul_ws_url: "ws://{{ cluster_ip }}"
|
|
|
|
- name: ensure zuul web api is working
|
|
when: skip_check is not defined
|
|
include_tasks: tasks/zuul_web_check.yaml
|
|
vars:
|
|
endpoint: "/api/tenants"
|
|
expected:
|
|
- name: local
|
|
projects: 1
|
|
queue: 0
|
|
|
|
- name: setup git service
|
|
include_tasks: tasks/git_setup.yaml
|
|
|
|
- name: get git-server port
|
|
command: kubectl get svc git-server -o jsonpath='{.spec.ports[0].nodePort}'
|
|
register: git_server_port
|
|
|
|
- name: set git-server port
|
|
set_fact:
|
|
git_server_port: '{{ git_server_port.stdout_lines[0] }}'
|
|
|
|
- name: create a config project
|
|
include_tasks: tasks/create_config.yaml
|
|
|
|
- name: update kubernetes resources
|
|
vars:
|
|
tenants:
|
|
- tenant:
|
|
name: local
|
|
source:
|
|
opendev.org:
|
|
config-projects:
|
|
- zuul/zuul-base-jobs
|
|
untrusted-projects:
|
|
- zuul/zuul-jobs
|
|
local-git:
|
|
config-projects:
|
|
- config
|
|
block:
|
|
- k8s:
|
|
namespace: default
|
|
definition:
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: "zuul-yaml-conf"
|
|
stringData:
|
|
main.yaml: "{{ tenants | to_yaml }}"
|
|
|
|
- include_tasks: tasks/apply_cr.yaml
|
|
vars:
|
|
spec:
|
|
executor:
|
|
count: 1
|
|
sshkey:
|
|
secretName: executor-ssh-key
|
|
merger:
|
|
count: 1
|
|
scheduler:
|
|
config:
|
|
secretName: zuul-yaml-conf
|
|
launcher:
|
|
config:
|
|
secretName: nodepool-yaml-conf
|
|
connections:
|
|
opendev.org:
|
|
baseurl: https://opendev.org
|
|
driver: git
|
|
local-git:
|
|
baseurl: "git://git-server.default/"
|
|
driver: git
|
|
externalConfig:
|
|
kubernetes:
|
|
secretName: nodepool-kube-config
|
|
jobVolumes:
|
|
- context: trusted
|
|
access: rw
|
|
path: /system-dbus/
|
|
dir: /system-dbus/
|
|
volume:
|
|
name: system-dbus
|
|
hostPath:
|
|
path: /run/dbus
|
|
type: DirectoryOrCreate
|
|
|
|
- name: ensure a job is running
|
|
when: skip_check is not defined
|
|
include_tasks: tasks/zuul_web_check.yaml
|
|
vars:
|
|
endpoint: "/api/tenants"
|
|
expected:
|
|
- name: local
|
|
projects: 1
|
|
# 1 queue means a job is running
|
|
queue: 1
|
|
|
|
- name: get buillds results
|
|
include_tasks: tasks/zuul_web_check.yaml
|
|
vars:
|
|
endpoint: "/api/tenant/local/builds?complete=true"
|
|
|
|
- name: ensure success build
|
|
assert:
|
|
that:
|
|
- result.json[0].result == 'SUCCESS'
|
|
|
|
- name: grab job uuid
|
|
shell: |
|
|
curl -s {{ zuul_web_url }}/api/tenant/local/status | jq -r '.pipelines[].change_queues[].heads[][].jobs[].uuid'
|
|
register: _job_uuid
|
|
# Wait until the executor start the job
|
|
until: _job_uuid.stdout != "" and _job_uuid.stdout != "null"
|
|
retries: 60
|
|
delay: 1
|
|
|
|
- name: connect to console-stream
|
|
command: |
|
|
wsdump -r --eof-wait 5 -t '{"uuid":"{{ _job_uuid.stdout_lines[0] }}","logfile":"console.log"}' {{ zuul_ws_url }}/api/tenant/local/console-stream
|
|
register: console_stream
|
|
|
|
- name: show console stream
|
|
debug:
|
|
var: console_stream
|
|
|
|
- name: fail if console stream does not contains expected job output
|
|
when: "'Job console starting...' not in console_stream.stdout"
|
|
# It seems like wsdump.py doesn't always stay connected for the whole job duration
|
|
# when: "'Demo job is running' not in console_stream.stdout"
|
|
fail:
|
|
msg: "Task output is missing from: {{ console_stream.stdout }}"
|