This commit is contained in:
병준 박 2025-04-15 12:56:01 +00:00
parent 4e7d7023df
commit b927a34a11
3 changed files with 21 additions and 15 deletions

View File

@ -4,9 +4,14 @@ metadata:
name: pyversion name: pyversion
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: ref - name: ref
@ -29,15 +34,11 @@ spec:
steps: steps:
- name: verify-tag - name: verify-tag
image: $(params.pythonImageName) image: $(params.pythonImageName)
workingDir: /workspace/source workingDir: /workspace/source/$(params.workshop)
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

View File

@ -9,6 +9,11 @@ spec:
description: home directory description: home directory
default: "" default: ""
- name: workshop
type: string
description: workshop directory
default: ""
- name: keys - name: keys
type: string type: string
description: | description: |
@ -23,7 +28,7 @@ spec:
steps: steps:
- name: extract - name: extract
image: python:3.11-slim image: python:3.11-slim
workingDir: /workspace/shared/$(params.subdirectory) workingDir: /workspace/shared/$(params.workshop)
env: env:
- name: HOME - name: HOME
value: /workspace/shared/$(params.home) value: /workspace/shared/$(params.home)

View File

@ -4,10 +4,14 @@ metadata:
name: sonarqube-analysis name: sonarqube-analysis
spec: spec:
params: params:
- name: subdirectory - name: home
type: string type: string
default: "" default: ""
description: Subdirectory within workspace containing the source (if any) description: home directory
- name: workshop
type: string
default: ""
description: workshop within workspace containing the source (if any)
- name: sonarHostUrl - name: sonarHostUrl
type: string type: string
@ -29,15 +33,11 @@ spec:
steps: steps:
- name: sonar-scan - name: sonar-scan
image: sonarsource/sonar-scanner-cli:5 image: sonarsource/sonar-scanner-cli:5
workingDir: /workspace/source workingDir: /workspace/source/$(params.workshop)
script: | script: |
#!/bin/sh #!/bin/sh
set -e set -e
if [ -n "$(params.subdirectory)" ]; then
cd "$(params.subdirectory)"
fi
SONAR_TOKEN=$(cat /workspace/sonar-auth/token) SONAR_TOKEN=$(cat /workspace/sonar-auth/token)
echo "📡 Running SonarQube analysis on project $(params.projectKey)..." echo "📡 Running SonarQube analysis on project $(params.projectKey)..."