-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
BuildPushActionV4.kt
308 lines (300 loc) · 11.9 KB
/
BuildPushActionV4.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
// changes will be overwritten with the next binding code regeneration.
// See https://github.com/typesafegithub/github-workflows-kt for more info.
@file:Suppress(
"DataClassPrivateConstructor",
"UNUSED_PARAMETER",
"DEPRECATION",
)
package io.github.typesafegithub.workflows.actions.docker
import io.github.typesafegithub.workflows.domain.actions.Action
import io.github.typesafegithub.workflows.domain.actions.RegularAction
import java.util.LinkedHashMap
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.toList
import kotlin.collections.toTypedArray
/**
* Action: Build and push Docker images
*
* Build and push Docker images with Buildx
*
* [Action on GitHub](https://github.com/docker/build-push-action)
*
* @param addHosts List of a customs host-to-IP mapping (e.g., docker:10.180.0.1)
* @param allow List of extra privileged entitlement (e.g., network.host,security.insecure)
* @param attests List of attestation parameters (e.g., type=sbom,generator=image)
* @param buildArgs List of build-time variables
* @param buildContexts List of additional build contexts (e.g., name=path)
* @param builder Builder instance
* @param cacheFrom List of external cache sources for buildx (e.g., user/app:cache,
* type=local,src=path/to/dir)
* @param cacheTo List of cache export destinations for buildx (e.g., user/app:cache,
* type=local,dest=path/to/dir)
* @param cgroupParent Optional parent cgroup for the container used in the build
* @param context Build's context is the set of files located in the specified PATH or URL
* @param file Path to the Dockerfile
* @param labels List of metadata for an image
* @param load Load is a shorthand for --output=type=docker
* @param network Set the networking mode for the RUN instructions during build
* @param noCache Do not use cache when building the image
* @param noCacheFilters Do not cache specified stages
* @param outputs List of output destinations (format: type=local,dest=path)
* @param platforms List of target platforms for build
* @param provenance Generate provenance attestation for the build (shorthand
* for --attest=type=provenance)
* @param pull Always attempt to pull all referenced images
* @param push Push is a shorthand for --output=type=registry
* @param sbom Generate SBOM attestation for the build (shorthand for --attest=type=sbom)
* @param secrets List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)
* @param secretFiles List of secret files to expose to the build (e.g., key=filename,
* MY_SECRET=./secret.txt)
* @param shmSize Size of /dev/shm (e.g., 2g)
* @param ssh List of SSH agent socket or keys to expose to the build
* @param tags List of tags
* @param target Sets the target stage to build
* @param ulimit Ulimit options (e.g., nofile=1024:1024)
* @param githubToken GitHub Token used to authenticate against a repository for Git context
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by
* the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor
* version, or a newer version that the binding doesn't yet know about
*/
@Deprecated(
message = "This action has a newer major version: BuildPushActionV5",
replaceWith = ReplaceWith("BuildPushActionV5"),
)
public data class BuildPushActionV4 private constructor(
/**
* List of a customs host-to-IP mapping (e.g., docker:10.180.0.1)
*/
public val addHosts: List<String>? = null,
/**
* List of extra privileged entitlement (e.g., network.host,security.insecure)
*/
public val allow: List<String>? = null,
/**
* List of attestation parameters (e.g., type=sbom,generator=image)
*/
public val attests: List<String>? = null,
/**
* List of build-time variables
*/
public val buildArgs: List<String>? = null,
/**
* List of additional build contexts (e.g., name=path)
*/
public val buildContexts: List<String>? = null,
/**
* Builder instance
*/
public val builder: String? = null,
/**
* List of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir)
*/
public val cacheFrom: List<String>? = null,
/**
* List of cache export destinations for buildx (e.g., user/app:cache,
* type=local,dest=path/to/dir)
*/
public val cacheTo: List<String>? = null,
/**
* Optional parent cgroup for the container used in the build
*/
public val cgroupParent: String? = null,
/**
* Build's context is the set of files located in the specified PATH or URL
*/
public val context: String? = null,
/**
* Path to the Dockerfile
*/
public val `file`: String? = null,
/**
* List of metadata for an image
*/
public val labels: List<String>? = null,
/**
* Load is a shorthand for --output=type=docker
*/
public val load: Boolean? = null,
/**
* Set the networking mode for the RUN instructions during build
*/
public val network: String? = null,
/**
* Do not use cache when building the image
*/
public val noCache: Boolean? = null,
/**
* Do not cache specified stages
*/
public val noCacheFilters: List<String>? = null,
/**
* List of output destinations (format: type=local,dest=path)
*/
public val outputs: List<String>? = null,
/**
* List of target platforms for build
*/
public val platforms: List<String>? = null,
/**
* Generate provenance attestation for the build (shorthand for --attest=type=provenance)
*/
public val provenance: Boolean? = null,
/**
* Always attempt to pull all referenced images
*/
public val pull: Boolean? = null,
/**
* Push is a shorthand for --output=type=registry
*/
public val push: Boolean? = null,
/**
* Generate SBOM attestation for the build (shorthand for --attest=type=sbom)
*/
public val sbom: Boolean? = null,
/**
* List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)
*/
public val secrets: List<String>? = null,
/**
* List of secret files to expose to the build (e.g., key=filename, MY_SECRET=./secret.txt)
*/
public val secretFiles: List<String>? = null,
/**
* Size of /dev/shm (e.g., 2g)
*/
public val shmSize: String? = null,
/**
* List of SSH agent socket or keys to expose to the build
*/
public val ssh: List<String>? = null,
/**
* List of tags
*/
public val tags: List<String>? = null,
/**
* Sets the target stage to build
*/
public val target: String? = null,
/**
* Ulimit options (e.g., nofile=1024:1024)
*/
public val ulimit: String? = null,
/**
* GitHub Token used to authenticate against a repository for Git context
*/
public val githubToken: String? = null,
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
public val _customInputs: Map<String, String> = mapOf(),
/**
* Allows overriding action's version, for example to use a specific minor version, or a newer
* version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
) : RegularAction<BuildPushActionV4.Outputs>("docker", "build-push-action", _customVersion ?: "v4")
{
public constructor(
vararg pleaseUseNamedArguments: Unit,
addHosts: List<String>? = null,
allow: List<String>? = null,
attests: List<String>? = null,
buildArgs: List<String>? = null,
buildContexts: List<String>? = null,
builder: String? = null,
cacheFrom: List<String>? = null,
cacheTo: List<String>? = null,
cgroupParent: String? = null,
context: String? = null,
`file`: String? = null,
labels: List<String>? = null,
load: Boolean? = null,
network: String? = null,
noCache: Boolean? = null,
noCacheFilters: List<String>? = null,
outputs: List<String>? = null,
platforms: List<String>? = null,
provenance: Boolean? = null,
pull: Boolean? = null,
push: Boolean? = null,
sbom: Boolean? = null,
secrets: List<String>? = null,
secretFiles: List<String>? = null,
shmSize: String? = null,
ssh: List<String>? = null,
tags: List<String>? = null,
target: String? = null,
ulimit: String? = null,
githubToken: String? = null,
_customInputs: Map<String, String> = mapOf(),
_customVersion: String? = null,
) : this(addHosts=addHosts, allow=allow, attests=attests, buildArgs=buildArgs,
buildContexts=buildContexts, builder=builder, cacheFrom=cacheFrom, cacheTo=cacheTo,
cgroupParent=cgroupParent, context=context, `file`=`file`, labels=labels, load=load,
network=network, noCache=noCache, noCacheFilters=noCacheFilters, outputs=outputs,
platforms=platforms, provenance=provenance, pull=pull, push=push, sbom=sbom,
secrets=secrets, secretFiles=secretFiles, shmSize=shmSize, ssh=ssh, tags=tags,
target=target, ulimit=ulimit, githubToken=githubToken, _customInputs=_customInputs,
_customVersion=_customVersion)
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
addHosts?.let { "add-hosts" to it.joinToString("\n") },
allow?.let { "allow" to it.joinToString("\n") },
attests?.let { "attests" to it.joinToString(",") },
buildArgs?.let { "build-args" to it.joinToString("\n") },
buildContexts?.let { "build-contexts" to it.joinToString("\n") },
builder?.let { "builder" to it },
cacheFrom?.let { "cache-from" to it.joinToString("\n") },
cacheTo?.let { "cache-to" to it.joinToString("\n") },
cgroupParent?.let { "cgroup-parent" to it },
context?.let { "context" to it },
`file`?.let { "file" to it },
labels?.let { "labels" to it.joinToString(",") },
load?.let { "load" to it.toString() },
network?.let { "network" to it },
noCache?.let { "no-cache" to it.toString() },
noCacheFilters?.let { "no-cache-filters" to it.joinToString(",") },
outputs?.let { "outputs" to it.joinToString(",") },
platforms?.let { "platforms" to it.joinToString(",") },
provenance?.let { "provenance" to it.toString() },
pull?.let { "pull" to it.toString() },
push?.let { "push" to it.toString() },
sbom?.let { "sbom" to it.toString() },
secrets?.let { "secrets" to it.joinToString("\n") },
secretFiles?.let { "secret-files" to it.joinToString("\n") },
shmSize?.let { "shm-size" to it },
ssh?.let { "ssh" to it.joinToString("\n") },
tags?.let { "tags" to it.joinToString("\n") },
target?.let { "target" to it },
ulimit?.let { "ulimit" to it },
githubToken?.let { "github-token" to it },
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
public class Outputs(
stepId: String,
) : Action.Outputs(stepId) {
/**
* Image ID
*/
public val imageid: String = "steps.$stepId.outputs.imageid"
/**
* Image digest
*/
public val digest: String = "steps.$stepId.outputs.digest"
/**
* Build result metadata
*/
public val metadata: String = "steps.$stepId.outputs.metadata"
}
}