This commit is contained in:
2024-04-24 13:06:19 +02:00
parent 31b6e4a3ef
commit baf721c4e8
7 changed files with 0 additions and 410 deletions

View File

@@ -1,51 +0,0 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: ansible-builder
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/deprecated: "true"
tekton.dev/pipelines.minVersion: "0.12.0"
tekton.dev/displayName: ansible-builder
tekton.dev/categories: Build Tools
tekton.dev/tags: ansible, ansible-builder, build-tool, automation
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
Creates a build context (including a Containerfile) from an execution environment spec.
This build context is populated with dependencies including requirements files.
workspaces:
- name: source
description: The source workspace where the execution environment code is cloned.
params:
- description: Execution environment file definition.
name: FILENAME
type: string
default: execution-environment.yml
- description: Execution environment build context.
name: BUILD_CONTEXT
type: string
default: context
- name: OUTPUT_FILENAME
description: Name of file to write image definition to. Either Dockerfile or Containerfile.
type: string
default: Containerfile
- description: ansible-builder output verbosity.
name: VERBOSITY
type: string
default: "2"
- name: BUILDER_IMAGE
description: The location of the ansible-builder image.
type: string
default: quay.io/ansible/ansible-builder:latest
steps:
- name: ansible-builder-create
workingDir: $(workspaces.source.path)
image: $(params.BUILDER_IMAGE)
script: |
#!/bin/sh
set -eux -o
ansible-builder create -f "$(params.FILENAME)" -c "$(params.BUILD_CONTEXT)" --output-filename "$(params.OUTPUT_FILENAME)" -v "$(params.VERBOSITY)"

View File

@@ -1,72 +0,0 @@
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: ansible-runner
labels:
app.kubernetes.io/version: '0.2'
app.kubernetes.io/ansible-version: '2.12.5'
annotations:
tekton.dev/deprecated: "true"
tekton.dev/pipelines.minVersion: '0.12.1'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
Task to run Ansible playbooks using Ansible Runner
workspaces:
- name: runner-dir
description: The Ansibler runner directory
params:
- name: project-dir
description: The project directory under the workspace runner-dir
default: 'project'
- name: args
description: The arguments to pass ansible-runner
type: array
default:
- --help
- name: user-home
description: Absolute path to the user's home directory.
default: /tekton/home
- name: image
description: Ansible runner image.
default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
steps:
- name: requirements
image: $(params.image)
script: |
#!/bin/bash
set -e
if [ -f requirements.txt ];
then
pip3 install --user \
-r requirements.txt
fi
if [ -f requirements.yml ];
then
ansible-galaxy role install -vv \
-r requirements.yml
ansible-galaxy collection install -vv \
-r requirements.yml
fi
workingDir: '$(workspaces.runner-dir.path)/$(params.project-dir)'
- name: run-playbook
image: $(params.image)
command: ['entrypoint']
args:
- ansible-runner
- run
- $(params.args)
- $(params.project-dir)
workingDir: '$(workspaces.runner-dir.path)'

View File

@@ -1,32 +0,0 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: curl
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/categories: CLI
tekton.dev/tags: search
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
spec:
description: >-
This task performs curl operation to transfer data from internet.
params:
- name: url
description: URL to curl'ed
type: string
- name: options
description: options of url
type: array
default: []
- name: curl-image
description: option of curl image
type: string
default: "docker.io/curlimages/curl:7.72.0@sha256:bd5bbd35f89b867c1dccbc84b8be52f3f74dea20b46c5fe0db3780e040afcb6f" #tag: 7.72.0
steps:
- name: curl
image: "$(params.curl-image)"
command: [curl]
args: ["$(params.options[*])", "$(params.url)"]

View File

@@ -1,62 +0,0 @@
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: prometheus-gate
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/categories: Monitoring
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: gate, prometheus
tekton.dev/displayName: prometheus gate
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
A gate task which will query the prometheus API in a loop and await a matching status for N length of time.
params:
- name: prometheus_endpoint
type: string
description: Prometheus API endpoint
- name: range_query
type: string
description: range query to use to define SLO
- name: range_time
type: string
description: time we want to assert fits the SLO
default: "-10m"
- name: target_value
type: string
description: value we will use as threshold
default: "1"
- name: target_strategy
type: string
description: The target_strategy is min,max or equal
default: "min"
- name: timeout
type: string
description: timeout of the gate
default: "3600"
- name: tick_time
type: string
description: how often to draw data from prometheus
default: "1m"
steps:
- name: gate
image: docker.io/iancoffey/prometheus-gate-cf7c3e662ede0a4e9bc24d37d2af86d6@sha256:c3df9d8400aef7acb76f409d1e347c5ecaa6f28a69df50981c14bfe87add85d7
env:
- name: "PROMETHEUS_ENDPOINT"
value: $(params.prometheus_endpoint)
- name: "RANGE_QUERY"
value: $(params.range_query)
- name: "RANGE_TIME"
value: $(params.range_time)
- name: "TARGET_VALUE"
value: $(params.target_value)
- name: "TARGET_STRATEGY"
value: $(params.target_strategy)
- name: "TIMEOUT"
value: $(params.timeout)
- name: "TICK_TIME"
value: $(params.tick_time)

