5858 Labels []string // Label map
5959 Link string // Git repo link
6060 NoCache bool // Docker build no-cache
61+ Secret string // secret keypair
6162 AddHost []string // Docker build add-host
6263 Quiet bool // Docker build quiet
6364 }
@@ -72,27 +73,31 @@ type (
7273 CardPath string // Card path to write file to
7374 }
7475
75- Inspect []struct {
76- ID string `json:"Id"`
77- RepoTags []string `json:"RepoTags"`
78- RepoDigests []interface {} `json:"RepoDigests"`
79- Parent string `json:"Parent"`
80- Comment string `json:"Comment"`
81- Created time.Time `json:"Created"`
82- Container string `json:"Container"`
83- DockerVersion string `json:"DockerVersion"`
84- Author string `json:"Author"`
85- Architecture string `json:"Architecture"`
86- Os string `json:"Os"`
87- Size int `json:"Size"`
88- VirtualSize int `json:"VirtualSize"`
89- Metadata struct {
76+ Card []struct {
77+ ID string `json:"Id"`
78+ RepoTags []string `json:"RepoTags"`
79+ ParsedRepoTags []TagStruct `json:"ParsedRepoTags"`
80+ RepoDigests []interface {} `json:"RepoDigests"`
81+ Parent string `json:"Parent"`
82+ Comment string `json:"Comment"`
83+ Created time.Time `json:"Created"`
84+ Container string `json:"Container"`
85+ DockerVersion string `json:"DockerVersion"`
86+ Author string `json:"Author"`
87+ Architecture string `json:"Architecture"`
88+ Os string `json:"Os"`
89+ Size int `json:"Size"`
90+ VirtualSize int `json:"VirtualSize"`
91+ Metadata struct {
9092 LastTagTime time.Time `json:"LastTagTime"`
9193 } `json:"Metadata"`
9294 SizeString string
9395 VirtualSizeString string
9496 Time string
9597 }
98+ TagStruct struct {
99+ Tag string `json:"Tag"`
100+ }
96101)
97102
98103// Exec executes the plugin step
@@ -175,7 +180,7 @@ func (p Plugin) Exec() error {
175180 for _ , tag := range p .Build .Tags {
176181 cmds = append (cmds , commandTag (p .Build , tag )) // docker tag
177182
178- if p .Dryrun == false {
183+ if ! p .Dryrun {
179184 cmds = append (cmds , commandPush (p .Build , tag )) // docker push
180185 }
181186 }
@@ -297,6 +302,9 @@ func commandBuild(build Build) *exec.Cmd {
297302 for _ , host := range build .AddHost {
298303 args = append (args , "--add-host" , host )
299304 }
305+ if build .Secret != "" {
306+ args = append (args , "--secret" , build .Secret )
307+ }
300308 if build .Target != "" {
301309 args = append (args , "--target" , build .Target )
302310 }
@@ -328,6 +336,10 @@ func commandBuild(build Build) *exec.Cmd {
328336 }
329337 }
330338
339+ // we need to enable buildkit, for secret support
340+ if build .Secret != "" {
341+ os .Setenv ("DOCKER_BUILDKIT" , "1" )
342+ }
331343 return exec .Command (dockerExe , args ... )
332344}
333345
0 commit comments