Skip to content

Commit c8ae534

Browse files
committed
Properly set defaults and ensure that node.js hook taskfile builds are
still properly passing Signed-off-by: Jannik Hollenbach <jannik.hollenbach@iteratec.com>
1 parent 6fd6fe4 commit c8ae534

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎hooks/Taskfile.yaml‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ vars:
2020
hookUsesNpmDependencies:
2121
sh: 'if [ -f "{{ .TASKFILE_DIR }}/{{ .hookName }}/hook/package.json" ]; then echo "true"; else echo "false"; fi'
2222
hookSDK: '{{ .hookSDK | default "nodejs" }}'
23-
hookDockerContext: '{{ .hookDockerContext | default (printf "%s/%s/hook" .TASKFILE_DIR .hookName) }}'
24-
hookDockerfile: '{{ .hookDockerfile | default (printf "%s/%s/hook/Dockerfile" .TASKFILE_DIR .hookName) }}'
23+
hookDockerContext: '{{ .hookDockerContext | default "" }}'
24+
hookDockerfile: '{{ .hookDockerfile | default "" }}'
2525
env:
2626
IMG_TAG:
2727
sh: 'echo "sha-$(git rev-parse --short HEAD)"'
@@ -36,18 +36,19 @@ tasks:
3636
preconditions:
3737
- msg: "Docker is not running, please start Docker first"
3838
sh: "docker info >/dev/null 2>&1 || false"
39-
deps: [build:hook-sdk]
39+
deps:
40+
- task: '{{ if eq "nodejs" .hookSDK }}core:build-hook-sdk-image{{ else }}build:hook-sdk:noop{{ end }}'
4041
cmds:
4142
- |
4243
echo "Building custom hook image for {{ .hookName }} with tag ${IMG_TAG}"
43-
docker build -f {{ .hookDockerfile }} -t docker.io/securecodebox/hook-{{ .hookName }}:${IMG_TAG} \
44+
docker build {{ if ne "" .hookDockerfile }}-f {{ .hookDockerfile }} {{ end }}-t docker.io/securecodebox/hook-{{ .hookName }}:${IMG_TAG} \
4445
--build-arg=baseImageTag=${IMG_TAG} \
45-
{{ .hookDockerContext }}
46+
{{ if ne "" .hookDockerContext }}{{ .hookDockerContext }}{{ else }}{{ .TASKFILE_DIR }}/{{ .hookName }}/hook{{ end }}
4647
kind load docker-image --name testing-env docker.io/securecodebox/hook-{{ .hookName }}:${IMG_TAG}
47-
build:hook-sdk:
48+
build:hook-sdk:noop:
4849
internal: true
49-
cmds:
50-
- '{{ if eq "nodejs" .hookSDK }}task core:build-hook-sdk-image{{ else }}echo "Hook uses the {{ .hookSDK }} SDK. Skipping Node.js SDK build."{{ end }}'
50+
silent: true
51+
cmds: []
5152
predeploy:
5253
desc: Can be overwritten by the hook to perform any pre-deployment steps
5354
cmds: []

0 commit comments

Comments
 (0)