setup: Add distro specific pre-setups

We need to have golang installed as a minimum to run the CI
scripts. Add this as a distro-specific set of files, which
then allows us to:
 - specialise in the future per distro if need be
 - note (fail gracefully) when we run on a new distro
   for the first time.

Note, the distro specific parts are specifically added as a
role as they will not pass the playbook linter if placed
in the playbook tree (they are fragments, and playbooks
are expected to be complete).

Change-Id: Icb675c30a5ddcc5bdbebb7413808a58af4e838b7
Signed-off-by: Graham Whaley <graham.whaley@intel.com>
This commit is contained in:
Graham Whaley 2019-04-05 16:06:17 +01:00
parent 7000de896a
commit 532de2e94b
6 changed files with 52 additions and 16 deletions

View File

@ -1,18 +1,7 @@
---
- 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
# the CI setup is placed out into a role, as the distro specific
# file/task fragments do not pass the zuul yaml linter checks if
# placed into the playbook tree.
roles:
- CI-setup

View File

@ -0,0 +1 @@
Platform specific setup for kata CI.

View File

@ -0,0 +1,23 @@
- name: Run distribution specific tasks
include_tasks: "{{ lookup('first_found', file_list) }}"
vars:
file_list:
- "setup/{{ ansible_distribution }}.yaml"
- "setup/{{ ansible_os_family }}.yaml"
- "setup/default.yaml"
- 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

View File

@ -0,0 +1,9 @@
- name: Install golang
package:
# It does not really matter which version we install, as long as it
# can 'go get' the test repo, to then run the platform setup scripts,
# which will then ensure we have the correct/necessary version of
# golang installed.
name: golang
state: present
become: yes

View File

@ -0,0 +1,9 @@
- name: Install golang
package:
# It does not really matter which version we install, as long as it
# can 'go get' the test repo, to then run the platform setup scripts,
# which will then ensure we have the correct/necessary version of
# golang installed.
name: golang
state: present
become: yes

View File

@ -0,0 +1,5 @@
- name: Warn about unsupported distribution
debug:
msg: >
WARNING: {{ ansible_distribution }} not supported for Kata CI under Zuul.
You can add support to this directory if desired.