From 7000de896a15bf417ca7dc8d3f913d412063a81f Mon Sep 17 00:00:00 2001 From: Graham Whaley Date: Tue, 5 Mar 2019 15:55:33 +0000 Subject: [PATCH] QA CI: Add Ubuntu 16.04 QA CI Add the relevant pipeline, jobs, roles, playbooks etc. to enable a Kata QA CI build/run on Ubuntu 16.04 triggered by the relevant github state changes. Change-Id: Id4174c68856bbb792c002b05e36e36bfe19dbca9 Signed-off-by: Graham Whaley --- playbooks/CI-setup/postrun.yaml | 85 ++++++++++++++++++++++++++++++++ playbooks/CI-setup/presetup.yaml | 18 +++++++ playbooks/QA-check/run.yaml | 14 ++++++ zuul.d/jobs.yaml | 15 +++++- zuul.d/pipelines.yaml | 40 +++++++++++++++ zuul.d/projects.yaml | 3 ++ 6 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 playbooks/CI-setup/postrun.yaml create mode 100644 playbooks/CI-setup/presetup.yaml create mode 100644 playbooks/QA-check/run.yaml diff --git a/playbooks/CI-setup/postrun.yaml b/playbooks/CI-setup/postrun.yaml new file mode 100644 index 0000000..d7e9f0f --- /dev/null +++ b/playbooks/CI-setup/postrun.yaml @@ -0,0 +1,85 @@ +--- +- hosts: all + tasks: + - name: Ensure logs directory + file: + path: '{{ ansible_user_dir }}/logs' + state: directory + mode: 0755 + + # TODO use with items + - name: Write runtime log + shell: | + set -x + journalctl -b -o short-precise -t kata-runtime | gzip > {{ ansible_user_dir }}/logs/kata-runtime.log.gz + become: yes + - name: Make runtime log readable + file: + path: '{{ ansible_user_dir }}/logs/kata-runtime.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write agent and proxy log + shell: | + set -x + journalctl -b -o short-precise -t kata-proxy | gzip > {{ ansible_user_dir }}/logs/kata-proxy.log.gz + become: yes + - name: Make proxy log readable + file: + path: '{{ ansible_user_dir }}/logs/kata-proxy.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write shim log + shell: | + set -x + journalctl -b -o short-precise -t kata-shim | gzip > {{ ansible_user_dir }}/logs/kata-shim.log.gz + become: yes + - name: Make shim log readable + file: + path: '{{ ansible_user_dir }}/logs/kata-shim.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write docker log + shell: | + set -x + journalctl -b -o short-precise -u docker.service | gzip > {{ ansible_user_dir }}/logs/docker.log.gz + become: yes + - name: Make docker log readable + file: + path: '{{ ansible_user_dir }}/logs/docker.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write crio log + shell: | + set -x + journalctl -b -o short-precise -u crio | gzip > {{ ansible_user_dir }}/logs/crio.log.gz + become: yes + - name: Make crio log readable + file: + path: '{{ ansible_user_dir }}/logs/crio.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write kubelet log + shell: | + set -x + journalctl -b -o short-precise -u kubelet | gzip > {{ ansible_user_dir }}/logs/kubelet.log.gz + become: yes + - name: Make kubelet log readable + file: + path: '{{ ansible_user_dir }}/logs/kubelet.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Copy log files from test node to executor + synchronize: + src: '{{ ansible_user_dir }}/logs' + dest: '{{ zuul.executor.log_root }}' + mode: pull + copy_links: true + verify_host: true + rsync_opts: + - --prune-empty-dirs diff --git a/playbooks/CI-setup/presetup.yaml b/playbooks/CI-setup/presetup.yaml new file mode 100644 index 0000000..76baeb2 --- /dev/null +++ b/playbooks/CI-setup/presetup.yaml @@ -0,0 +1,18 @@ +--- +- hosts: all + tasks: + - name: Run Kata CI setup + args: + executable: /bin/bash + chdir: "{{ zuul.project.src_dir }}" + shell: | + set -x + # set a ${WORKSPACE}, so we look enough like a Jenkins env that + # the Kata ci script will execute + export WORKSPACE=$HOME + export GOPATH=$HOME/go + export CI=true + export ZUUL=true + export PATH=${GOPATH}/bin:/usr/sbin:$PATH + .ci/install_go.sh -p -f + .ci/setup.sh diff --git a/playbooks/QA-check/run.yaml b/playbooks/QA-check/run.yaml new file mode 100644 index 0000000..48c020d --- /dev/null +++ b/playbooks/QA-check/run.yaml @@ -0,0 +1,14 @@ +--- +- hosts: all + tasks: + - name: Run kata QA CI + args: + executable: /bin/bash + chdir: "{{ zuul.project.src_dir }}" + shell: | + set -x + export CI=true + export ZUUL=true + export GOPATH=$HOME/go + export PATH=${GOPATH}/bin:/usr/sbin:$PATH + .ci/run.sh diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 9b9c6f8..66a61fc 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -20,7 +20,7 @@ - job: name: kata-github-wip description: | - This job calls the github-pr playbook with a Kata-curated set of + This job calls the github-wip playbook with a Kata-curated set of WIP labels and WIP title keywords run: playbooks/github-wip/run.yaml nodeset: @@ -28,3 +28,16 @@ vars: wip_labels: 'do-not-merge wip rfc' wip_keywords: 'WIP RFC' + +- job: + name: QA-check-Ubuntu-16.04 + description: | + This job calls the QA-check playbook + pre-run: playbooks/CI-setup/presetup.yaml + run: playbooks/QA-check/run.yaml + post-run: playbooks/CI-setup/postrun.yaml + nodeset: + # Ensure we get a Kata capable Ubuntu 16.04 server + nodes: + - name: ubuntu-xenial + label: ubuntu-xenial-vexxhost diff --git a/zuul.d/pipelines.yaml b/zuul.d/pipelines.yaml index 389a5b0..b3fcb94 100644 --- a/zuul.d/pipelines.yaml +++ b/zuul.d/pipelines.yaml @@ -150,3 +150,43 @@ # Don't report merge-failures to github merge-failure: mysql: + +- pipeline: + name: PR-check + description: | + New and modified GitHub PRs enter this pipeline to be tested. + success-message: PR checks OK. + failure-message: PR checks failed. + manager: independent + precedence: low + trigger: + github: + - event: pull_request + action: + - opened + - changed + - reopened + - event: pull_request + action: comment + comment: (?i)^\s*/zuul-recheck\s*$ + start: + github: + status: pending + comment: false + success: + github: + status: 'success' + comment: false + status-url: | + https://github.com/kata-containers/community/wiki/Zuul-PR-checks + mysql: + failure: + github: + status: 'failure' + comment: false + status-url: | + https://github.com/kata-containers/community/wiki/Zuul-PR-checks + mysql: + # Don't report merge-failures to github + merge-failure: + mysql: diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 5b63f6f..fabbdb2 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -55,6 +55,9 @@ name: kata-containers/proxy templates: - kata-pre-checks + PR-check: + jobs: + - QA-check-Ubuntu-16.04 - project: name: kata-containers/runtime