Repository navigation
vagrant-virtualbox implementation (HMS-6116) - #1556
Conversation
|
Undrafting, I'm not particularly happy with the mismatch between the There's also the problem that we already had an CI will fail until the associated |
|
We had some discussion about this and the consensus seemed to be that we'd likely prefer to take this to a follow up where we revisit how the tar stage takes inputs (allowing it to take multiple) and for pipelines to 'export' multiple files. |
|
The first osbuild PR has merged, just the second to go now :) |
|
Needs more work, see osbuild/osbuild#2143 which needs to land to also succesfully have CentOS/RHEL images boot. |
|
I've updated this branch now with the new approach suggested by @achilleas-k in osbuild/osbuild#2143; still keeping as draft until the bits are in place in |
To make use of the latest options in the Vagrant stage we need to bump the osbuild version. Signed-off-by: Simon de Vlieger <[email protected]>
We need a newer osbuild to validate and run vagrant stages. Signed-off-by: Simon de Vlieger <[email protected]>
|
With all prerequisite PRs landed in For testing:
So it reports a version that Vagrant supports. Then build an image and import it with Create a new empty directory and Then |
mvo5
left a comment
There was a problem hiding this comment.
Thank you! Some quick inline comments/ideas/suggestions, hope they are useful.
| Type: VagrantSyncedFolderTypeRsync, | ||
| } | ||
|
|
||
| assert.Error(t, stageOptions.validate()) |
There was a problem hiding this comment.
Actually checking the error is I think preferable as it allows us to also check if the error message looks "nice" and it is also a nice way in the "tests-as-documentation" sense to see what happens in this particular error case. So maybe:
...
assert.EqualError(t, stageOptions.validate(), "syncedfolders are only available for the virtualbox provider")which is interesting as it highlights that it might be nice to include in the error what the actual provider used is, i.e. I think modifying the error to something like syncedfolders are only available for the virtualbox provider not for libvirt would provide more information to us/our users.
There was a problem hiding this comment.
The error message is now checked, however I've not expanded the error message with the supported type(s); I don't quite feel that it adds a lot of value and would be one more part of the code to keep in sync with potential additions to the enum. Users at this level (programmers, really) have enough information to know what's wrong.
Let me know if you do feel strongly about this.
There was a problem hiding this comment.
Thanks! Maybe I explained myself badly, for the extra info I was just thinking to provide slightly more context to the error, i.e. just adding what was passed when the error happend so that its easier to locate in the code what might have gone wrong, something super simple like:
diff --git a/pkg/osbuild/vagrant_stage.go b/pkg/osbuild/vagrant_stage.go
index 8ba7409d5..ed62a2a44 100644
--- a/pkg/osbuild/vagrant_stage.go
+++ b/pkg/osbuild/vagrant_stage.go
@@ -63,7 +63,7 @@ func (o *VagrantStageOptions) validate() error {
}
if o.Provider != VagrantProviderVirtualBox && len(o.SyncedFolders) > 0 {
- return fmt.Errorf("syncedfolders are only available for the virtualbox provider")
+ return fmt.Errorf("syncedfolders are only available for the virtualbox provider not for %q", o.Provider)
}
return nil
diff --git a/pkg/osbuild/vagrant_stage_test.go b/pkg/osbuild/vagrant_stage_test.go
index 164fbcaf4..522915b04 100644
--- a/pkg/osbuild/vagrant_stage_test.go
+++ b/pkg/osbuild/vagrant_stage_test.go
@@ -96,5 +96,5 @@ func TestVagrantStageOptionsSyncedFoldersNoVirtualbox(t *testing.T) {
},
}
- assert.EqualError(t, stageOptions.validate(), "syncedfolders are only available for the virtualbox provider")
+ assert.EqualError(t, stageOptions.validate(), `syncedfolders are only available for the virtualbox provider not for "libvirt"`)
}afaict this adds no extra burden to the test or code just makes it (hopefully) slightly easier to diagnose issues.
There was a problem hiding this comment.
Ah, then I misunderstood. I've applied this change.
There's new support in osbuild's vagrant stage (and OVF stage) to do Vagrant virtualbox specific things. Implement the new stage options, provider(s), and plumb them through in manifest and disk. Signed-off-by: Simon de Vlieger <[email protected]>
Define a new Vagrant image type which uses the VirtualBox backend instead of libvirt for Fedora and RHEL-likes. Note that the VirtualBox backend is only available on x86. Signed-off-by: Simon de Vlieger <[email protected]>
This is the vagrant virtualbox implementation, this PR is based on top of #1548 and is as of yet unmergeable until I fix up and merge the relevant osbuild PRs (osbuild/osbuild#1136 and osbuild/osbuild#2132) and then bump the minimum osbuild version once that lands.
I'd just like to have the PR open as it does currently build correctly.