mirror of
https://github.com/bvanroll/stage-infra.git
synced 2025-08-29 03:52:49 +00:00
42 lines
1.3 KiB
YAML
42 lines
1.3 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
|
|
steps:
|
|
- name: build-and-push
|
|
image: gcr.io/kaniko-project/executor
|
|
env:
|
|
- name: "DOCKER_CONFIG"
|
|
value: "/tekton/home/.docker/"
|
|
script: |
|
|
#!/usr/bin/env bash
|
|
/kaniko/executor \
|
|
--dockerfile=/source/$(params.context)/dockerfile \
|
|
--destination=beppev/$(params.image-name):$(params.version) \
|
|
--context=/source/$(params.context)/ --skip-tls-verify
|
|
if [ "$?" = 0 ]; then
|
|
echo "pending" | tee /tekton/results/state
|
|
echo "build and push successful" | tee /tekton/results/description
|
|
else
|
|
echo "failure" | tee /tekton/results/state
|
|
echo "build and push were not successful use kubectl or tkn or tekton dashboard to see logs" | tee /tekton/results/description
|
|
fi
|
|
exit 0
|