init
This commit is contained in:
parent
d91d03111f
commit
62c8f80ed0
@ -35,15 +35,15 @@ spec:
|
|||||||
workspaces:
|
workspaces:
|
||||||
- name: shared
|
- name: shared
|
||||||
description: Source code workspace
|
description: Source code workspace
|
||||||
- name: docker-dot-credentials
|
# - name: docker-dot-credentials
|
||||||
description: Workspace containing config.json (as Secret)
|
# description: Workspace containing config.json (as Secret)
|
||||||
|
|
||||||
results:
|
results:
|
||||||
- name: imageUrl
|
- name: imageUrl
|
||||||
description: Final pushed image URL with tag (e.g. registry/app:v0.2.0)
|
description: Final pushed image URL with tag (e.g. registry/app:v0.2.0)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: prepare-docker-auth
|
- name: prepare-docker
|
||||||
image: alpine:3.21.3
|
image: alpine:3.21.3
|
||||||
workingDir: /workspace/shared/$(params.workshop)
|
workingDir: /workspace/shared/$(params.workshop)
|
||||||
env:
|
env:
|
||||||
@ -54,9 +54,9 @@ spec:
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "🔐 Copying docker .dockerconfigjson to /tekton/home/.docker"
|
# echo "🔐 Copying docker .dockerconfigjson to /tekton/home/.docker"
|
||||||
mkdir -p /tekton/home/.docker
|
# mkdir -p /tekton/home/.docker
|
||||||
cp /workspace/docker-dot-credentials/.dockerconfigjson /tekton/home/.docker/config.json
|
# cp /workspace/docker-dot-credentials/.dockerconfigjson /tekton/home/.docker/config.json
|
||||||
|
|
||||||
IMAGE="$(params.imageName):$(params.tag)"
|
IMAGE="$(params.imageName):$(params.tag)"
|
||||||
echo "📦 Using image: $IMAGE"
|
echo "📦 Using image: $IMAGE"
|
||||||
@ -66,11 +66,10 @@ spec:
|
|||||||
image: gcr.io/kaniko-project/executor:v1.23.2
|
image: gcr.io/kaniko-project/executor:v1.23.2
|
||||||
workingDir: $(workspaces.shared.path)/$(params.workshop)
|
workingDir: $(workspaces.shared.path)/$(params.workshop)
|
||||||
env:
|
env:
|
||||||
- name: DOCKER_CONFIG
|
|
||||||
value: /tekton/home/.docker
|
|
||||||
- name: HOME
|
- name: HOME
|
||||||
value: /workspace/shared/$(params.home)
|
value: /workspace/shared/$(params.home)
|
||||||
|
- name: DOCKER_CONFIG
|
||||||
|
value: $HOME/.dockerconfigjson
|
||||||
command:
|
command:
|
||||||
- /kaniko/executor
|
- /kaniko/executor
|
||||||
args:
|
args:
|
||||||
|
@ -45,6 +45,11 @@ spec:
|
|||||||
default: "ca-bundle.crt"
|
default: "ca-bundle.crt"
|
||||||
description: file name of mounted crt using ssl-ca-directory workspace.
|
description: file name of mounted crt using ssl-ca-directory workspace.
|
||||||
|
|
||||||
|
- name: home
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
description: home directory
|
||||||
|
|
||||||
- name: workshop
|
- name: workshop
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
@ -85,30 +90,30 @@ spec:
|
|||||||
default: "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.40.2"
|
default: "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.40.2"
|
||||||
description: The image providing the git-init binary that this Task runs.
|
description: The image providing the git-init binary that this Task runs.
|
||||||
|
|
||||||
- name: userHome
|
# - name: userHome
|
||||||
type: string
|
# type: string
|
||||||
default: "/home/git"
|
# default: "/home/git"
|
||||||
description: Absolute path to the user's home directory.
|
# description: Absolute path to the user's home directory.
|
||||||
|
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: shared
|
- name: shared
|
||||||
description: The workspace where the repository will be cloned.
|
description: The workspace where the repository will be cloned.
|
||||||
|
|
||||||
- name: ssh-directory
|
# - name: ssh-directory
|
||||||
optional: true
|
# optional: true
|
||||||
description: |
|
# description: |
|
||||||
A .ssh directory with private key, known_hosts, config, etc.
|
# A .ssh directory with private key, known_hosts, config, etc.
|
||||||
Copied to the user's home before git commands are executed.
|
# Copied to the user's home before git commands are executed.
|
||||||
|
|
||||||
- name: basic-auth
|
# - name: basic-auth
|
||||||
optional: true
|
# optional: true
|
||||||
description: |
|
# description: |
|
||||||
A Workspace containing a .gitconfig and .git-credentials file.
|
# A Workspace containing a .gitconfig and .git-credentials file.
|
||||||
|
|
||||||
- name: ssl-ca-directory
|
# - name: ssl-ca-directory
|
||||||
optional: true
|
# optional: true
|
||||||
description: |
|
# description: |
|
||||||
A workspace containing CA certificates, used by Git for SSL verification.
|
# A workspace containing CA certificates, used by Git for SSL verification.
|
||||||
|
|
||||||
|
|
||||||
results:
|
results:
|
||||||
@ -123,8 +128,10 @@ spec:
|
|||||||
- name: clone
|
- name: clone
|
||||||
image: $(params.gitInitImage)
|
image: $(params.gitInitImage)
|
||||||
env:
|
env:
|
||||||
|
# - name: HOME
|
||||||
|
# value: $(params.userHome)
|
||||||
- name: HOME
|
- name: HOME
|
||||||
value: $(params.userHome)
|
value: /workspace/shared/$(params.home)
|
||||||
- name: SSL_CERT_FILE
|
- name: SSL_CERT_FILE
|
||||||
value: "/workspace/ssl-ca-directory/$(params.crtFileName)"
|
value: "/workspace/ssl-ca-directory/$(params.crtFileName)"
|
||||||
- name: HTTP_PROXY
|
- name: HTTP_PROXY
|
||||||
@ -137,19 +144,19 @@ spec:
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
echo "[INFO] Preparing home and auth setup..."
|
# echo "[INFO] Preparing home and auth setup..."
|
||||||
mkdir -p $(params.userHome)/.ssh
|
# mkdir -p $(params.userHome)/.ssh
|
||||||
|
|
||||||
if [ -d "/workspace/ssh-directory" ]; then
|
# if [ -d "/workspace/ssh-directory" ]; then
|
||||||
cp -R /workspace/ssh-directory/* $(params.userHome)/.ssh/
|
# cp -R /workspace/ssh-directory/* $(params.userHome)/.ssh/
|
||||||
chmod 700 $(params.userHome)/.ssh
|
# chmod 700 $(params.userHome)/.ssh
|
||||||
chmod 600 $(params.userHome)/.ssh/*
|
# chmod 600 $(params.userHome)/.ssh/*
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
if [ -d "/workspace/basic-auth" ]; then
|
# if [ -d "/workspace/basic-auth" ]; then
|
||||||
cp /workspace/basic-auth/.gitconfig $(params.userHome)/.gitconfig || true
|
# cp /workspace/basic-auth/.gitconfig $(params.userHome)/.gitconfig || true
|
||||||
cp /workspace/basic-auth/.git-credentials $(params.userHome)/.git-credentials || true
|
# cp /workspace/basic-auth/.git-credentials $(params.userHome)/.git-credentials || true
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
if [ "$(params.sslVerify)" = "false" ]; then
|
if [ "$(params.sslVerify)" = "false" ]; then
|
||||||
echo "[INFO] Disabling SSL verification"
|
echo "[INFO] Disabling SSL verification"
|
||||||
|
@ -36,40 +36,48 @@ spec:
|
|||||||
default: "chore(gitops): update image tag"
|
default: "chore(gitops): update image tag"
|
||||||
description: Commit message
|
description: Commit message
|
||||||
|
|
||||||
|
- name: home
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
description: home directory
|
||||||
|
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: ssh-directory
|
# - name: ssh-directory
|
||||||
optional: true
|
# optional: true
|
||||||
description: SSH credentials (private key, known_hosts)
|
# description: SSH credentials (private key, known_hosts)
|
||||||
|
|
||||||
- name: basic-auth
|
# - name: basic-auth
|
||||||
optional: true
|
# optional: true
|
||||||
description: .gitconfig and .git-credentials
|
# description: .gitconfig and .git-credentials
|
||||||
|
|
||||||
- name: ssl-ca-directory
|
# - name: ssl-ca-directory
|
||||||
optional: true
|
# optional: true
|
||||||
description: Custom CA certificates (optional)
|
# description: Custom CA certificates (optional)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: update-and-push
|
- name: update-and-push
|
||||||
image: alpine:3.19
|
image: alpine:3.19
|
||||||
workingDir: /workspace
|
workingDir: /workspace
|
||||||
|
env:
|
||||||
|
- name: HOME
|
||||||
|
value: /workspace/shared/$(params.home)
|
||||||
script: |
|
script: |
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "🔐 Preparing Git authentication..."
|
# echo "🔐 Preparing Git authentication..."
|
||||||
mkdir -p /root/.ssh
|
# mkdir -p /root/.ssh
|
||||||
if [ -d /workspace/ssh-directory ]; then
|
# if [ -d /workspace/ssh-directory ]; then
|
||||||
cp -R /workspace/ssh-directory/* /root/.ssh/
|
# cp -R /workspace/ssh-directory/* /root/.ssh/
|
||||||
chmod 700 /root/.ssh
|
# chmod 700 /root/.ssh
|
||||||
fi
|
# fi
|
||||||
if [ -d /workspace/basic-auth ]; then
|
# if [ -d /workspace/basic-auth ]; then
|
||||||
cp /workspace/basic-auth/.gitconfig /root/.gitconfig || true
|
# cp /workspace/basic-auth/.gitconfig /root/.gitconfig || true
|
||||||
cp /workspace/basic-auth/.git-credentials /root/.git-credentials || true
|
# cp /workspace/basic-auth/.git-credentials /root/.git-credentials || true
|
||||||
fi
|
# fi
|
||||||
if [ -d /workspace/ssl-ca-directory ]; then
|
# if [ -d /workspace/ssl-ca-directory ]; then
|
||||||
export GIT_SSL_CAINFO="/workspace/ssl-ca-directory/ca.crt"
|
# export GIT_SSL_CAINFO="/workspace/ssl-ca-directory/ca.crt"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
echo "📦 Installing Git + yq..."
|
echo "📦 Installing Git + yq..."
|
||||||
apk add --no-cache git yq openssh
|
apk add --no-cache git yq openssh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user