Isolate common code into a function and also fix a sublte bug hiding in
that code.
We need to stab a copy of the package inside our PackageMap to avoid
having symlinks pointing at the same values when iterating over
requires. ( e.g. happened in this case:
https://github.com/rancher-sandbox/cOS-toolkit/pull/467#issuecomment-895060115
)
This changeset allows to have shared templates in a static folder
"templates" present in each luet tree. If the directory is present, it
gets scanned and templated accordingly on top of each package. This
allows to use such folder to store custom blocks to share between
packages.
This is still experimental and subject to change, this is just a first
pass version to provide the feature. It needs to be refined still as it
would be more elegant to use the helm engine properly and map our
structure to the engine instead of adapting it roughly.
Fixes#224
docker.Untar
(https://github.com/mudler/luet/blob/master/vendor/github.com/docker/docker/pkg/archive/archive.go#L942) requires absolute paths.
We didn't do any input validation before, assuming the path passed by
were absolute since they were coming from YAML configuration files, now
that this is not the truth anymore we need to sanitize the input.
With this change we check if the given path is absolute or relative, if
it's relative we calculate the absolute path and use it in place.
grab.NewClient() doesn't set a specific timeout
https://github.com/cavaliercoder/grab/blob/v2.0.0/client.go#L37 even if
the project advertize "default sane settings".
We default to 30, and allow to set it up with HTTP_TIMEOUT
Signed-off-by: Ettore Di Giacinto <mudler@sabayon.org>
Otherwise during uninstall we would retain the files which are
protected. We introduced a specific flag for it to pass during
uninstall, but for now we choose semplicity and expected default first.
Signed-off-by: Ettore Di Giacinto <mudler@sabayon.org>
While this breaks current hashing, it ties also the spec content to the
hash, in this way if we change something in the spec folder, it breaks
the hashing for the package.
Signed-off-by: Ettore Di Giacinto <mudler@sabayon.org>
This commit starts deprecation of `join` keyword in favor of
`requires_final_images` as boolean in the compilation spec.
The change is driven by two reasons: syntax and guarantee unique hashes.
- the hashtree when computing a hash it analizes the requires field of
each spec, ignoring the join field
- the join field doesn't add much value. Having it separate suggests
that a spec can contain both `requires` and `join`, but that's not
actually true. We just act differently on the same list.
Signed-off-by: Ettore Di Giacinto <mudler@sabayon.org>
Optionally add back privileged extraction which can be enabled with
LUET_PRIVILEGED_EXTRACT=true
Signed-off-by: Ettore Di Giacinto <mudler@sabayon.org>
This switches from using the containerd snapshotter to go-containerregistry
library which requires no additional privileges beyond root file system
access.
Signed-off-by: Ettore Di Giacinto <mudler@sabayon.org>
* Reduce possibility of circular dependency
Just by adding an import for bus to anything in the helper dir, we would
run into a circular dependency due to how things are structured. That
means that we cannot set any events for unpacking or docker helper
pulling an image.
This commit tries to work around this by doing several things.
- Remove full imports of the helper module by segmentating some modules
into their own submodule, like docker or match so just using a small match
function doesnt bring the whole module
- Removing a simple function to check if a dir exists from importing
the full helper module and instead write the function (5 lines)
- Using logrus in the bus module instead of logger, which avoids a
circular dependency
Signed-off-by: Itxaka <igarcia@suse.com>
* Add two new events for unpacking an image
Both pre and post unpacking an image
Signed-off-by: Itxaka <igarcia@suse.com>