35 lines
755 B
YAML
35 lines
755 B
YAML
#task-build.yaml
|
|
apiVersion: tekton.dev/v1
|
|
kind: Task
|
|
metadata:
|
|
name: build-and-push
|
|
namespace: tekton-demo
|
|
spec:
|
|
params:
|
|
- name: IMAGE
|
|
type: string
|
|
description: "Target image"
|
|
- name: GIT_URL
|
|
type: string
|
|
- name: GIT_REVISION
|
|
type: string
|
|
default: "main"
|
|
steps:
|
|
- name: git-clone
|
|
image: alpine/git
|
|
script: |
|
|
#!/bin/sh
|
|
git clone $(params.GIT_URL) source
|
|
cd source
|
|
git checkout $(params.GIT_REVISION)
|
|
|
|
- name: build-image
|
|
image: gcr.io/kaniko-project/executor:latest
|
|
args:
|
|
- "--dockerfile=source/Dockerfile"
|
|
- "--context=source/"
|
|
- "--destination=$(params.IMAGE)"
|
|
- "--insecure"
|
|
- "--skip-tls-verify"
|
|
|