Skip to content

Commit

Permalink
Enable zuul builds
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt committed Jan 17, 2024
1 parent 912f031 commit de82b9c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 138 deletions.
81 changes: 0 additions & 81 deletions .cirrus.yml

This file was deleted.

28 changes: 24 additions & 4 deletions .zuul.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
- job:
name: k8s-capi-images-build
nodeset: ubuntu-jammy-large
abstract: true
parent: base
pre-run: playbooks/pre.yml
run: playbooks/build.yml
Expand All @@ -13,17 +15,35 @@
vars:
kubernetes_version: 126

- job:
name: k8s-capi-images-build-127
parent: k8s-capi-images-build
vars:
kubernetes_version: 127

- job:
name: k8s-capi-images-build-128
parent: k8s-capi-images-build
vars:
kubernetes_version: 128

- job:
name: k8s-capi-images-build-129
parent: k8s-capi-images-build
vars:
kubernetes_version: 129

- project:
merge-mode: squash-merge
default-branch: main
check:
jobs:
- flake8
- yamllint
gate:
jobs:
- flake8
- yamllint
- k8s-capi-images-build-126
- k8s-capi-images-build-127
- k8s-capi-images-build-128
- k8s-capi-images-build-129
periodic-daily:
jobs:
- flake8
Expand Down
19 changes: 10 additions & 9 deletions playbooks/build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
---
- name: Build image
# hosts: all
hosts: localhost
hosts: all
connection: local

vars:
distro: "{{ lookup('ansible.builtin.env', 'DISTRO', default='ubuntu') }}"
distro_version: "{{ lookup('ansible.builtin.env', 'DISTRO_VERSION', default='2204') }}"
extra_vars_openstack_directory: "{{ repo_path }}/osism/k8s-capi-images"
kubernetes_version: "{{ lookup('ansible.builtin.env', 'KUBERNETES_VERSION', default='124') }}"
repo_path: "{{ ansible_user_dir|default('~') }}/src/github.com"
working_directory: "{{ repo_path }}/kubernetes-sigs/image-builder/images/capi"
basepath: "{{ ansible_user_dir }}/src/github.com"
working_directory: "{{ basepath }}/kubernetes-sigs/image-builder/images/capi"

distro: ubuntu
distro_version: 2204

tasks:
- name: Run build script
Expand All @@ -21,7 +19,10 @@
set -e
set -x
export PACKER_VAR_FILES={{ extra_vars_openstack_directory }}/extra_vars_openstack_{{ distro }}_{{ kubernetes_version }}.json
pwd
ls -la
export PACKER_VAR_FILES={{ basepath }}/osism/k8s-capi-images/extra_vars_{{ kubernetes_version }}.json
export PATH=~/.local/bin:$PATH
make build-qemu-{{ distro }}-{{ distro_version }}
75 changes: 31 additions & 44 deletions playbooks/pre.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
---
- name: Pre tasks - part 1
# hosts: all
hosts: localhost
connection: local
- name: Pre play
hosts: all

vars:
ppg_version: "3.1.4"
packer_version: "1.8.6"

working_directory: "{{ zuul.project.src_dir|default('~') }}"

tasks:
- name: Install required packages
become: true
ansible.builtin.apt:
name:
- curl
- git
- jq
- libguestfs-tools
- make
- patch
- python3-pip
- qemu-kvm
- software-properties-common
- unzip
update_cache: true

- name: Install packer
ansible.builtin.include_role:
name: ensure-packer

- name: Install pip
ansible.builtin.include_role:
name: ensure-pip

- name: Run install script
ansible.builtin.shell:
executable: /bin/bash
chdir: "{{ working_directory }}"
cmd: |
set -e
set -x
Expand All @@ -32,51 +56,14 @@
software-properties-common \
unzip
sudo pip3 install ansible
sudo chmod 0777 /dev/kvm
echo "Host *" | sudo tee /etc/ssh/ssh_config
echo " PubkeyAcceptedAlgorithms +ssh-rsa" | sudo tee /etc/ssh/ssh_config
echo " HostkeyAlgorithms +ssh-rsa" | sudo tee /etc/ssh/ssh_config
lsmod
# Only required by Zuul CI.
#
# - name: Pre roles
# hosts: all
#
# vars:
# install_packer: false
# install_pip: false
#
# roles:
# - role: ensure-packer
# vars:
# packer_version: "1.8.6"
# when: install_packer|bool
#
# - role: ensure-pip
# when: install_pip|bool

- name: Pre tasks - part 2
# hosts: all
hosts: localhost
connection: local

vars:
ppg_version: "3.1.4" # packer-provisioner-goss
working_directory: "{{ zuul.project.src_dir|default('~') }}"

tasks:
- name: Run install script
ansible.builtin.shell:
executable: /bin/bash
chdir: "{{ working_directory }}"
cmd: |
set -e
set -x
wget \
-O packer-provisioner-goss.zip \
https://github.com/YaleUniversity/packer-provisioner-goss/releases/download/v{{ ppg_version }}/packer-provisioner-goss-v{{ ppg_version }}-linux-amd64.zip
Expand Down

0 comments on commit de82b9c

Please sign in to comment.