2018-04-19 03:00:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								package  cli  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 03:05:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// the cli package contains spf13/cobra related structs that help make up
  
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:00:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// the command line for buildah commands. it resides here so other projects
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// that vendor in this code can use them too.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  (  
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"fmt" 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-08 03:52:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"maps" 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"os" 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-11 06:21:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"runtime" 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"strings" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-07 06:49:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/buildah/define" 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-30 05:04:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/buildah/internal" 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/buildah/pkg/completion" 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-20 19:31:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/buildah/pkg/parse" 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									commonComp  "github.com/containers/common/pkg/completion" 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-14 20:12:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/common/pkg/config" 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 04:28:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									encconfig  "github.com/containers/ocicrypt/config" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									enchelpers  "github.com/containers/ocicrypt/helpers" 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-16 00:21:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/containers/storage/pkg/unshare" 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-13 01:53:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/opencontainers/runtime-spec/specs-go" 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/spf13/pflag" 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:00:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// LayerResults represents the results of the layer flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  LayerResults  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ForceRm  bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Layers   bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-03-13 01:53:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// UserNSResults represents the results for the UserNS flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  UserNSResults  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNS             string 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-22 03:51:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									GroupAdd           [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									UserNSUIDMap       [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNSGIDMap       [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNSUIDMapUser   string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UserNSGIDMapGroup  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-03-13 01:53:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// NameSpaceResults represents the results for Namespace flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  NameSpaceResults  struct  {  
						 
					
						
							
								
									
										
										
										
											2021-11-19 04:20:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Cgroup         string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									IPC            string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Network        string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CNIConfigDir   string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CNIPlugInPath  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PID            string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UTS            string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-09-07 03:17:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 02:03:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// BudResults represents the results for Build flags
  
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								type  BudResults  struct  {  
						 
					
						
							
								
									
										
										
										
											2021-09-28 05:26:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AllPlatforms         bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Annotation           [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Authfile             string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BuildArg             [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 18:32:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BuildArgFile         [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 18:11:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BuildContext         [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-05 14:29:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CacheFrom            [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CacheTo              [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-04 15:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CacheTTL             string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CertDir              string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Compress             bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Creds                string 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-14 18:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CPPFlags             [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DisableCompression   bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DisableContentTrust  bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-19 21:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									IgnoreFile           string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									File                 [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Format               string 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-25 09:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									From                 string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Iidfile              string 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 00:28:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									InheritLabels        bool 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-03 00:14:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									InheritAnnotations   bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Label                [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-02 15:29:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									LayerLabel           [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Logfile              string 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-06 14:33:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									LogSplitByPlatform   bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 20:16:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Manifest             string 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 07:43:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									NoHostname           bool 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-08 04:44:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									NoHosts              bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-02 06:18:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									NoCache              bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-27 04:56:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Timestamp            int64 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-01 15:59:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									OmitHistory          bool 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 18:48:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									OCIHooksDir          [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 06:17:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Pull                 string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PullAlways           bool 
							 
						 
					
						
							
								
									
										
											 
										
											
												Fix --pull=true||false and add --pull-never to bud and from (retry)
(Replaces #1873 as it had lint issues that were timing out tests that I couldn't
track down easily)
Prior to this fix, if someone did `buildah bud --pull=false .` and the image in
the Containerfile's FROM statement was not local, the build would fail. The same
build on Docker will succeed. In Docker, when `--pull` is set to false, it only
pulls the image from the registry if there was not one locally. Buildah would never
pull the image and if the image was not locally available, it would throw an error.
In certain Kubernetes environments, this was especially troublesome.
To retain the old `--pull=false` functionality, I've created a new `--pull-never`
option that fails if an image is not locally available just like the old
`--pull=false` option used to do.
In addition, if there was a newer version of the image on the repository than
the one locally, the `--pull=true` option would not pull the image as it should
have, this corrects that.
Changes both the from and bud commands.
Addresses: #1675
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Closes: #1959
Approved by: rhatdan
											 
										 
										
											2019-10-31 22:15:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PullNever            bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Quiet                bool 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-04 13:37:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									IdentityLabel        bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Rm                   bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Runtime              string 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-02 06:18:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RuntimeFlags         [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 03:05:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SbomPreset           string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SbomScannerImage     string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SbomScannerCommand   [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SbomMergeStrategy    string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SbomOutput           string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SbomImgOutput        string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SbomPurlOutput       string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SbomImgPurlOutput    string 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-17 06:21:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Secrets              [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-26 14:07:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SSH                  [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SignaturePolicy      string 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 01:23:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SignBy               string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Squash               bool 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-15 18:00:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SkipUnusedStages     bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-11 09:56:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Stdin                bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Tag                  [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2025-05-15 04:26:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BuildOutputs         [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-03 07:31:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Target               string 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-24 19:55:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TLSVerify            bool 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-22 16:53:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Jobs                 int 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-25 21:53:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									LogRusage            bool 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 23:09:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RusageLogFile        string 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 04:52:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									UnsetEnvs            [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 01:34:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									UnsetLabels          [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-02 00:16:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									UnsetAnnotations     [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:24:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Envs                 [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:37:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									OSFeatures           [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									OSVersion            string 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-18 04:27:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CWOptions            string 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 03:05:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SBOMOptions          [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-07 04:32:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CompatVolumes        bool 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-30 05:04:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SourceDateEpoch      string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RewriteTimestamp     bool 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-21 03:05:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CreatedAnnotation    bool 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:00:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// FromAndBugResults represents the results for common flags
  
						 
					
						
							
								
									
										
										
										
											2021-08-25 02:03:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// in build and from
  
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								type  FromAndBudResults  struct  {  
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AddHost         [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BlobCache       string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CapAdd          [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CapDrop         [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-26 09:13:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CDIConfigDir    string 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CgroupParent    string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUPeriod       uint64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUQuota        int64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUSetCPUs      string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUSetMems      string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CPUShares       uint64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DecryptionKeys  [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Devices         [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DNSSearch       [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DNSServers      [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DNSOptions      [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									HTTPProxy       bool 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Isolation       string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Memory          string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MemorySwap      string 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 14:46:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Retry           int 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RetryDelay      string 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SecurityOpt     [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ShmSize         string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ulimit          [ ] string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Volumes         [ ] string 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// GetUserNSFlags returns the common flags for usernamespace
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetUserNSFlags ( flags  * UserNSResults )  pflag . FlagSet  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-22 03:51:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									usernsFlags . StringSliceVar ( & flags . GroupAdd ,  "group-add" ,  nil ,  "add additional groups to the primary container process. 'keep-groups' allows container processes to use supplementary groups." ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									usernsFlags . StringVar ( & flags . UserNS ,  "userns" ,  "" ,  "'container', `path` of user namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-08 08:28:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									usernsFlags . StringSliceVar ( & flags . UserNSUIDMap ,  "userns-uid-map" ,  [ ] string { } ,  "`containerUID:hostUID:length` UID mapping to use in user namespace" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags . StringSliceVar ( & flags . UserNSGIDMap ,  "userns-gid-map" ,  [ ] string { } ,  "`containerGID:hostGID:length` GID mapping to use in user namespace" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									usernsFlags . StringVar ( & flags . UserNSUIDMapUser ,  "userns-uid-map-user" ,  "" ,  "`name` of entries from /etc/subuid to use to set user namespace UID mapping" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags . StringVar ( & flags . UserNSGIDMapGroup ,  "userns-gid-map-group" ,  "" ,  "`name` of entries from /etc/subgid to use to set user namespace GID mapping" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  usernsFlags 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetUserNSFlagsCompletions returns the FlagCompletions for the userns flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetUserNSFlagsCompletions ( )  commonComp . FlagCompletions  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion  :=  commonComp . FlagCompletions { } 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-22 03:51:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "group-add" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "userns" ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns-uid-map" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns-gid-map" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns-uid-map-user" ]  =  commonComp . AutocompleteSubuidName 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "userns-gid-map-group" ]  =  commonComp . AutocompleteSubgidName 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  flagCompletion 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetNameSpaceFlags returns the common flags for a namespace menu
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetNameSpaceFlags ( flags  * NameSpaceResults )  pflag . FlagSet  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 04:20:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Cgroup ,  "cgroupns" ,  "" ,  "'private', or 'host'" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . IPC ,  string ( specs . IPCNamespace ) ,  "" ,  "'private', `path` of IPC namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Network ,  string ( specs . NetworkNamespace ) ,  "" ,  "'private', 'none', 'ns:path' of network namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-10 22:12:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CNIConfigDir ,  "cni-config-dir" ,  "" ,  "`directory` of CNI configuration files" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_  =  fs . MarkHidden ( "cni-config-dir" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CNIPlugInPath ,  "cni-plugin-path" ,  "" ,  "`path` of CNI network plugins" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_  =  fs . MarkHidden ( "cni-plugin-path" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . PID ,  string ( specs . PIDNamespace ) ,  "" ,  "private, `path` of PID namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . UTS ,  string ( specs . UTSNamespace ) ,  "" ,  "private, :`path` of UTS namespace to join, or 'host'" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetNameSpaceFlagsCompletions returns the FlagCompletions for the namespace flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetNameSpaceFlagsCompletions ( )  commonComp . FlagCompletions  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion  :=  commonComp . FlagCompletions { } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 04:20:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "cgroupns" ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ string ( specs . IPCNamespace ) ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ string ( specs . NetworkNamespace ) ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ string ( specs . PIDNamespace ) ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ string ( specs . UTSNamespace ) ]  =  completion . AutocompleteNamespaceFlag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  flagCompletion 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetLayerFlags returns the common flags for layers
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetLayerFlags ( flags  * LayerResults )  pflag . FlagSet  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:40:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . ForceRm ,  "force-rm" ,  false ,  "always remove intermediate containers after a build, even if the build is unsuccessful." ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 06:17:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Layers ,  "layers" ,  UseLayers ( ) ,  "use intermediate layers during build. Use BUILDAH_LAYERS environment variable to override." ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Note: GetLayerFlagsCompletion is not needed since GetLayerFlags only contains bool flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 02:03:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetBudFlags returns common build flags
  
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  GetBudFlags ( flags  * BudResults )  pflag . FlagSet  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-28 05:26:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . AllPlatforms ,  "all-platforms" ,  false ,  "attempt to build for all base image platforms" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "arch" ,  runtime . GOARCH ,  "set the ARCH of the image to the provided value instead of the architecture of the host" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:40:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . Annotation ,  "annotation" ,  [ ] string { } ,  "set metadata for an image (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 02:07:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Authfile ,  "authfile" ,  "" ,  "path of the authentication file." ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 18:48:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . OCIHooksDir ,  "hooks-dir" ,  [ ] string { } ,  "set the OCI hooks directory path (may be set multiple times)" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-07 23:59:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . BuildArg ,  "build-arg" ,  [ ] string { } ,  "`argument=value` to supply to the builder" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-27 00:21:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . BuildArgFile ,  "build-arg-file" ,  [ ] string { } ,  "`argfile.conf` containing lines of argument=value to supply to the builder" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 18:11:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . BuildContext ,  "build-context" ,  [ ] string { } ,  "`argument=value` to supply additional build context to the builder" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-05 14:29:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . CacheFrom ,  "cache-from" ,  [ ] string { } ,  "remote repository list to utilise as potential cache source." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . CacheTo ,  "cache-to" ,  [ ] string { } ,  "remote repository list to utilise as potential cache destination." ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-04 15:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CacheTTL ,  "cache-ttl" ,  "" ,  "only consider cache images under specified duration." ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CertDir ,  "cert-dir" ,  "" ,  "use certificates at the specified path to access the registry" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:40:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Compress ,  "compress" ,  false ,  "this is a legacy option, which has no effect on the image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-07 04:32:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . CompatVolumes ,  "compat-volumes" ,  false ,  "preserve the contents of VOLUMEs during RUN instructions" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 00:28:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . InheritLabels ,  "inherit-labels" ,  true ,  "inherit the labels from the base image or base stages." ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-03 00:14:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . InheritAnnotations ,  "inherit-annotations" ,  true ,  "inherit the annotations from the base image or base stages." ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-14 18:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . CPPFlags ,  "cpp-flag" ,  [ ] string { } ,  "set additional flag to pass to C preprocessor (cpp)" ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-21 03:05:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . CreatedAnnotation ,  "created-annotation" ,  true ,  ` set an "org.opencontainers.image.created" annotation in the image ` ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Creds ,  "creds" ,  "" ,  "use `[username[:password]]` for accessing the registry" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-18 04:27:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVarP ( & flags . CWOptions ,  "cw" ,  "" ,  "" ,  "confidential workload `options`" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-14 03:16:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVarP ( & flags . DisableCompression ,  "disable-compression" ,  "D" ,  true ,  "don't compress layers by default" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:40:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . DisableContentTrust ,  "disable-content-trust" ,  false ,  "this is a Docker specific option and is a NOOP" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:24:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . Envs ,  "env" ,  [ ] string { } ,  "set environment variable for the image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-25 09:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . From ,  "from" ,  "" ,  "image name used to replace the value in the first FROM instruction in the Containerfile" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-19 21:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . IgnoreFile ,  "ignorefile" ,  "" ,  "path to an alternate .dockerignore file" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVarP ( & flags . File ,  "file" ,  "f" ,  [ ] string { } ,  "`pathname or URL` of a Dockerfile" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Format ,  "format" ,  DefaultFormat ( ) ,  "`format` of the built image's manifest and metadata. Use BUILDAH_FORMAT environment variable to override." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Iidfile ,  "iidfile" ,  "" ,  "`file` to write the image ID to" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . IntVar ( & flags . Jobs ,  "jobs" ,  1 ,  "how many stages to run in parallel" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:40:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . Label ,  "label" ,  [ ] string { } ,  "set metadata for an image (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-02 15:29:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . LayerLabel ,  "layer-label" ,  [ ] string { } ,  "set metadata for an intermediate image (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Logfile ,  "logfile" ,  "" ,  "log to `file` instead of stdout/stderr" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-06 14:33:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . LogSplitByPlatform ,  "logsplit" ,  false ,  "split logfile to different files for each platform" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-23 00:54:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . Int ( "loglevel" ,  0 ,  "NO LONGER USED, flag ignored, and hidden" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "loglevel" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking the loglevel flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . LogRusage ,  "log-rusage" ,  false ,  "log resource usage at each build step" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "log-rusage" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking the log-rusage flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 23:09:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . RusageLogFile ,  "rusage-logfile" ,  "" ,  "destination file to which rusage should be logged to instead of stdout (= the default)." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "rusage-logfile" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking the rusage-logfile flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 06:11:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Manifest ,  "manifest" ,  "" ,  "add the image to the specified manifest list. Creates manifest list if it does not exist" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:40:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . NoCache ,  "no-cache" ,  false ,  "do not use existing cached images for the container build. Build from the start with a new set of cached layers." ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 07:43:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . NoHostname ,  "no-hostname" ,  false ,  "do not create new /etc/hostname file for RUN instructions, use the one from the base image." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . NoHosts ,  "no-hosts" ,  false ,  "do not create new /etc/hosts file for RUN instructions, use the one from the base image." ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "os" ,  runtime . GOOS ,  "set the OS to the provided value instead of the current operating system of the host" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:37:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . OSFeatures ,  "os-feature" ,  [ ] string { } ,  "set required OS `feature` for the target image in addition to values from the base image" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . OSVersion ,  "os-version" ,  "" ,  "set required OS `version` for the target image instead of the value from the base image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-05 03:10:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Pull ,  "pull" ,  "missing" ,  ` pull  base  and  SBOM  scanner  images  from  the  registry .  Values : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								always :   pull  base  and  SBOM  scanner  images  even  if  the  named  images  are  present  in  store .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								missing :  pull  base  and  SBOM  scanner  images  if  the  named  images  are  not  present  in  store .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								never :    only  use  images  present  in  store  if  available .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								newer :    only  pull  base  and  SBOM  scanner  images  when  newer  images  exist  on  the  registry  than  those  in  the  store . ` )  
						 
					
						
							
								
									
										
										
										
											2025-07-26 03:18:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . Lookup ( "pull" ) . NoOptDefVal  =  "always"  // treat a --pull with no argument like --pull=always
 
							 
						 
					
						
							
								
									
										
											 
										
											
												Fix --pull=true||false and add --pull-never to bud and from (retry)
(Replaces #1873 as it had lint issues that were timing out tests that I couldn't
track down easily)
Prior to this fix, if someone did `buildah bud --pull=false .` and the image in
the Containerfile's FROM statement was not local, the build would fail. The same
build on Docker will succeed. In Docker, when `--pull` is set to false, it only
pulls the image from the registry if there was not one locally. Buildah would never
pull the image and if the image was not locally available, it would throw an error.
In certain Kubernetes environments, this was especially troublesome.
To retain the old `--pull=false` functionality, I've created a new `--pull-never`
option that fails if an image is not locally available just like the old
`--pull=false` option used to do.
In addition, if there was a newer version of the image on the repository than
the one locally, the `--pull=true` option would not pull the image as it should
have, this corrects that.
Changes both the from and bud commands.
Addresses: #1675
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Closes: #1959
Approved by: rhatdan
											 
										 
										
											2019-10-31 22:15:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . PullAlways ,  "pull-always" ,  false ,  "pull the image even if the named image is present in store" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 06:17:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "pull-always" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking the pull-always flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										
											
												Fix --pull=true||false and add --pull-never to bud and from (retry)
(Replaces #1873 as it had lint issues that were timing out tests that I couldn't
track down easily)
Prior to this fix, if someone did `buildah bud --pull=false .` and the image in
the Containerfile's FROM statement was not local, the build would fail. The same
build on Docker will succeed. In Docker, when `--pull` is set to false, it only
pulls the image from the registry if there was not one locally. Buildah would never
pull the image and if the image was not locally available, it would throw an error.
In certain Kubernetes environments, this was especially troublesome.
To retain the old `--pull=false` functionality, I've created a new `--pull-never`
option that fails if an image is not locally available just like the old
`--pull=false` option used to do.
In addition, if there was a newer version of the image on the repository than
the one locally, the `--pull=true` option would not pull the image as it should
have, this corrects that.
Changes both the from and bud commands.
Addresses: #1675
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Closes: #1959
Approved by: rhatdan
											 
										 
										
											2019-10-31 22:15:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . PullNever ,  "pull-never" ,  false ,  "do not pull the image, use the image present in store if available" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 06:17:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "pull-never" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking the pull-never flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVarP ( & flags . Quiet ,  "quiet" ,  "q" ,  false ,  "refrain from announcing build instructions and image read/write progress" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-03 03:04:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . OmitHistory ,  "omit-history" ,  false ,  "omit build history information from built image" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . IdentityLabel ,  "identity-label" ,  true ,  "add default identity label" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:40:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Rm ,  "rm" ,  true ,  "remove intermediate containers after a successful build" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 02:03:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// "runtime" definition moved to avoid name collision in podman build.  Defined in cmd/buildah/build.go.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-02 06:18:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . RuntimeFlags ,  "runtime-flag" ,  [ ] string { } ,  "add global flags for the container runtime" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 03:05:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SbomPreset ,  "sbom" ,  "" ,  "scan working container using `preset` configuration" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SbomScannerImage ,  "sbom-scanner-image" ,  "" ,  "scan working container using scanner command from `image`" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . SbomScannerCommand ,  "sbom-scanner-command" ,  nil ,  "scan working container using `command` in scanner image" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SbomMergeStrategy ,  "sbom-merge-strategy" ,  "" ,  "merge scan results using `strategy`" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SbomOutput ,  "sbom-output" ,  "" ,  "save scan results to `file`" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SbomImgOutput ,  "sbom-image-output" ,  "" ,  "add scan results to image as `path`" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SbomPurlOutput ,  "sbom-purl-output" ,  "" ,  "save scan results to `file``" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SbomImgPurlOutput ,  "sbom-image-purl-output" ,  "" ,  "add scan results to image as `path`" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-17 06:21:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . Secrets ,  "secret" ,  [ ] string { } ,  "secret file to expose to the build" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 01:23:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SignBy ,  "sign-by" ,  "" ,  "sign the image using a GPG key with the specified `FINGERPRINT`" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SignaturePolicy ,  "signature-policy" ,  "" ,  "`pathname` of signature policy file (not usually used)" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "signature-policy" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking the signature-policy flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-15 18:00:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . SkipUnusedStages ,  "skip-unused-stages" ,  true ,  "skips stages in multi-stage builds which do not affect the final target" ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-30 05:04:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sourceDateEpochUsageDefault  :=  ", defaults to current time" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  v  :=  os . Getenv ( internal . SourceDateEpochName ) ;  v  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sourceDateEpochUsageDefault  =  "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . SourceDateEpoch ,  "source-date-epoch" ,  os . Getenv ( internal . SourceDateEpochName ) ,  "set new timestamps in image info to `seconds` after the epoch" + sourceDateEpochUsageDefault ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . RewriteTimestamp ,  "rewrite-timestamp" ,  false ,  "set timestamps in layers to no later than the value for --source-date-epoch" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 06:17:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Squash ,  "squash" ,  false ,  "squash all image layers into a single layer" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-26 14:07:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . SSH ,  "ssh" ,  [ ] string { } ,  "SSH agent socket or keys to expose to the build. (format: default|<id>[=<socket>|<key>[,<key>]])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-11 09:56:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . Stdin ,  "stdin" ,  false ,  "pass stdin into containers" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-03 01:41:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVarP ( & flags . Tag ,  "tag" ,  "t" ,  [ ] string { } ,  "tagged `name` to apply to the built image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-05-15 04:26:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVarP ( & flags . BuildOutputs ,  "output" ,  "o" ,  nil ,  "output destination (format: type=local,dest=path)" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-03 07:31:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Target ,  "target" ,  "" ,  "set the target build stage to build" ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-30 05:04:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . Int64Var ( & flags . Timestamp ,  "timestamp" ,  0 ,  "set new timestamps in image info and layer to `seconds` after the epoch, defaults to current times" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-24 19:55:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . TLSVerify ,  "tls-verify" ,  true ,  "require HTTPS and verify certificates when accessing the registry" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "variant" ,  "" ,  "override the `variant` of the specified image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:40:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . UnsetEnvs ,  "unsetenv" ,  nil ,  "unset environment variable from final image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 01:34:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . UnsetLabels ,  "unsetlabel" ,  nil ,  "unset label when inheriting labels from base image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-21 03:05:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . UnsetAnnotations ,  "unsetannotation" ,  nil ,  "unset annotation when inheriting annotations from base image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 02:03:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetBudFlagsCompletions returns the FlagCompletions for the common build flags
  
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  GetBudFlagsCompletions ( )  commonComp . FlagCompletions  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion  :=  commonComp . FlagCompletions { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "annotation" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-14 18:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "arch" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "authfile" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "build-arg" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 18:32:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "build-arg-file" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 18:11:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "build-context" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "cache-from" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-18 13:47:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "cache-to" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-04 15:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "cache-ttl" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "cert-dir" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-14 18:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "cpp-flag" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "creds" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-18 04:27:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "cw" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:24:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "env" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "file" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "format" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-14 18:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "from" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 18:48:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "hooks-dir" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-19 21:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "ignorefile" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "iidfile" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "jobs" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "label" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-02 15:29:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "layer-label" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "logfile" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 20:16:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "manifest" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "os" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 06:37:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "os-feature" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "os-version" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-14 18:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "output" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 06:17:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "pull" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "runtime-flag" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 03:05:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "sbom" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "sbom-scanner-image" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "sbom-scanner-command" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "sbom-merge-strategy" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "sbom-output" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "sbom-image-output" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "sbom-purl-output" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "sbom-image-purl-output" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-17 06:21:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "secret" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "sign-by" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "signature-policy" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-14 18:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "ssh" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-30 05:04:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "source-date-epoch" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "tag" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "target" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-02 22:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "timestamp" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 04:52:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "unsetenv" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 01:34:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "unsetlabel" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-02 00:16:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "unsetannotation" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-14 18:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "variant" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  flagCompletion 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 02:03:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetFromAndBudFlags returns from and build flags
  
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  GetFromAndBudFlags ( flags  * FromAndBudResults ,  usernsResults  * UserNSResults ,  namespaceResults  * NameSpaceResults )  ( pflag . FlagSet ,  error )  {  
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs  :=  pflag . FlagSet { } 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									defaultContainerConfig ,  err  :=  config . Default ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  !=  nil  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-06 22:16:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  fs ,  fmt . Errorf ( "failed to get default container config: %w" ,  err ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . AddHost ,  "add-host" ,  [ ] string { } ,  "add a custom host-to-IP mapping (`host:ip`) (default [])" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . BlobCache ,  "blob-cache" ,  "" ,  "assume image blobs in the specified directory will be available for pushing" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 19:46:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  err  :=  fs . MarkHidden ( "blob-cache" ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										panic ( fmt . Sprintf ( "error marking net flag as hidden: %v" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . CapAdd ,  "cap-add" ,  [ ] string { } ,  "add the specified capability when running (default [])" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . CapDrop ,  "cap-drop" ,  [ ] string { } ,  "drop the specified capability when running (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-26 09:13:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CDIConfigDir ,  "cdi-config-dir" ,  "" ,  "`directory` of CDI configuration files" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_  =  fs . MarkHidden ( "cdi-config-dir" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CgroupParent ,  "cgroup-parent" ,  "" ,  "optional parent cgroup for the container" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . Uint64Var ( & flags . CPUPeriod ,  "cpu-period" ,  0 ,  "limit the CPU CFS (Completely Fair Scheduler) period" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . Int64Var ( & flags . CPUQuota ,  "cpu-quota" ,  0 ,  "limit the CPU CFS (Completely Fair Scheduler) quota" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . Uint64VarP ( & flags . CPUShares ,  "cpu-shares" ,  "c" ,  0 ,  "CPU shares (relative weight)" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CPUSetCPUs ,  "cpuset-cpus" ,  "" ,  "CPUs in which to allow execution (0-3, 0,1)" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . CPUSetMems ,  "cpuset-mems" ,  "" ,  "memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems." ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . DecryptionKeys ,  "decryption-key" ,  nil ,  "key needed to decrypt the image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-26 09:13:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . Devices ,  "device" ,  defaultContainerConfig . Containers . Devices . Get ( ) ,  "additional devices to provide" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 20:55:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . DNSSearch ,  "dns-search" ,  defaultContainerConfig . Containers . DNSSearches . Get ( ) ,  "set custom DNS search domains" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . DNSServers ,  "dns" ,  defaultContainerConfig . Containers . DNSServers . Get ( ) ,  "set custom DNS servers or disable it completely by setting it to 'none', which prevents the automatic creation of `/etc/resolv.conf`." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . DNSOptions ,  "dns-option" ,  defaultContainerConfig . Containers . DNSOptions . Get ( ) ,  "set custom DNS options" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-17 00:31:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . BoolVar ( & flags . HTTPProxy ,  "http-proxy" ,  true ,  "pass through HTTP Proxy environment variables" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . Isolation ,  "isolation" ,  DefaultIsolation ( ) ,  "`type` of process isolation to use. Use BUILDAH_ISOLATION environment variable to override." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVarP ( & flags . Memory ,  "memory" ,  "m" ,  "" ,  "memory limit (format: <number>[<unit>], where unit = b, k, m or g)" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . MemorySwap ,  "memory-swap" ,  "" ,  "swap limit equal to memory plus swap: '-1' to enable unlimited swap" ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-21 05:01:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . IntVar ( & flags . Retry ,  "retry" ,  int ( defaultContainerConfig . Engine . Retry ) ,  "number of times to retry in case of failure when performing push/pull" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . StringVar ( & flags . RetryDelay ,  "retry-delay" ,  defaultContainerConfig . Engine . RetryDelay ,  "delay between retries in case of push/pull failures" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "arch" ,  runtime . GOARCH ,  "set the ARCH of the image to the provided value instead of the architecture of the host" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . String ( "os" ,  runtime . GOOS ,  "prefer `OS` instead of the running OS when pulling images" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 06:17:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSlice ( "platform" ,  [ ] string { parse . DefaultPlatform ( ) } ,  "set the `OS/ARCH[/VARIANT]` of the image to the provided value instead of the current operating system and architecture of the host (for example \"linux/arm\")" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . String ( "variant" ,  "" ,  "override the `variant` of the specified image" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-03 01:41:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVar ( & flags . SecurityOpt ,  "security-opt" ,  [ ] string { } ,  "security options (default [])" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringVar ( & flags . ShmSize ,  "shm-size" ,  defaultContainerConfig . Containers . ShmSize ,  "size of '/dev/shm'. The format is `<number><unit>`." ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 20:55:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringSliceVar ( & flags . Ulimit ,  "ulimit" ,  defaultContainerConfig . Containers . DefaultUlimits . Get ( ) ,  "ulimit options" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-24 14:58:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fs . StringArrayVarP ( & flags . Volumes ,  "volume" ,  "v" ,  defaultContainerConfig . Volumes ( ) ,  "bind mount a volume into the container" ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Add in the usernamespace and namespaceflags
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									usernsFlags  :=  GetUserNSFlags ( usernsResults ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									namespaceFlags  :=  GetNameSpaceFlags ( namespaceResults ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . AddFlagSet ( & usernsFlags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fs . AddFlagSet ( & namespaceFlags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-08 01:54:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fs ,  nil 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 23:35:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 02:03:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// GetFromAndBudFlagsCompletions returns the FlagCompletions for the from and build flags
  
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  GetFromAndBudFlagsCompletions ( )  commonComp . FlagCompletions  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion  :=  commonComp . FlagCompletions { } 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "arch" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "add-host" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "blob-cache" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cap-add" ]  =  commonComp . AutocompleteCapabilities 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cap-drop" ]  =  commonComp . AutocompleteCapabilities 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cgroup-parent" ]  =  commonComp . AutocompleteDefault  // FIXME: This would be a path right?!
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpu-period" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpu-quota" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpu-shares" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpuset-cpus" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "cpuset-mems" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 09:59:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "decryption-key" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "device" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "dns-search" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "dns" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "dns-option" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "isolation" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "memory" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "memory-swap" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "os" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
											 
										
											
												bud: teach --platform to take a list
Add a pkg/parse.PlatformsFromOptions() which understands a "variant"
value as an optional third value in an OS/ARCH[/VARIANT] argument value,
which accepts a comma-separated list of them, and which returns a list
of platforms.
Teach "from" and "pull" about the --platform option and add integration
tests for them, warning if --platform was given multiple values.
Add a define.BuildOptions.JobSemaphore which an imagebuildah executor
will use in preference to one that it might allocate for itself.
In main(), allocate a JobSemaphore if the number of jobs is not 0 (which
we treat as "unlimited", and continue to allow executors to do).
In addManifest(), take a lock on the manifest list's image ID so that we
don't overwrite changes that another thread might be making while we're
attempting to make changes to it.  In main(), create an empty list if
the list doesn't already exist before we start down this path, so that
we don't get two threads trying to create that manifest list at the same
time later on.  Two processes could still try to create the same list
twice, but it's an incremental improvement.
Finally, if we've been given multiple platforms to build for, run their
builds concurrently and gather up their results.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
											 
										 
										
											2021-06-22 22:52:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "platform" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 14:46:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "retry" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "retry-delay" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "security-opt" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "shm-size" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "ulimit" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flagCompletion [ "volume" ]  =  commonComp . AutocompleteDefault 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									flagCompletion [ "variant" ]  =  commonComp . AutocompleteNone 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Add in the usernamespace and namespace flag completions
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									userNsComp  :=  GetUserNSFlagsCompletions ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-08 03:52:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									maps . Copy ( flagCompletion ,  userNsComp ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									namespaceComp  :=  GetNameSpaceFlagsCompletions ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-08 03:52:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									maps . Copy ( flagCompletion ,  namespaceComp ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 19:56:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  flagCompletion 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 00:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// UseLayers returns true if BUILDAH_LAYERS is set to "1" or "true"
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// otherwise it returns false
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  UseLayers ( )  bool  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									layers  :=  os . Getenv ( "BUILDAH_LAYERS" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  strings . ToLower ( layers )  ==  "true"  ||  layers  ==  "1"  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-08-24 00:10:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// DefaultFormat returns the default image format
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  DefaultFormat ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									format  :=  os . Getenv ( "BUILDAH_FORMAT" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  format  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  format 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-07 06:49:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  define . OCI 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 00:10:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// DefaultIsolation returns the default image format
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  DefaultIsolation ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									isolation  :=  os . Getenv ( "BUILDAH_ISOLATION" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  isolation  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  isolation 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-16 00:21:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  unshare . IsRootless ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  "rootless" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-07 06:49:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  define . OCI 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 00:10:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-09-03 19:20:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-19 04:39:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// DefaultHistory returns the default add-history setting
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  DefaultHistory ( )  bool  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									history  :=  os . Getenv ( "BUILDAH_HISTORY" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  strings . ToLower ( history )  ==  "true"  ||  history  ==  "1"  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-03 19:20:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  VerifyFlagsArgsOrder ( args  [ ] string )  error  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  _ ,  arg  :=  range  args  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  strings . HasPrefix ( arg ,  "-" )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-06 17:14:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  fmt . Errorf ( "no options (%s) can be specified after the image or container name" ,  arg ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-03 19:20:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-17 05:07:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// AliasFlags is a function to handle backwards compatibility with old flags
  
						 
					
						
							
								
									
										
										
										
											2024-08-07 03:07:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  AliasFlags ( _  * pflag . FlagSet ,  name  string )  pflag . NormalizedName  {  
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  name  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  "net" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "network" 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 05:12:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									case  "override-arch" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "arch" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  "override-os" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "os" 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 00:43:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									case  "purge" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "rm" 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-02 18:45:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									case  "tty" : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name  =  "terminal" 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-04 22:13:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  pflag . NormalizedName ( name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2023-04-02 03:07:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// LookupEnvVarReferences returns a copy of specs with keys and values resolved
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// from environ. Strings are in "key=value" form, the same as [os.Environ].
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//   - When a string in specs lacks "=", it is treated as a key and the value
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//     is retrieved from environ. When the key is missing from environ, neither
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//     the key nor value are returned.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//   - When a string in specs lacks "=" and ends with "*", it is treated as
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//     a key prefix and any keys with the same prefix in environ are returned.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//   - When a string in specs is exactly "*", all keys and values in environ
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//     are returned.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  LookupEnvVarReferences ( specs ,  environ  [ ] string )  [ ] string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									result  :=  make ( [ ] string ,  0 ,  len ( specs ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  _ ,  spec  :=  range  specs  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  key ,  _ ,  ok  :=  strings . Cut ( spec ,  "=" ) ;  ok  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											result  =  append ( result ,  spec ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  key  ==  "*"  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											result  =  append ( result ,  environ ... ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											prefix  :=  key  +  "=" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  strings . HasSuffix ( key ,  "*" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												prefix  =  strings . TrimSuffix ( key ,  "*" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  _ ,  spec  :=  range  environ  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  strings . HasPrefix ( spec ,  prefix )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													result  =  append ( result ,  spec ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  result 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2023-05-19 04:28:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// DecryptConfig translates decryptionKeys into a DescriptionConfig structure
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  DecryptConfig ( decryptionKeys  [ ] string )  ( * encconfig . DecryptConfig ,  error )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									var  decryptConfig  * encconfig . DecryptConfig 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  len ( decryptionKeys )  >  0  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// decryption
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dcc ,  err  :=  enchelpers . CreateCryptoConfig ( [ ] string { } ,  decryptionKeys ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  nil ,  fmt . Errorf ( "invalid decryption keys: %w" ,  err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cc  :=  encconfig . CombineCryptoConfigs ( [ ] encconfig . CryptoConfig { dcc } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										decryptConfig  =  cc . DecryptConfig 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  decryptConfig ,  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// EncryptConfig translates encryptionKeys into a EncriptionsConfig structure
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  EncryptConfig ( encryptionKeys  [ ] string ,  encryptLayers  [ ] int )  ( * encconfig . EncryptConfig ,  * [ ] int ,  error )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									var  encLayers  * [ ] int 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									var  encConfig  * encconfig . EncryptConfig 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  len ( encryptionKeys )  >  0  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// encryption
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										encLayers  =  & encryptLayers 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ecc ,  err  :=  enchelpers . CreateCryptoConfig ( encryptionKeys ,  [ ] string { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  nil ,  nil ,  fmt . Errorf ( "invalid encryption keys: %w" ,  err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cc  :=  encconfig . CombineCryptoConfigs ( [ ] encconfig . CryptoConfig { ecc } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										encConfig  =  cc . EncryptConfig 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  encConfig ,  encLayers ,  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// GetFormat translates format string into either docker or OCI format constant
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  GetFormat ( format  string )  ( string ,  error )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  format  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  define . OCI : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  define . OCIv1ImageManifest ,  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  define . DOCKER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  define . Dockerv2ImageManifest ,  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  "" ,  fmt . Errorf ( "unrecognized image type %q" ,  format ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}