From 212be47ed8678fe27cffb5237f54b8ca21e4a118 Mon Sep 17 00:00:00 2001 From: BAK BYEONG JUN Date: Sun, 13 Apr 2025 05:36:16 +0000 Subject: [PATCH] init --- tasks/docker-registry/task.yaml | 8 +++---- tasks/secret-extract/task.yaml | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 tasks/secret-extract/task.yaml diff --git a/tasks/docker-registry/task.yaml b/tasks/docker-registry/task.yaml index a701476..c68900c 100644 --- a/tasks/docker-registry/task.yaml +++ b/tasks/docker-registry/task.yaml @@ -27,12 +27,12 @@ spec: type: string default: . - - name: pypiUsername + - name: pypi-username description: PyPI username type: string default: "" - - name: pypiPassword + - name: pypi-password description: PyPI password type: string default: "" @@ -97,6 +97,6 @@ spec: - --verbosity=info - --reproducible - --build-arg - - PYPI_USERNAME=$(params.pypiUsername) + - PYPI_USERNAME=$(params.pypi-username) - --build-arg - - PYPI_PASSWORD=$(params.pypiPassword) \ No newline at end of file + - PYPI_PASSWORD=$(params.pypi-password) \ No newline at end of file diff --git a/tasks/secret-extract/task.yaml b/tasks/secret-extract/task.yaml new file mode 100644 index 0000000..81d337b --- /dev/null +++ b/tasks/secret-extract/task.yaml @@ -0,0 +1,37 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: secret-extract +spec: + params: + - name: key + type: string + description: Name of the key to extract from the secret + + workspaces: + - name: secret + description: Workspace mounted with the Secret (each key becomes a file) + + results: + - name: value + description: Extracted secret value + + steps: + - name: extract + image: alpine:3.21.3 + workingDir: /workspace/secret + script: | + #!/bin/sh + set -e + + KEY=$(params.key) + FILE="/workspace/secret/$KEY" + + if [ ! -f "$FILE" ]; then + echo "❌ Key '$KEY' not found in secret workspace." + exit 1 + fi + + VALUE=$(cat "$FILE") + echo "🔑 Extracted key: $KEY" + echo -n "$VALUE" > /tekton/results/value