Skip to content

Commit

Permalink
Add registry option to download commands (lf-edge#893)
Browse files Browse the repository at this point in the history
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 <uncle.decart@gmail.com>
  • Loading branch information
uncleDecart authored Oct 2, 2023
1 parent 0305545 commit b8d8adb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cmd/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
7 changes: 5 additions & 2 deletions tests/update_eve_image/testdata/update_eve_image_http.txt
Original file line number Diff line number Diff line change
@@ -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"}}
Expand All @@ -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'
Expand Down
7 changes: 5 additions & 2 deletions tests/update_eve_image/testdata/update_eve_image_oci.txt
Original file line number Diff line number Diff line change
@@ -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"}}
Expand Down Expand Up @@ -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 .
Expand Down

0 comments on commit b8d8adb

Please sign in to comment.