Skip to content

SSH Refactoring, breakout pipelines. Add generateName for pipeline ru… #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions tekton/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: p-git-collin-test
spec:
description: |
prints the README.md from the selected repo & branch
params:
- name: repo-url
type: string
description: The git repository URL to clone from.
- name: branch-name
type: string
description: The git branch to clone.
workspaces:
- name: shared-data
description: |
This workspace will receive the cloned git repo and be passed
to the next Task for the repo's README.md file to be read.
- name: ssh-creds
description: |
This workspace will provide ssh credentials to the git-clone task.
tasks:
- name: fetch-repo
taskRef:
name: git-clone
workspaces:
- name: output
workspace: shared-data
- name: ssh-directory
workspace: ssh-creds
params:
- name: url
value: $(params.repo-url)
- name: revision
value: $(params.branch-name)
# - name: cat-readme
# runAfter: ["fetch-repo"] # Wait until the clone is done before reading the readme.
# workspaces:
# - name: source
# workspace: shared-data
# taskSpec:
# workspaces:
# - name: source
# steps:
# - image: zshusers/zsh:4.3.15
# script: |
# #!/usr/bin/env zsh
# cat $(workspaces.source.path)/README.md
35 changes: 35 additions & 0 deletions tekton/run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: git-clone-checking-out-a-branch-
spec:
# podTemplate:
# affinity:
# podAntiAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchExpressions:
# - key: "tekton.dev/pipelineRun"
# operator: In
# values:
# - git-clone-checking-out-a-branch
# topologyKey: kubernetes.io/hostname
pipelineRef:
name: p-git-collin-test
workspaces:
- name: shared-data
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- name: ssh-creds
secret:
secretName: tkn-ssh-credentials
params:
- name: repo-url
value: git@github.com:gregnrobinson/envoytun.git
- name: branch-name
value: main
90 changes: 2 additions & 88 deletions tekton/pipeline-build-deploy.yaml → tekton/task.yaml
Original file line number Diff line number Diff line change
@@ -1,90 +1,4 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: cat-branch-readme
spec:
description: |
prints the README.md from the selected repo & branch
params:
- name: repo-url
type: string
description: The git repository URL to clone from.
- name: branch-name
type: string
description: The git branch to clone.
workspaces:
- name: shared-data
description: |
This workspace will receive the cloned git repo and be passed
to the next Task for the repo's README.md file to be read.
- name: ssh-creds
description: |
This workspace will provide ssh credentials to the git-clone task.
tasks:
- name: fetch-repo
taskRef:
name: git-clone
workspaces:
- name: output
workspace: shared-data
- name: ssh-directory
workspace: ssh-creds
params:
- name: url
value: $(params.repo-url)
- name: revision
value: $(params.branch-name)
- name: cat-readme
runAfter: ["fetch-repo"] # Wait until the clone is done before reading the readme.
workspaces:
- name: source
workspace: shared-data
taskSpec:
workspaces:
- name: source
steps:
- image: zshusers/zsh:4.3.15
script: |
#!/usr/bin/env zsh
cat $(workspaces.source.path)/README.md
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: git-clone-checking-out-a-branch
spec:
podTemplate:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "tekton.dev/pipelineRun"
operator: In
values:
- git-clone-checking-out-a-branch
topologyKey: kubernetes.io/hostname
pipelineRef:
name: cat-branch-readme
workspaces:
- name: shared-data
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- name: ssh-creds
secret:
secretName: github-cmf-microservices
params:
- name: repo-url
value: git@github.com:my-private/private-repository.git
- name: branch-name
value: oc-dev
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: git-clone
Expand Down Expand Up @@ -255,8 +169,8 @@ spec:
chmod -R 400 "${PARAM_USER_HOME}"/.ssh/*
# the stock git-clone V0.4 doesn't seem to leverage the ssh-privatekey unless it's added to a keychain.
# This has worked for me. It needs to be verified and once it has should be PRd upstream.
eval `ssh-agent -s`
ssh-add ${PARAM_USER_HOME}/.ssh/ssh-privatekey
#eval `ssh-agent -s`
#ssh-add ${PARAM_USER_HOME}/.ssh/ssh-privatekey
fi

CHECKOUT_DIR="${WORKSPACE_OUTPUT_PATH}/${PARAM_SUBDIRECTORY}"
Expand Down