Browse Source

CI: convert molecule jobs to parallel:matrix

With the new provisionning using kubevirt this should be faster.
pull/12026/head
Max Gautier 2 months ago
parent
commit
315313dd10
Failed to extract signature
4 changed files with 31 additions and 59 deletions
  1. 85
      .gitlab-ci/molecule.yml
  2. 2
      tests/cloud_playbooks/roles/packet-ci/tasks/main.yml
  3. 2
      tests/cloud_playbooks/roles/packet-ci/templates/vm.yml.j2
  4. 1
      tests/cloud_playbooks/roles/packet-ci/vars/main.yml

85
.gitlab-ci/molecule.yml

@ -19,65 +19,38 @@
paths:
- molecule_logs/
molecule:
extends: .molecule
script:
- ./tests/scripts/molecule_run.sh -i $ROLE
parallel:
matrix:
- ROLE:
- container-engine/cri-dockerd
- container-engine/containerd
- container-engine/cri-o
- adduser
- bastion-ssh-config
- bootstrap-os
# CI template for periodic CI jobs
# Enabled when PERIODIC_CI_ENABLED var is set
.molecule_periodic:
molecule_full:
only:
variables:
- $PERIODIC_CI_ENABLED
allow_failure: true
extends: .molecule
molecule_full:
extends: .molecule_periodic
molecule_no_container_engines:
extends: .molecule
script:
- ./tests/scripts/molecule_run.sh -e container-engine
when: on_success
molecule_docker:
extends: .molecule
script:
- ./tests/scripts/molecule_run.sh -i container-engine/cri-dockerd
when: on_success
molecule_containerd:
extends: .molecule
script:
- ./tests/scripts/molecule_run.sh -i container-engine/containerd
when: on_success
molecule_cri-o:
extends: .molecule
stage: deploy-part1
script:
- ./tests/scripts/molecule_run.sh -i container-engine/cri-o
allow_failure: true
when: on_success
# # Stage 3 container engines don't get as much attention so allow them to fail
# molecule_kata:
# extends: .molecule
# stage: deploy-extended
# script:
# - ./tests/scripts/molecule_run.sh -i container-engine/kata-containers
# when: manual
# # FIXME: this test is broken (perma-failing)
molecule_gvisor:
extends: .molecule
stage: deploy-extended
script:
- ./tests/scripts/molecule_run.sh -i container-engine/gvisor
when: manual
# FIXME: this test is broken (perma-failing)
molecule_youki:
extends: .molecule
stage: deploy-extended
script:
- ./tests/scripts/molecule_run.sh -i container-engine/youki
when: manual
# FIXME: this test is broken (perma-failing)
extends: molecule
parallel:
matrix:
- ROLE:
- container-engine/cri-dockerd
- container-engine/containerd
- container-engine/cri-o
- adduser
- bastion-ssh-config
- bootstrap-os
# FIXME : tests below are perma-failing
- container-engine/kata-containers
- container-engine/gvisor
- container-engine/youki

2
tests/cloud_playbooks/roles/packet-ci/tasks/main.yml

@ -1,6 +1,6 @@
---
- name: Include custom vars for ci job
include_vars: "../files/{{ ci_job_name }}.yml"
include_vars: "../files/{{ lookup('ansible.builtin.env', 'CI_JOB_NAME') }}.yml"
when: molecule_yml is not defined
- name: Generate SSH keypair

2
tests/cloud_playbooks/roles/packet-ci/templates/vm.yml.j2

@ -13,7 +13,7 @@ metadata:
kubevirt.io/os: {{ cloud_image }}
kubevirt.io/size: small
ci_job_id: "{{ ci_job_id }}"
ci_job_name: "{{ ci_job_name }}"
ci_job_name: "{{ lookup('ansible.builtin.env', 'CI_JOB_NAME_SLUG') }}"
# leverage the Kubernetes GC for resources cleanup
ownerReferences:
- apiVersion: v1

1
tests/cloud_playbooks/roles/packet-ci/vars/main.yml

@ -31,7 +31,6 @@ scenarios:
# Get pod metadata / CI vars from environment
ci_job_id: "{{ lookup('ansible.builtin.env', 'CI_JOB_ID', default=undefined) }}"
ci_job_name: "{{ lookup('ansible.builtin.env', 'CI_JOB_NAME', default=undefined) }}"
pod_name: "{{ lookup('ansible.builtin.env', 'POD_NAME', default=undefined) }}"
pod_uid: "{{ lookup('ansible.builtin.env', 'POD_UID', default=undefined) }}"
pod_namespace: "{{ lookup('ansible.builtin.env', 'POD_NAMESPACE', default=undefined) }}"
Loading…
Cancel
Save