k8s-config/pipelines/git-pipeline.yaml

54 lines
1.2 KiB
YAML

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: cat-git-repo
spec:
description: A test pipeline.
params:
- name: repo-url
type: string
description: The git repository URL to clone from.
workspaces:
- name: shared-data
description: Shared data.
- name: git-credentials
description: My ssh credentials
tasks:
- name: fetch-repo
workspaces:
- name: output
workspace: shared-data
- name: ssh-directory
workspace: git-credentials
params:
- name: url
value: $(params.repo-url)
taskSpec:
workspaces:
- name: output
- name: ssh-directory
params:
- name: url
steps:
- image: 192.168.1.128:8443/gitssh:latest
script: |
set -x
cp -r $(workspaces.ssh-directory.path) ~/.ssh
chmod 700 ~/.ssh
chmod -R 400 ~/.ssh/*
git clone $(params.url) $(workspaces.output.path)
- name: cat-readme
runAfter: ["fetch-repo"]
workspaces:
- name: source
workspace: shared-data
taskSpec:
workspaces:
- name: source
steps:
- image: docker.io/debian:latest
script: |
set -x
cat $(workspaces.source.path)/README