View File

@@ -1,79 +0,0 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: skopeo-copy
labels:
app.kubernetes.io/version: "0.3"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: "skopeo copy"
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
spec:
description: >-
Skopeo is a command line tool for working with remote image registries.
Skopeo doesnt require a daemon to be running while performing its operations.
In particular, the handy skopeo command called copy will ease the whole image
copy operation. The copy command will take care of copying the image from
internal.registry to production.registry. If your production registry requires
credentials to login in order to push the image, skopeo can handle that as well.
workspaces:
- name: images-url
params:
- name: srcImageURL
description: URL of the image to be copied to the destination registry
type: string
default: ""
- name: destImageURL
description: URL of the image where the image from source should be copied to
type: string
default: ""
- name: srcTLSverify
description: Verify the TLS on the src registry endpoint
type: string
default: "true"
- name: destTLSverify
description: Verify the TLS on the dest registry endpoint
type: string
default: "true"
steps:
- name: skopeo-copy
env:
- name: HOME
value: /tekton/home
image: quay.io/skopeo/stable:v1
script: |
# Function to copy multiple images.
#
copyimages() {
filename="$(workspaces.images-url.path)/url.txt"
while IFS= read -r line || [ -n "$line" ]
do
cmd=""
for url in $line
do
# echo $url
cmd="$cmd \
$url"
done
read -ra sourceDest <<<"${cmd}"
skopeo copy "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
echo "$cmd"
done < "$filename"
}
#
# If single image is to be copied then, it can be passed through
# params in the taskrun.
if [ "$(params.srcImageURL)" != "" ] && [ "$(params.destImageURL)" != "" ] ; then
skopeo copy "$(params.srcImageURL)" "$(params.destImageURL)" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
else
# If file is provided as a configmap in the workspace then multiple images can be copied.
#
copyimages
fi
securityContext:
runAsNonRoot: true
runAsUser: 65532

View File

@@ -1,57 +0,0 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: write-file
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/categories: Developer Tools
tekton.dev/tags: generic
tekton.dev/displayName: Write a file
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le"
spec:
description: >-
Write a file to a workspace
This task can be used to write a file onto the output workspace.
Use parameter expansion to insert variable content into the written
file. It can also set specific permissions on the file.
params:
- name: path
type: string
description: >
Relative path to create within the workspace. Directories will
be created as necessary.
- name: contents
type: string
description: >
Contents of the file to create.
- name: mode
type: string
default: "0755"
description: >
chmod-style permission string to apply to the file. Note that
octal numbers need quoting in YAML. Mode will not be applied
to created directories.
workspaces:
- name: output
description: Workspace onto which the file is written.
steps:
- name: write-file
image: docker.io/library/alpine:3.12@sha256:36553b10a4947067b9fbb7d532951066293a68eae893beba1d9235f7d11a20ad
workingDir: $(workspaces.output.path)
env:
- name: PARAM_PATH
value: $(params.path)
- name: PARAM_MODE
value: $(params.mode)
- name: PARAM_CONTENTS
value: $(params.contents)
script: |
#!/bin/sh
set -eu
DIRNAME=$(dirname "${PARAM_PATH}")
mkdir -p "$DIRNAME"
printf '%s' "${PARAM_CONTENTS}" > "./${PARAM_PATH}"
chmod "${PARAM_MODE}" "./${PARAM_PATH}"

View File

@@ -1,57 +0,0 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: yq
labels:
app.kubernetes.io/version: "0.4"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/categories: Developer Tools
tekton.dev/tags: yq
tekton.dev/displayName: "YQ"
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
This task can be used to replace fields in YAML files. For example for altering helm charts on GitOps repos.
workspaces:
- name: source
description: A workspace that contains the file which needs to be altered.
params:
- name: SCRIPT
type: string
description: The yq script to execute. Can be multiple lines for complex tasks.
default: ""
- name: image
type: string
description: The yq image to use.
default: docker.io/mikefarah/yq:4.27.5@sha256:2be3626ed633fbe1fc33ee9343a1256a6be53334412b2251b9a859f8c145bb53
- name: files
type: array
description: (deprecated, use SCRIPT instead) A list of files to execute the expression on. Needs to be relative to the source workspace.
default: []
- name: expression
type: string
description: (deprecated, use SCRIPT instead) The yq expression to apply. Can be used to replace yaml fields.
default: ""
results:
- name: yq
description: The result from your yq command. You can write to it using `$(results.yq.path)`
steps:
- name: yq-script
image: $(params.image)
workingDir: $(workspaces.source.path)
args: ["$(params.files[*])"]
script: |
/usr/bin/env sh
set -e
# For backwards compatibility with previous versions
if [ "$(params.SCRIPT)" = "" ]; then
for var in "$@"
do
/usr/bin/yq eval -i "$(params.expression)" "$var"
done
exit $?
fi
$(params.SCRIPT)