From 64c27c8dccf43c8d6e625cbfecb5d99b28f8b074 Mon Sep 17 00:00:00 2001 From: Pawel Piatek Date: Wed, 19 Apr 2023 15:39:11 +0200 Subject: [PATCH] scripts/vagrant: upload optional directories Sometimes we need to copy additional directories with sources into VM. Currently, two cases are known: - spdk-abi - dpdk (for CI vs-dpdk jobs) Signed-off-by: Pawel Piatek Change-Id: I242838364d649b29a5a9dc720c6920493b061fa7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17645 Reviewed-by: Krzysztof Karas Reviewed-by: Jim Harris Reviewed-by: Michal Berger Reviewed-by: Konrad Sztyber Tested-by: SPDK CI Jenkins --- scripts/vagrant/Vagrantfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index aa4809853..94d53da07 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -83,11 +83,20 @@ def copy_vagrant_tools(config,files_sync_backend) config.vm.synced_folder src_path, "/home/vagrant/tools", files_sync_backend end -def copy_spdk_dir(config, files_sync_backend) +def copy_sources_dirs(config, files_sync_backend) return unless ENV['COPY_SPDK_DIR'] == "1" return unless ENV['SPDK_DIR'] - config.vm.synced_folder ENV['SPDK_DIR'], '/home/vagrant/spdk_repo/spdk', files_sync_backend + repo_prefix = '/home/vagrant/spdk_repo' + config.vm.synced_folder ENV['SPDK_DIR'], "#{repo_prefix}/spdk", files_sync_backend + + # Optional directories + for dir in ['spdk-abi', 'dpdk'] + src_path = "#{ENV['SPDK_DIR']}/../#{dir}" + next unless File.directory?(File.expand_path(src_path)) + + config.vm.synced_folder src_path, "#{repo_prefix}/#{dir}", files_sync_backend + end end def copy_spdk_artifacts(config, plugins_sync_backend) @@ -344,7 +353,7 @@ Vagrant.configure(2) do |config| # Copy in the user's tools if they exists copy_vagrant_tools(config,files_sync_backend) - copy_spdk_dir(config, files_sync_backend) + copy_sources_dirs(config, files_sync_backend) # rsync artifacts from build copy_spdk_artifacts(config, plugins_sync_backend)