Skip to content

Commit 63648ea

Browse files
Dockerfile export script. codefresh-report-image 1.0.6 (#541)
1 parent ebdf017 commit 63648ea

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

incubating/codefresh-report-image/step.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ kind: step-type
22
version: '1.0'
33
metadata:
44
name: codefresh-report-image
5-
version: 1.0.5
5+
version: 1.0.6
66
isPublic: true
77
description: Report Docker Image Metadata to Codefresh CD
88
sources:
@@ -185,10 +185,33 @@ spec:
185185
"type": "string",
186186
"description": "Image tag for step's image.",
187187
"default": "latest"
188+
},
189+
"DOCKERFILE_PATH": {
190+
"type": "string",
191+
"description": "Path to the Dockerfile used for building image"
192+
},
193+
"CF_DOCKERFILE_CONTENT": {
194+
"type": "string",
195+
"description": "Content of the Dockerfile used for building image base64 encoded"
188196
}
189197
}
190198
}
191199
stepsTemplate: |-
200+
[[- if and (not .Arguments.CF_DOCKERFILE_CONTENT) .Arguments.DOCKERFILE_PATH ]]
201+
export-dockerfile:
202+
name: export-dockerfile
203+
image: alpine
204+
commands:
205+
- |
206+
echo "Exporting Dockerfile: [[.Arguments.DOCKERFILE_PATH]]"
207+
if [ -f [[.Arguments.DOCKERFILE_PATH]] ]; then
208+
export CF_DOCKERFILE_CONTENT=$(base64 -w 0 [[.Arguments.DOCKERFILE_PATH]])
209+
cf_export CF_DOCKERFILE_CONTENT
210+
else
211+
cf_export CF_DOCKERFILE_CONTENT=""
212+
fi
213+
[[- end ]]
214+
192215
codefresh-report-image:
193216
name: codefresh-report-image
194217
image: '[[.Arguments.REGISTRY]]/[[.Arguments.IMAGE]]:[[.Arguments.IMAGE_TAG]]'
@@ -200,6 +223,9 @@ spec:
200223
[[ range $key, $val := .Arguments ]]
201224
- '[[ $key ]]=[[ $val ]]'
202225
[[- end ]]
226+
[[- if and (not .Arguments.CF_DOCKERFILE_CONTENT) .Arguments.DOCKERFILE_PATH]]
227+
- CF_DOCKERFILE_CONTENT=${{CF_DOCKERFILE_CONTENT}}
228+
[[- end ]]
203229
delimiters:
204230
left: '[['
205231
right: ']]'

0 commit comments

Comments
 (0)