-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
107 lines (104 loc) · 4.49 KB
/
action.yml
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
apiVersion: automation.cloudbees.io/v1alpha1
kind: action
name: 'Kaniko build and push'
description: 'Build and publish Docker images from a Dockerfile using Kaniko. Optionally, save the image as a tar file.'
inputs:
dockerfile:
description: 'Path to the Dockerfile'
default: Dockerfile
context:
description: 'Docker build context'
default: ${{ cloudbees.workspace }}
destination:
description: >
Target image(s) that will be published to the registries configured in the file ${HOME}/.docker/config.json
Type: CSV
required: true
tar-path:
description: 'Full path, including filename, where the image tar file should be saved.'
required: false
build-args:
description: >
Docker build arguments.
Type: CSV
labels:
description: >
Metadata to be associated with the resulting image.
Type: CSV
target:
description: >
Build a specific target stage in a multi-stage Dockerfile.
Type: string
registry-mirrors:
description: >
Registry mirror(s) to use for loading images.
Type: CSV
registry-configuration:
description: >
CloudBees registry configuration file containing the registries to use for loading images.
By default it uses the file containing the registries configured under 'Integrations' in the CloudBees platform.
default: ${{ cloudbees.registries }}
skip-default-registry-fallback:
default: 'false'
description: >
If set, fails build if registry-mirrors cannot pull image. If registry-mirrors is empty, this flag is ignored.
Type: Boolean
verbosity:
default: info
description: >
Log level verbosity - panic, fatal, error, warn, info, debug, trace
send-artifact-info:
default: 'false'
description: >
If set, artifact info is sent to Cloudbees Platform
Type: Boolean
outputs:
digest:
value: ${{ steps.imgbuild.outputs.digest }}
description: Image digest (image ID)
tag:
value: ${{ steps.imgbuild.outputs.tag }}
description: Tag of the first pushed image
tag-digest:
value: ${{ steps.imgbuild.outputs.tag-digest }}
description: |
Tag of the first specified destination along with the image digest.
Please note that this format is not part of the OCI standard but supported by most container tools.
Tools loading such an image reference ignore the tag but perform the lookup based on the image repository and digest only.
The tag only serves as a hint for humans.
Using this format guarantees that the image is continued to be used even when the tag was overwritten and prevents stale image caches on different nodes.
image:
value: ${{ steps.imgbuild.outputs.image }}
description: |
Image reference of the first specified destination, including the image digest.
Please note that this image reference format is not part of the OCI standard but supported by most container tools.
Tools loading such an image reference ignore the tag but perform the lookup based on the image repository and digest only.
The tag only serves as a hint for humans.
Using this image reference format guarantees that the image is continued to be used even when the tag was overwritten and prevents stale image caches on different nodes.
runs:
using: composite
steps:
- id: imgbuild
name: Build, publish, and optionally save Docker image as a tar archive.
uses: docker://public.ecr.aws/l7o7z1g8/actions/kaniko-action:${{ action.scm.sha }}
with:
entrypoint: kaniko-action
args: |
--dockerfile "${{ inputs.dockerfile }}"
--context "${{ inputs.context }}"
--destination "${{ inputs.destination }}"
--registry-mirrors "${{ inputs.registry-mirrors }}"
--skip-default-registry-fallback="${{ inputs.skip-default-registry-fallback }}"
--verbosity "${{ inputs.verbosity }}"
--target "${{ inputs.target }}"
--send-artifact-info="${{ inputs.send-artifact-info }}"
${{ inputs.tar-path && format('--tar-path "{0}"', inputs.tar-path) || '' }}
env:
DOCKER_CONFIG: ${{ cloudbees.home }}/.docker
DOCKER_BUILD_ARGS: ${{ inputs.build-args }}
DOCKER_LABELS: ${{ inputs.labels }}
CLOUDBEES_REGISTRY_CONFIG: ${{ inputs.registry-configuration }}
CLOUDBEES_API_URL: ${{ cloudbees.api.url }}
CLOUDBEES_API_TOKEN: ${{ cloudbees.api.token }}
CLOUDBEES_RUN_ID: ${{ cloudbees.run_id }}
CLOUDBEES_RUN_ATTEMPT: ${{ cloudbees.run_attempt }}