mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 09:16:29 +00:00
add tag to args passed for package builds
Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
parent
de79880fff
commit
6af6291afe
@ -272,6 +272,8 @@ When building packages, the following build-args automatically are set for you:
|
|||||||
* `SOURCE` - the source repository of the package
|
* `SOURCE` - the source repository of the package
|
||||||
* `REVISION` - the git commit that was used for the build
|
* `REVISION` - the git commit that was used for the build
|
||||||
* `GOPKGVERSION` - the go package version or pseudo-version per https://go.dev/ref/mod#glos-pseudo-version
|
* `GOPKGVERSION` - the go package version or pseudo-version per https://go.dev/ref/mod#glos-pseudo-version
|
||||||
|
* `PKG_HASH` - the git tree hash of the package directory, e.g. `45a1ad5919f0b6acf0f0cf730e9434abfae11fe6`; tag part of `linuxkit pkg show-tag`
|
||||||
|
* `PKG_IMAGE` - the name of the image that is being built, e.g. `linuxkit/init`; image name part of `linuxkit pkg show-tag`. Combine with `PKG_HASH` for the full tag.
|
||||||
|
|
||||||
Note that the above are set **only** if you do not set them in `build.yaml`. Your settings _always_
|
Note that the above are set **only** if you do not set them in `build.yaml`. Your settings _always_
|
||||||
override these built-in ones.
|
override these built-in ones.
|
||||||
|
@ -431,6 +431,14 @@ func (p Pkg) Build(bos ...BuildOpt) error {
|
|||||||
if _, ok := imageBuildOpts.BuildArgs["GOPKGVERSION"]; !ok && goPkgVersion != "" {
|
if _, ok := imageBuildOpts.BuildArgs["GOPKGVERSION"]; !ok && goPkgVersion != "" {
|
||||||
imageBuildOpts.BuildArgs["GOPKGVERSION"] = &goPkgVersion
|
imageBuildOpts.BuildArgs["GOPKGVERSION"] = &goPkgVersion
|
||||||
}
|
}
|
||||||
|
if _, ok := imageBuildOpts.BuildArgs["PKG_HASH"]; !ok && p.Hash() != "" {
|
||||||
|
ret := p.Hash()
|
||||||
|
imageBuildOpts.BuildArgs["PKG_HASH"] = &ret
|
||||||
|
}
|
||||||
|
if _, ok := imageBuildOpts.BuildArgs["PKG_IMAGE"]; !ok && p.Image() != "" {
|
||||||
|
ret := p.Image()
|
||||||
|
imageBuildOpts.BuildArgs["PKG_IMAGE"] = &ret
|
||||||
|
}
|
||||||
|
|
||||||
// build for each arch and save in the linuxkit cache
|
// build for each arch and save in the linuxkit cache
|
||||||
for _, platform := range platformsToBuild {
|
for _, platform := range platformsToBuild {
|
||||||
|
@ -317,6 +317,11 @@ func (p Pkg) Tag() string {
|
|||||||
return p.org + "/" + p.image + ":" + t
|
return p.org + "/" + p.image + ":" + t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Image returns the image name without the tag
|
||||||
|
func (p Pkg) Image() string {
|
||||||
|
return p.org + "/" + p.image
|
||||||
|
}
|
||||||
|
|
||||||
// FullTag returns a reference expanded tag
|
// FullTag returns a reference expanded tag
|
||||||
func (p Pkg) FullTag() string {
|
func (p Pkg) FullTag() string {
|
||||||
return util.ReferenceExpand(p.Tag())
|
return util.ReferenceExpand(p.Tag())
|
||||||
|
Loading…
Reference in New Issue
Block a user