init
This commit is contained in:
parent
ca8f4b339e
commit
4e7d7023df
@ -13,7 +13,7 @@ spec:
|
|||||||
It accepts the folder name as a parameter. If the folder exists, it will be deleted.
|
It accepts the folder name as a parameter. If the folder exists, it will be deleted.
|
||||||
If the folder name is not provided or the folder does not exist, the task will exit gracefully.
|
If the folder name is not provided or the folder does not exist, the task will exit gracefully.
|
||||||
params:
|
params:
|
||||||
- name: workingFolder
|
- name: base
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
description: |
|
description: |
|
||||||
@ -27,17 +27,10 @@ spec:
|
|||||||
script: |
|
script: |
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
workingFolder="/workspace/shared/$(params.workingFolder)"
|
base="/workspace/shared/$(params.base)"
|
||||||
workingHomeFolder="/workspace/shared/__HOME__/$(params.workingFolder)"
|
if [ -d "${base}" ]; then
|
||||||
if [ -d "${workingFolder}" ]; then
|
rm -rf "${base}"
|
||||||
rm -rf "${workingFolder}"
|
echo "Deleted folder: ${base}"
|
||||||
echo "Deleted folder: ${workingFolder}"
|
|
||||||
else
|
else
|
||||||
echo "Folder not found: ${workingFolder}"
|
echo "Folder not found: ${base}"
|
||||||
fi
|
|
||||||
if [ -d "${workingHomeFolder}" ]; then
|
|
||||||
rm -rf "${workingHomeFolder}"
|
|
||||||
echo "Deleted folder: ${workingHomeFolder}"
|
|
||||||
else
|
|
||||||
echo "Folder not found: ${workingHomeFolder}"
|
|
||||||
fi
|
fi
|
||||||
|
@ -20,9 +20,15 @@ spec:
|
|||||||
A prefix for the working folder name.
|
A prefix for the working folder name.
|
||||||
The final folder name will include this prefix, a timestamp, and a random string.
|
The final folder name will include this prefix, a timestamp, and a random string.
|
||||||
results:
|
results:
|
||||||
- name: workingFolder
|
- name: base
|
||||||
description: |
|
description: |
|
||||||
The unique folder name created in the shared workspace.
|
The unique folder name created in the shared workspace.
|
||||||
|
- name: home
|
||||||
|
description: |
|
||||||
|
The unique home folder name created in the shared workspace.
|
||||||
|
- name: workshop
|
||||||
|
description: |
|
||||||
|
The unique working folder name created in the shared workspace.
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: shared
|
- name: shared
|
||||||
steps:
|
steps:
|
||||||
@ -30,8 +36,10 @@ spec:
|
|||||||
image: ubuntu
|
image: ubuntu
|
||||||
script: |
|
script: |
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
workingFolder="$(params.workingFolderPrefix)-$(date +%s)-$(head /dev/urandom | tr -dc a-z0-9 | head -c 6)"
|
uniqueFolder="$(params.workingFolderPrefix)-$(date +%s)-$(head /dev/urandom | tr -dc a-z0-9 | head -c 6)"
|
||||||
mkdir -p /workspace/shared/${workingFolder}
|
mkdir -p /workspace/shared/${uniqueFolder}/workshop
|
||||||
mkdir -p /workspace/shared/__HOME__/${workingFolder}
|
mkdir -p /workspace/shared/${uniqueFolder}/home
|
||||||
echo "Created folder: ${workingFolder}"
|
echo "Created folder: ${uniqueFolder}/{workshop | home}"
|
||||||
echo -n "${workingFolder}" > $(results.workingFolder.path)
|
echo -n "${uniqueFolder}" > $(results.base.path)
|
||||||
|
echo -n "${uniqueFolder}/workshop" > $(results.workshop.path)
|
||||||
|
echo -n "${uniqueFolder}/home" > $(results.home.path)
|
||||||
|
@ -4,10 +4,15 @@ metadata:
|
|||||||
name: docker-registry
|
name: docker-registry
|
||||||
spec:
|
spec:
|
||||||
params:
|
params:
|
||||||
- name: subdirectory
|
- name: home
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
description: Subdirectory within the repo where the source code is located
|
description: home directory
|
||||||
|
|
||||||
|
- name: workshop
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
description: workshop within the repo where the source code is located
|
||||||
|
|
||||||
- name: imageName
|
- name: imageName
|
||||||
type: string
|
type: string
|
||||||
@ -25,7 +30,7 @@ spec:
|
|||||||
- name: context
|
- name: context
|
||||||
type: string
|
type: string
|
||||||
default: .
|
default: .
|
||||||
description: Build context path (relative to subdirectory)
|
description: Build context path (relative to workshop)
|
||||||
|
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
@ -40,7 +45,11 @@ spec:
|
|||||||
steps:
|
steps:
|
||||||
- name: prepare-docker-auth
|
- name: prepare-docker-auth
|
||||||
image: alpine:3.21.3
|
image: alpine:3.21.3
|
||||||
workingDir: /workspace/source/$(params.subdirectory)
|
workingDir: /workspace/source/$(params.workshop)
|
||||||
|
env:
|
||||||
|
- name: HOME
|
||||||
|
value: /workspace/shared/$(params.home)
|
||||||
|
|
||||||
script: |
|
script: |
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
@ -55,10 +64,14 @@ spec:
|
|||||||
|
|
||||||
- name: kaniko-build
|
- name: kaniko-build
|
||||||
image: gcr.io/kaniko-project/executor:v1.23.2
|
image: gcr.io/kaniko-project/executor:v1.23.2
|
||||||
workingDir: $(workspaces.source.path)/$(params.subdirectory)
|
workingDir: $(workspaces.source.path)/$(params.workshop)
|
||||||
env:
|
env:
|
||||||
- name: DOCKER_CONFIG
|
- name: DOCKER_CONFIG
|
||||||
value: /tekton/home/.docker
|
value: /tekton/home/.docker
|
||||||
|
env:
|
||||||
|
- name: HOME
|
||||||
|
value: /workspace/shared/$(params.home)
|
||||||
|
|
||||||
command:
|
command:
|
||||||
- /kaniko/executor
|
- /kaniko/executor
|
||||||
args:
|
args:
|
||||||
@ -68,8 +81,3 @@ spec:
|
|||||||
- --skip-tls-verify
|
- --skip-tls-verify
|
||||||
- --verbosity=info
|
- --verbosity=info
|
||||||
- --reproducible
|
- --reproducible
|
||||||
{{- if $(params.kanikoArgs) }}
|
|
||||||
{{- range $arg := splitList " " "$(params.kanikoArgs)" }}
|
|
||||||
- {{ $arg }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
|
@ -45,10 +45,10 @@ 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: subdirectory
|
- name: workshop
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
description: Subdirectory inside the `output` Workspace to clone the repo into.
|
description: workshop inside the `output` Workspace to clone the repo into.
|
||||||
|
|
||||||
- name: sparseCheckoutDirectories
|
- name: sparseCheckoutDirectories
|
||||||
type: string
|
type: string
|
||||||
@ -158,7 +158,7 @@ spec:
|
|||||||
|
|
||||||
cd /workspace/output
|
cd /workspace/output
|
||||||
|
|
||||||
CLONE_DIR="$(params.subdirectory)"
|
CLONE_DIR="$(params.workshop)"
|
||||||
if [ -z "$CLONE_DIR" ]; then
|
if [ -z "$CLONE_DIR" ]; then
|
||||||
CLONE_DIR="."
|
CLONE_DIR="."
|
||||||
fi
|
fi
|
||||||
|
@ -4,9 +4,14 @@ metadata:
|
|||||||
name: nx-nodejs-analysis
|
name: nx-nodejs-analysis
|
||||||
spec:
|
spec:
|
||||||
params:
|
params:
|
||||||
- name: subdirectory
|
- name: home
|
||||||
type: string
|
type: string
|
||||||
description: Subdirectory within the repo where the source code is located
|
description: home directory
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
- name: workshop
|
||||||
|
type: string
|
||||||
|
description: workshop within the repo where the source code is located
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
- name: targetProject
|
- name: targetProject
|
||||||
@ -31,7 +36,10 @@ spec:
|
|||||||
steps:
|
steps:
|
||||||
- name: lint-and-test
|
- name: lint-and-test
|
||||||
image: $(params.nodejsImageName)
|
image: $(params.nodejsImageName)
|
||||||
workingDir: /workspace/source/$(params.subdirectory)
|
workingDir: /workspace/source/$(params.workshop)
|
||||||
|
env:
|
||||||
|
- name: HOME
|
||||||
|
value: /workspace/shared/$(params.home)
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
@ -4,10 +4,15 @@ metadata:
|
|||||||
name: nx-nodejs-version
|
name: nx-nodejs-version
|
||||||
spec:
|
spec:
|
||||||
params:
|
params:
|
||||||
- name: subdirectory
|
- name: home
|
||||||
type: string
|
type: string
|
||||||
description: Subdirectory within the repo where the source code is located
|
description: home directory
|
||||||
default: ""
|
default: ""
|
||||||
|
- name: workshop
|
||||||
|
type: string
|
||||||
|
description: workshop within the repo where the source code is located
|
||||||
|
default: ""
|
||||||
|
|
||||||
- name: ref
|
- name: ref
|
||||||
type: string
|
type: string
|
||||||
description: Full Git ref string (e.g., refs/tags/v0.2.0)
|
description: Full Git ref string (e.g., refs/tags/v0.2.0)
|
||||||
@ -24,15 +29,14 @@ spec:
|
|||||||
steps:
|
steps:
|
||||||
- name: verify-tag-version
|
- name: verify-tag-version
|
||||||
image: $(params.nodejsImageName)
|
image: $(params.nodejsImageName)
|
||||||
workingDir: /workspace/source
|
workingDir: /workspace/source/$(params.workshop)
|
||||||
|
env:
|
||||||
|
- name: HOME
|
||||||
|
value: /workspace/shared/$(params.home)
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -n "$(params.subdirectory)" ]; then
|
|
||||||
cd $(params.subdirectory)
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "🔍 Extracting tag from Git ref..."
|
echo "🔍 Extracting tag from Git ref..."
|
||||||
FULL_REF="$(params.ref)"
|
FULL_REF="$(params.ref)"
|
||||||
TAG_FROM_REF=$(basename "$FULL_REF") # → v0.2.0
|
TAG_FROM_REF=$(basename "$FULL_REF") # → v0.2.0
|
||||||
|
@ -4,10 +4,15 @@ metadata:
|
|||||||
name: pybuild
|
name: pybuild
|
||||||
spec:
|
spec:
|
||||||
params:
|
params:
|
||||||
- name: subdirectory
|
- name: home
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
description: Subdirectory within the repo where the source code is located
|
description: home directory
|
||||||
|
|
||||||
|
- name: workshop
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
description: workshop within the repo where the source code is located
|
||||||
|
|
||||||
- name: pythonImageName
|
- name: pythonImageName
|
||||||
type: string
|
type: string
|
||||||
@ -25,10 +30,10 @@ spec:
|
|||||||
steps:
|
steps:
|
||||||
- name: build-package
|
- name: build-package
|
||||||
image: $(params.pythonImageName)
|
image: $(params.pythonImageName)
|
||||||
workingDir: /workspace/source/$(params.subdirectory)
|
workingDir: /workspace/source/$(params.workshop)
|
||||||
env:
|
env:
|
||||||
- name: HOME
|
- name: HOME
|
||||||
value: /workspace/shared/__HOME__/$(params.subdirectory)
|
value: /workspace/shared/$(params.home)
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
@ -62,7 +67,7 @@ spec:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "📂 Checking built artifacts..."
|
echo "📂 Checking built artifacts..."
|
||||||
BUILD_PATH="/workspace/source/$(params.subdirectory)/dist"
|
BUILD_PATH="/workspace/source/$(params.workshop)/dist"
|
||||||
echo -n "$BUILD_PATH" > /tekton/results/build-artifact-path
|
echo -n "$BUILD_PATH" > /tekton/results/build-artifact-path
|
||||||
|
|
||||||
if [ -d "$BUILD_PATH" ] && [ -n "$(ls -A "$BUILD_PATH")" ]; then
|
if [ -d "$BUILD_PATH" ] && [ -n "$(ls -A "$BUILD_PATH")" ]; then
|
||||||
|
@ -4,9 +4,14 @@ metadata:
|
|||||||
name: pylint
|
name: pylint
|
||||||
spec:
|
spec:
|
||||||
params:
|
params:
|
||||||
- name: subdirectory
|
- name: home
|
||||||
type: string
|
type: string
|
||||||
description: Subdirectory within the repo where the source code is located
|
description: home directory
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
- name: workshop
|
||||||
|
type: string
|
||||||
|
description: workshop within the repo where the source code is located
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
- name: pythonImageName
|
- name: pythonImageName
|
||||||
@ -37,10 +42,10 @@ spec:
|
|||||||
steps:
|
steps:
|
||||||
- name: run-pylint
|
- name: run-pylint
|
||||||
image: $(params.pythonImageName)
|
image: $(params.pythonImageName)
|
||||||
workingDir: /workspace/source/$(params.subdirectory)
|
workingDir: /workspace/source/$(params.workshop)
|
||||||
env:
|
env:
|
||||||
- name: HOME
|
- name: HOME
|
||||||
value: /workspace/shared/__HOME__/$(params.subdirectory)
|
value: /workspace/shared/$(params.home)
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
@ -4,6 +4,10 @@ metadata:
|
|||||||
name: pypi
|
name: pypi
|
||||||
spec:
|
spec:
|
||||||
params:
|
params:
|
||||||
|
- name: home
|
||||||
|
type: string
|
||||||
|
description: home directory
|
||||||
|
|
||||||
- name: build-artifact-path
|
- name: build-artifact-path
|
||||||
type: string
|
type: string
|
||||||
description: Path to the built artifact directory from python-build
|
description: Path to the built artifact directory from python-build
|
||||||
@ -28,7 +32,7 @@ spec:
|
|||||||
workingDir: /workspace/source
|
workingDir: /workspace/source
|
||||||
env:
|
env:
|
||||||
- name: HOME
|
- name: HOME
|
||||||
value: /workspace/shared/__HOME__/$(params.subdirectory)
|
value: /workspace/shared/$(params.home)
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
@ -4,9 +4,14 @@ metadata:
|
|||||||
name: pytest
|
name: pytest
|
||||||
spec:
|
spec:
|
||||||
params:
|
params:
|
||||||
- name: subdirectory
|
- name: home
|
||||||
type: string
|
type: string
|
||||||
description: Subdirectory within the workspace where the tests are located
|
description: home directory
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
- name: workshop
|
||||||
|
type: string
|
||||||
|
description: workshop within the workspace where the tests are located
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
- name: pythonImageName
|
- name: pythonImageName
|
||||||
@ -21,10 +26,10 @@ spec:
|
|||||||
steps:
|
steps:
|
||||||
- name: install-dependencies
|
- name: install-dependencies
|
||||||
image: $(params.pythonImageName)
|
image: $(params.pythonImageName)
|
||||||
workingDir: /workspace/source/$(params.subdirectory)
|
workingDir: /workspace/source/$(params.workshop)
|
||||||
env:
|
env:
|
||||||
- name: HOME
|
- name: HOME
|
||||||
value: /workspace/shared/__HOME__/$(params.subdirectory)
|
value: /workspace/shared/$(params.home)
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
@ -4,9 +4,9 @@ metadata:
|
|||||||
name: secret-home
|
name: secret-home
|
||||||
spec:
|
spec:
|
||||||
params:
|
params:
|
||||||
- name: subdirectory
|
- name: home
|
||||||
type: string
|
type: string
|
||||||
description: Subdirectory within the repo where the source code is located
|
description: home directory
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
- name: keys
|
- name: keys
|
||||||
@ -26,7 +26,7 @@ spec:
|
|||||||
workingDir: /workspace/shared/$(params.subdirectory)
|
workingDir: /workspace/shared/$(params.subdirectory)
|
||||||
env:
|
env:
|
||||||
- name: HOME
|
- name: HOME
|
||||||
value: /workspace/shared/__HOME__/$(params.subdirectory)
|
value: /workspace/shared/$(params.home)
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user