From b8d8adbdb4e01e0184e336479bfc04b2808dfa77 Mon Sep 17 00:00:00 2001 From: Pavel Abramov <31950564+uncleDecart@users.noreply.github.com> Date: Mon, 2 Oct 2023 10:37:46 +0200 Subject: [PATCH] Add registry option to download commands (#893) New eden workflows take eve registry and tag as a parameter and set it up as default. During eve upgrade testing `eden utils download eve-rootfs` is called which is using default registry, however intended behaviour would be to use `lf-edge/eve` registry. Adding this parameter and setting it in upgrade test makes download util use lf-edge/eve registry Signed-off-by: Pavel Abramov --- cmd/downloader.go | 2 ++ tests/update_eve_image/testdata/update_eve_image_http.txt | 7 +++++-- tests/update_eve_image/testdata/update_eve_image_oci.txt | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/downloader.go b/cmd/downloader.go index 475d6528a..6e53e5205 100644 --- a/cmd/downloader.go +++ b/cmd/downloader.go @@ -69,6 +69,7 @@ func newDownloadEVERootFSCmd(cfg *openevec.EdenSetupArgs) *cobra.Command { downloadEVERootFSCmd.Flags().StringVarP(&cfg.Eve.Tag, "eve-tag", "", defaults.DefaultEVETag, "tag to download") downloadEVERootFSCmd.Flags().StringVarP(&cfg.Eve.Arch, "eve-arch", "", runtime.GOARCH, "arch of EVE") downloadEVERootFSCmd.Flags().StringVarP(&cfg.Eve.HV, "eve-hv", "", defaults.DefaultEVEHV, "HV of EVE (kvm or xen)") + downloadEVERootFSCmd.Flags().StringVarP(&cfg.Eve.Registry, "eve-registry", "", defaults.DefaultEveRegistry, "eve registry to download image from (default lf-edge/eve)") downloadEVERootFSCmd.Flags().StringVarP(&outputDir, "downloader-dist", "d", "", "output directory") return downloadEVERootFSCmd @@ -93,6 +94,7 @@ func newDownloadEVECmd(cfg *openevec.EdenSetupArgs) *cobra.Command { downloadEVECmd.Flags().StringVarP(&cfg.Eve.ImageFile, "image-file", "i", "", "path for image drive") downloadEVECmd.Flags().StringVarP(&cfg.Adam.Dist, "adam-dist", "", cfg.Adam.Dist, "adam dist to start") downloadEVECmd.Flags().IntVar(&cfg.Eve.ImageSizeMB, "image-size", defaults.DefaultEVEImageSize, "Image size of EVE in MB") + downloadEVECmd.Flags().StringVarP(&cfg.Eve.Registry, "eve-registry", "", defaults.DefaultEveRegistry, "eve registry to download image from (default lf-edge/eve)") return downloadEVECmd } diff --git a/tests/update_eve_image/testdata/update_eve_image_http.txt b/tests/update_eve_image/testdata/update_eve_image_http.txt index 54d131a83..49d535ef6 100644 --- a/tests/update_eve_image/testdata/update_eve_image_http.txt +++ b/tests/update_eve_image/testdata/update_eve_image_http.txt @@ -1,5 +1,8 @@ # Default EVE version to update -{{$eve_ver := "8.7.0"}} +{{$eve_ver := "9.7.0"}} + +# Default EVE registry to update +{{$eve_registry := "lfedge/eve"}} # Obtain EVE version from environment variable EVE_VERSION {{$env := EdenGetEnv "EVE_VERSION"}} @@ -25,7 +28,7 @@ eden controller edge-node update --config timer.test.baseimage.update=30 # Download EVE rootfs into eve-dist message 'EVE image download' -eden -t 10m utils download eve-rootfs --eve-tag={{$eve_ver}} --eve-hv={{$eve_hv}} --downloader-dist={{EdenConfigPath "eve.dist"}} -v debug +eden -t 10m utils download eve-rootfs --eve-tag={{$eve_ver}} --eve-hv={{$eve_hv}} --eve-registry={{$eve_registry}} --downloader-dist={{EdenConfigPath "eve.dist"}} -v debug # Check stdout of previous command. Expected to get full path to squashfs stdout '{{EdenConfigPath "eve.dist"}}/rootfs-{{ $short_version }}.squashfs' diff --git a/tests/update_eve_image/testdata/update_eve_image_oci.txt b/tests/update_eve_image/testdata/update_eve_image_oci.txt index 6f1c6a08e..25d77804a 100644 --- a/tests/update_eve_image/testdata/update_eve_image_oci.txt +++ b/tests/update_eve_image/testdata/update_eve_image_oci.txt @@ -1,5 +1,8 @@ # Default EVE version to update -{{$eve_ver := "8.6.0"}} +{{$eve_ver := "9.6.0"}} + +# Default EVE registry to update +{{$eve_registry := "lfedge/eve"}} # Obtain EVE version from environment variable EVE_VERSION {{$env := EdenGetEnv "EVE_VERSION"}} @@ -32,7 +35,7 @@ eden controller edge-node update --config timer.test.baseimage.update=30 # Send command to update eveimage from OCI image message 'EVE update request' -eden -t 10m controller edge-node eveimage-update oci://docker.io/lfedge/eve:{{$eve_ver}}-{{$eve_hv}}-{{$eve_arch}} -m adam:// +eden -t 10m controller edge-node eveimage-update oci://docker.io/{{$eve_registry}}:{{$eve_ver}}-{{$eve_hv}}-{{$eve_arch}} -m adam:// # Check stderr, it must be empty ! stderr .