Files
stage-infra/Tekton/tasks/build-and-push.yaml
2020-03-23 13:49:01 +01:00

49 lines
1.6 KiB
YAML

---
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: build-and-push
namespace: tekton-pipeline-1
spec:
params:
- name: context
description: The path to the build context, used by Kaniko - within the workspace
default: .
type: string
- name: image-name
description: dockerhub url
type: string
- name: version
description: image-version (for instance latest or beta)
type: string
workspaces:
- name: source
mountpath: /source
results:
- name: state
description: state of the next github update
- name: description
description: description of the next github update
steps:
- name: build-and-push
image: gcr.io/kaniko-project/executor:debug
env:
- name: "DOCKER_CONFIG"
value: "/tekton/home/.docker/"
command:
- '/busybox/sh'
- '-c'
args:
- |-
#!/bin/sh
echo "test"
/kaniko/executor --dockerfile=/source/$(params.context)/dockerfile --destination=beppev/$(params.image-name):$(params.version) --context=/source/$(params.context)/ --skip-tls-verify --skip-tls-verify-pull
if [ "$?" = 0 ]; then
printf "success" > /tekton/results/state
printf "build and push successful, going on to publish build" > /tekton/results/description
else
printf "failure" > /tekton/results/state
printf "build and push were not successful use kubectl or tkn or tekton dashboard to see logs" > /tekton/results/description
fi
exit 0