mirror of
https://github.com/khuedoan/homelab.git
synced 2024-12-22 21:24:52 +07:00
refactor(tekton): use remote tasks from Tekton Hub
This commit is contained in:
parent
330393080a
commit
8df13c3ef4
@ -8,7 +8,14 @@ spec:
|
||||
tasks:
|
||||
- name: git-clone
|
||||
taskRef:
|
||||
name: git-clone
|
||||
resolver: hub
|
||||
params:
|
||||
- name: kind
|
||||
value: task
|
||||
- name: name
|
||||
value: git-clone
|
||||
- name: version
|
||||
value: "0.7"
|
||||
workspaces:
|
||||
- name: output
|
||||
workspace: shared-data
|
||||
|
@ -15,4 +15,3 @@ resources:
|
||||
# Service account
|
||||
- serviceaccount.yaml
|
||||
- clusterrolebinding.yaml
|
||||
- tasks/
|
||||
|
@ -1,47 +0,0 @@
|
||||
# https://github.com/tektoncd/plumbing/blob/main/tekton/ci/shared/common-tasks.yaml
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: check-git-files-changed
|
||||
annotations:
|
||||
description: |
|
||||
Returns "passed" in the "check" result if any of the files changed
|
||||
in the source on the workspace matches the regular expression.
|
||||
Returns a "files" result as a list of files modified by the PR that
|
||||
match the regex in the parameters.
|
||||
ci.tekton.dev/condition: |
|
||||
The result of this task is used to evaluate a condition.
|
||||
Events from this task are ignored downstream, when it comes to update the CI job status.
|
||||
spec:
|
||||
params:
|
||||
- name: gitCloneDepth
|
||||
description: Number of commits + 1
|
||||
- name: regex
|
||||
description: Regular expression to match files changed
|
||||
workspaces:
|
||||
- name: input
|
||||
results:
|
||||
- name: check
|
||||
description: passed or failed
|
||||
- name: files
|
||||
description: list of files modified that match
|
||||
steps:
|
||||
- name: check-files-changed
|
||||
image: alpine/git
|
||||
env:
|
||||
- name: GIT_CLONE_DEPTH
|
||||
value: $(params.gitCloneDepth)
|
||||
- name: REGEX
|
||||
value: $(params.regex)
|
||||
script: |
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
set -o pipefail
|
||||
BACK="HEAD~$(( ${GIT_CLONE_DEPTH} - 1 ))"
|
||||
CHECK="failed"
|
||||
cd $(workspaces.input.path)
|
||||
git diff-tree --no-commit-id --name-only -r HEAD $BACK | \
|
||||
grep -E "${REGEX}" > $(results.files.path) || true
|
||||
git diff-tree --no-commit-id --name-only -r HEAD $BACK | \
|
||||
grep -E "${REGEX}" && CHECK="passed"
|
||||
printf $CHECK > $(results.check.path)
|
@ -1,10 +0,0 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-clone/0.7/git-clone.yaml
|
||||
- https://raw.githubusercontent.com/tektoncd/catalog/main/task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
- https://raw.githubusercontent.com/tektoncd/catalog/main/task/gitleaks/0.1/gitleaks.yaml
|
||||
- https://raw.githubusercontent.com/tektoncd/catalog/main/task/kaniko/0.5/kaniko.yaml
|
||||
- https://raw.githubusercontent.com/tektoncd/catalog/main/task/pull-request/0.1/pull-request.yaml
|
||||
- check-git-files-changed.yaml
|
Loading…
Reference in New Issue
Block a user