mirror of
https://github.com/containers/podman.git
synced 2025-11-28 17:18:58 +08:00
Merge pull request #27256 from givensuman/T-27065-add-quadlet-build-args-support
Add BuildArg key to quadlets
This commit is contained in:
@@ -1715,6 +1715,7 @@ Valid options for `[Build]` are listed below:
|
||||
| Annotation=annotation=value | --annotation=annotation=value |
|
||||
| Arch=aarch64 | --arch=aarch64 |
|
||||
| AuthFile=/etc/registry/auth\.json | --authfile=/etc/registry/auth\.json |
|
||||
| BuildArg=foo=bar | --build-arg foo=bar |
|
||||
| ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf |
|
||||
| DNS=192.168.55.1 | --dns=192.168.55.1 |
|
||||
| DNSOption=ndots:1 | --dns-option=ndots:1 |
|
||||
@@ -1757,6 +1758,14 @@ Path of the authentication file.
|
||||
|
||||
This is equivalent to the `--authfile` option of `podman build`.
|
||||
|
||||
### `BuildArg=`
|
||||
|
||||
Specifies a build argument and its value in the same way environment variables are
|
||||
(e.g., env=*value*), but it is not added to the environment variable list in the
|
||||
resulting image's configuration. Can be listed multiple times.
|
||||
|
||||
This is equivalent to the `--build-arg` option of `podman build`.
|
||||
|
||||
### `ContainersConfModule=`
|
||||
|
||||
Load the specified containers.conf(5) module. Equivalent to the Podman `--module` option.
|
||||
@@ -2281,7 +2290,7 @@ Yaml=/opt/k8s/deployment.yml
|
||||
WantedBy=multi-user.target default.target
|
||||
```
|
||||
|
||||
Example for locally built image to be used in a container:
|
||||
Example for locally built image to be used in a container with build-specific arguments:
|
||||
|
||||
`test.build`
|
||||
```
|
||||
@@ -2293,6 +2302,9 @@ ImageTag=localhost/imagename
|
||||
# expecting to find a Containerfile/Dockerfile
|
||||
# + other files needed to build the image
|
||||
SetWorkingDirectory=unit
|
||||
# Set build arguments VERSION and DEBUG
|
||||
BuildArg=VERSION=1.0 \
|
||||
DEBUG=false
|
||||
```
|
||||
|
||||
`test.container`
|
||||
|
||||
@@ -66,6 +66,7 @@ const (
|
||||
KeyArtifact = "Artifact"
|
||||
KeyAuthFile = "AuthFile"
|
||||
KeyAutoUpdate = "AutoUpdate"
|
||||
KeyBuildArg = "BuildArg"
|
||||
KeyCertDir = "CertDir"
|
||||
KeyCgroupsMode = "CgroupsMode"
|
||||
KeyConfigMap = "ConfigMap"
|
||||
@@ -437,6 +438,7 @@ var (
|
||||
KeyAnnotation: true,
|
||||
KeyArch: true,
|
||||
KeyAuthFile: true,
|
||||
KeyBuildArg: true,
|
||||
KeyContainersConfModule: true,
|
||||
KeyDNS: true,
|
||||
KeyDNSOption: true,
|
||||
@@ -1415,6 +1417,7 @@ func ConvertBuild(build *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, isU
|
||||
lookupAndAddAllStrings(build, BuildGroup, allStringKeys, podman)
|
||||
|
||||
keyValKeys := map[string]string{
|
||||
KeyBuildArg: "--build-arg",
|
||||
KeyEnvironment: "--env",
|
||||
KeyLabel: "--label",
|
||||
KeyAnnotation: "--annotation",
|
||||
|
||||
13
test/e2e/quadlet/buildarg.build
Normal file
13
test/e2e/quadlet/buildarg.build
Normal file
@@ -0,0 +1,13 @@
|
||||
## assert-podman-args "--build-arg" "FOO=BAR"
|
||||
## assert-podman-args "--build-arg" "BIZ=BAZ"
|
||||
## assert-podman-args "--build-arg" "MULTIPLE=ARGUMENTS"
|
||||
## assert-podman-args "--build-arg" "WORKS=FINE"
|
||||
|
||||
|
||||
[Build]
|
||||
ImageTag=image:latest
|
||||
SetWorkingDirectory=unit
|
||||
BuildArg=FOO=BAR
|
||||
BuildArg=BIZ=BAZ
|
||||
BuildArg=MULTIPLE=ARGUMENTS \
|
||||
WORKS=FINE
|
||||
@@ -1061,6 +1061,7 @@ BOGUS=foo
|
||||
Entry("Build - Multiple Tags", "multiple-tags.build"),
|
||||
Entry("Build - Network Key host", "network.build"),
|
||||
Entry("Build - PodmanArgs", "podmanargs.build"),
|
||||
Entry("Build - BuildArg Key", "buildarg.build"),
|
||||
Entry("Build - Pull Key", "pull.build"),
|
||||
Entry("Build - Secrets", "secrets.build"),
|
||||
Entry("Build - SetWorkingDirectory is absolute path", "setworkingdirectory-is-abs.build"),
|
||||
|
||||
Reference in New Issue
Block a user