From e293a887da5305ac6a0e782ed5db7e0b0fcf1067 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Thu, 31 Oct 2024 14:47:26 +0100 Subject: [PATCH] Cache vagrant boxes (#11671) --- .gitlab-ci/molecule.yml | 12 ++++++++++-- .gitlab-ci/vagrant.yml | 10 +++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/molecule.yml b/.gitlab-ci/molecule.yml index c5fd4d4b2..b37cd03ba 100644 --- a/.gitlab-ci/molecule.yml +++ b/.gitlab-ci/molecule.yml @@ -3,14 +3,17 @@ tags: [ffci-vm-med] only: [/^pr-.*$/] except: ['triggers'] - image: quay.io/kubespray/vm-kubespray-ci:v6 + image: quay.io/kubespray/vm-kubespray-ci:v13 services: [] stage: deploy-part1 needs: [] # - ci-not-authorized variables: VAGRANT_DEFAULT_PROVIDER: "libvirt" + VAGRANT_HOME: "$CI_PROJECT_DIR/.vagrant.d" + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" before_script: + - mkdir -p $VAGRANT_HOME - groups - python3 -m venv citest - source citest/bin/activate @@ -29,10 +32,15 @@ when: always paths: - molecule_logs/ + cache: + key: $CI_JOB_NAME_SLUG + paths: + - .vagrant.d/boxes + - .cache/pip + policy: pull-push # TODO: change to "pull" when not on main # CI template for periodic CI jobs # Enabled when PERIODIC_CI_ENABLED var is set - .molecule_periodic: only: variables: diff --git a/.gitlab-ci/vagrant.yml b/.gitlab-ci/vagrant.yml index 2f8119bb1..891011020 100644 --- a/.gitlab-ci/vagrant.yml +++ b/.gitlab-ci/vagrant.yml @@ -10,10 +10,12 @@ KUBESPRAY_VAGRANT_CONFIG: tests/files/${CI_JOB_NAME}.rb DOCKER_NAME: vagrant VAGRANT_ANSIBLE_TAGS: facts + VAGRANT_HOME: "$CI_PROJECT_DIR/.vagrant.d" + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" tags: [ffci-vm-large] # only: [/^pr-.*$/] # except: ['triggers'] - image: quay.io/kubespray/vm-kubespray-ci:v6 + image: quay.io/kubespray/vm-kubespray-ci:v13 services: [] before_script: - echo $USER @@ -27,6 +29,12 @@ - ./tests/scripts/vagrant_clean.sh script: - ./tests/scripts/testcases_run.sh + cache: + key: $CI_JOB_NAME_SLUG + paths: + - .vagrant.d/boxes + - .cache/pip + policy: pull-push # TODO: change to "pull" when not on main vagrant_ubuntu20-calico-dual-stack: stage: deploy-extended