-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow providing scripts as separate files #2442
base: master
Are you sure you want to change the base?
Conversation
There are some issues with relative paths for the scripts, as has been discussed before... Note: all the files/paths used here are on the host, and nothing is copied to the instance |
The provision scripts are recorded in the cidata.iso, so they should be OK with changing directory. But the probes are run from the hostagent, so they don't really record the "working directory" now. EDIT: duh, the lima-hostagent does have a PWD environment variable, so this is a validation problem If validate should look if the script files exist, then it must also know the current working directory... |
As noted in the older issue, this becomes extra interesting if lima.yaml is loaded from an URL.
|
@@ -206,6 +207,7 @@ type Probe struct { | |||
Mode ProbeMode // default: "readiness" | |||
Description string | |||
Script string | |||
Path string `yaml:",omitempty" json:",omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we consistently use the File
object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file objects also adds arch and digest, neither of which is applicable here...
We could rename Path
to Location
, to allow for running scripts from URLs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least digest seems to be applicable here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, probably needs more design then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. the wish was to "include" common scripts
If the digest changes every time you edit the script, you still need to copy/paste the sha256?
@@ -33,6 +33,7 @@ An instance directory contains the following files: | |||
|
|||
Metadata: | |||
- `lima-version`: the Lima version used to create this instance | |||
- `lima-workdir`: the Lima workdir used to create this instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is workdir? Why does it need to be a dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workdir is the $PWD from when the limactl start was first run.
It is used to find relative paths, for the scripts and the playbooks...
Otherwise, you need to cd
to the directory before any limactl
.
Or make all paths absolute, making them static and unportable?
cmd/limactl/start.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
if err := os.WriteFile(filepath.Join(instDir, filenames.LimaWorkDir), []byte(wd), 0o644); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a symlink ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not on Windows, I suppose.
But yes, it could be a symlink
Signed-off-by: Anders F Björklund <[email protected]>
Signed-off-by: Anders F Björklund <[email protected]>
d17c61a
to
e249752
Compare
Signed-off-by: Anders F Björklund <[email protected]>
e249752
to
3b33549
Compare
The "path" provided will be read, and used instead of the "script".
There are some unsolved issues with this, regarding relative paths.
Currently it requires that
limactl
is always run from the top directory.The paths PWD should probably be recorded in the instance directory?