init
This commit is contained in:
parent
935addf001
commit
a4ff1ba822
@ -24,14 +24,10 @@ spec:
|
|||||||
description: PyPI password or token (fallback)
|
description: PyPI password or token (fallback)
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
- name: pypi-group-url
|
|
||||||
type: string
|
|
||||||
description: PyPI repository URL (install endpoint)
|
|
||||||
default: https://upload.pypi.org/legacy/
|
|
||||||
|
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
description: Workspace containing the cloned Git repository from git-clone-checkout
|
description: Workspace containing the cloned Git repository from git-clone-checkout
|
||||||
|
|
||||||
- name: pypi-auth
|
- name: pypi-auth
|
||||||
optional: true
|
optional: true
|
||||||
description: |
|
description: |
|
||||||
@ -60,7 +56,6 @@ spec:
|
|||||||
|
|
||||||
PYPI_USER="$(params.pypi-username)"
|
PYPI_USER="$(params.pypi-username)"
|
||||||
PYPI_PASS="$(params.pypi-password)"
|
PYPI_PASS="$(params.pypi-password)"
|
||||||
PYPI_URL="$(params.pypi-group-url)"
|
|
||||||
|
|
||||||
if [ -f /workspace/pypi-auth/username ]; then
|
if [ -f /workspace/pypi-auth/username ]; then
|
||||||
PYPI_USER=$(cat /workspace/pypi-auth/username)
|
PYPI_USER=$(cat /workspace/pypi-auth/username)
|
||||||
@ -71,22 +66,22 @@ spec:
|
|||||||
|
|
||||||
if [ -f pyproject.toml ]; then
|
if [ -f pyproject.toml ]; then
|
||||||
echo "[INFO] Poetry project detected"
|
echo "[INFO] Poetry project detected"
|
||||||
pip install poetry --root-user-action=ignore
|
pip install poetry tomli --root-user-action=ignore
|
||||||
poetry config virtualenvs.in-project true
|
poetry config virtualenvs.in-project true
|
||||||
|
|
||||||
if [ -n "$PYPI_URL" ]; then
|
REPO_NAME=$(python3 -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["source"][0]["name"])')
|
||||||
REPO_NAME=$(echo "$PYPI_URL" | sed -E 's#https?://([^/]+)/repository/([^/]+)/?.*#\1_\2#' | tr -cd '[:alnum:]_')
|
REPO_URL=$(python3 -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["source"][0]["url"])')
|
||||||
echo "[INFO] Configuring poetry source '$REPO_NAME' → $PYPI_URL"
|
|
||||||
poetry config repositories."$REPO_NAME" "$PYPI_URL"
|
echo "[INFO] Configuring poetry source '$REPO_NAME' → $REPO_URL"
|
||||||
|
poetry config repositories."$REPO_NAME" "$REPO_URL"
|
||||||
poetry config http-basic."$REPO_NAME" "$PYPI_USER" "$PYPI_PASS"
|
poetry config http-basic."$REPO_NAME" "$PYPI_USER" "$PYPI_PASS"
|
||||||
fi
|
|
||||||
|
|
||||||
poetry install --no-root
|
poetry install --no-root
|
||||||
|
|
||||||
elif [ -f requirements.txt ] && [ -f setup.py ]; then
|
elif [ -f requirements.txt ] && [ -f setup.py ]; then
|
||||||
echo "[INFO] Pip + setup.py project detected"
|
echo "[INFO] Pip + setup.py project detected"
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt --root-user-action=ignore
|
||||||
pip install build
|
pip install build --root-user-action=ignore
|
||||||
else
|
else
|
||||||
echo "[ERROR] No valid build configuration found (pyproject.toml or setup.py required)"
|
echo "[ERROR] No valid build configuration found (pyproject.toml or setup.py required)"
|
||||||
exit 1
|
exit 1
|
||||||
@ -115,7 +110,6 @@ spec:
|
|||||||
echo "Built artifacts located in dist/"
|
echo "Built artifacts located in dist/"
|
||||||
ls -l dist/
|
ls -l dist/
|
||||||
|
|
||||||
# Save result path
|
|
||||||
echo -n "/workspace/source/$(params.subdirectory)/dist" > /tekton/results/build-artifact-path
|
echo -n "/workspace/source/$(params.subdirectory)/dist" > /tekton/results/build-artifact-path
|
||||||
|
|
||||||
- name: verify-build
|
- name: verify-build
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
apiVersion: tekton.dev/v1
|
apiVersion: tekton.dev/v1beta1
|
||||||
kind: Task
|
kind: Task
|
||||||
metadata:
|
metadata:
|
||||||
name: pylint
|
name: pylint
|
||||||
@ -29,11 +29,6 @@ spec:
|
|||||||
description: PyPI password or token (fallback)
|
description: PyPI password or token (fallback)
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
- name: pypi-group-url
|
|
||||||
type: string
|
|
||||||
description: PyPI repository URL (install endpoint)
|
|
||||||
default: https://upload.pypi.org/legacy/
|
|
||||||
|
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
description: Workspace containing the cloned Git repository from git-clone-checkout
|
description: Workspace containing the cloned Git repository from git-clone-checkout
|
||||||
@ -62,7 +57,6 @@ spec:
|
|||||||
|
|
||||||
PYPI_USER="$(params.pypi-username)"
|
PYPI_USER="$(params.pypi-username)"
|
||||||
PYPI_PASS="$(params.pypi-password)"
|
PYPI_PASS="$(params.pypi-password)"
|
||||||
PYPI_URL="$(params.pypi-group-url)"
|
|
||||||
|
|
||||||
if [ -f /workspace/pypi-auth/username ]; then
|
if [ -f /workspace/pypi-auth/username ]; then
|
||||||
PYPI_USER=$(cat /workspace/pypi-auth/username)
|
PYPI_USER=$(cat /workspace/pypi-auth/username)
|
||||||
@ -73,26 +67,25 @@ spec:
|
|||||||
|
|
||||||
if [ -f pyproject.toml ]; then
|
if [ -f pyproject.toml ]; then
|
||||||
echo "[INFO] Poetry project detected"
|
echo "[INFO] Poetry project detected"
|
||||||
|
pip install poetry tomli --root-user-action=ignore
|
||||||
pip install poetry --root-user-action=ignore
|
|
||||||
poetry config virtualenvs.in-project true
|
poetry config virtualenvs.in-project true
|
||||||
|
|
||||||
if [ -n "$PYPI_URL" ]; then
|
REPO_NAME=$(python3 -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["source"][0]["name"])')
|
||||||
REPO_NAME=$(echo "$PYPI_URL" | sed -E 's#https?://([^/]+)/repository/([^/]+)/?.*#\1_\2#' | tr -cd '[:alnum:]_')
|
REPO_URL=$(python3 -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["source"][0]["url"])')
|
||||||
echo "[INFO] Configuring poetry source '$REPO_NAME' with URL: $PYPI_URL"
|
|
||||||
poetry config repositories."$REPO_NAME" "$PYPI_URL"
|
echo "[INFO] Configuring poetry source '$REPO_NAME': $REPO_URL"
|
||||||
|
poetry config repositories."$REPO_NAME" "$REPO_URL"
|
||||||
poetry config http-basic."$REPO_NAME" "$PYPI_USER" "$PYPI_PASS"
|
poetry config http-basic."$REPO_NAME" "$PYPI_USER" "$PYPI_PASS"
|
||||||
fi
|
|
||||||
|
|
||||||
poetry install --no-root
|
poetry install --no-root
|
||||||
poetry add pylint --group dev
|
poetry add pylint --group dev
|
||||||
elif [ -f requirements.txt ]; then
|
elif [ -f requirements.txt ]; then
|
||||||
echo "[INFO] Pip project detected"
|
echo "[INFO] Pip project detected"
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt --root-user-action=ignore
|
||||||
pip install pylint
|
pip install pylint --root-user-action=ignore
|
||||||
else
|
else
|
||||||
echo "[INFO] No dependency file found, installing pylint only"
|
echo "[INFO] No dependency file found, installing pylint only"
|
||||||
pip install pylint
|
pip install pylint --root-user-action=ignore
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: run-lint
|
- name: run-lint
|
||||||
@ -111,11 +104,11 @@ spec:
|
|||||||
else
|
else
|
||||||
pylint $(params.pylint-args) .
|
pylint $(params.pylint-args) .
|
||||||
fi
|
fi
|
||||||
onError: continue # 린트 실패해도 실패로 간주하지 않음
|
onError: continue # 린트 실패해도 파이프라인 중단하지 않음
|
||||||
|
|
||||||
- name: check-results
|
- name: check-results
|
||||||
image: ubuntu
|
image: ubuntu
|
||||||
workingDir: /workspace/source
|
workingDir: /workspace/source
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
echo "Pylint execution completed."
|
echo "✅ Pylint execution completed."
|
||||||
|
@ -25,12 +25,7 @@ spec:
|
|||||||
|
|
||||||
- name: pypi-hosted-url
|
- name: pypi-hosted-url
|
||||||
type: string
|
type: string
|
||||||
description: PyPI repository URL (upload endpoint)
|
description: PyPI repository URL for upload
|
||||||
default: https://upload.pypi.org/legacy/
|
|
||||||
|
|
||||||
- name: pypi-group-url
|
|
||||||
type: string
|
|
||||||
description: PyPI repository URL (install endpoint)
|
|
||||||
default: https://upload.pypi.org/legacy/
|
default: https://upload.pypi.org/legacy/
|
||||||
|
|
||||||
workspaces:
|
workspaces:
|
||||||
@ -39,7 +34,7 @@ spec:
|
|||||||
- name: pypi-auth
|
- name: pypi-auth
|
||||||
optional: true
|
optional: true
|
||||||
description: |
|
description: |
|
||||||
Optional workspace containing:
|
A workspace containing:
|
||||||
- username
|
- username
|
||||||
- password
|
- password
|
||||||
|
|
||||||
@ -52,15 +47,12 @@ spec:
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
pip install --upgrade pip --root-user-action=ignore
|
pip install --upgrade pip --root-user-action=ignore
|
||||||
pip install poetry twine --root-user-action=ignore
|
pip install poetry twine tomli --root-user-action=ignore
|
||||||
|
|
||||||
# 기본값 (params)
|
|
||||||
TWINE_USERNAME="$(params.pypi-username)"
|
TWINE_USERNAME="$(params.pypi-username)"
|
||||||
TWINE_PASSWORD="$(params.pypi-password)"
|
TWINE_PASSWORD="$(params.pypi-password)"
|
||||||
HOSTED_URL="$(params.pypi-hosted-url)"
|
HOSTED_URL="$(params.pypi-hosted-url)"
|
||||||
GROUP_URL="$(params.pypi-group-url)"
|
|
||||||
|
|
||||||
# pypi-auth workspace에 있으면 override
|
|
||||||
if [ -f /workspace/pypi-auth/username ]; then
|
if [ -f /workspace/pypi-auth/username ]; then
|
||||||
TWINE_USERNAME=$(cat /workspace/pypi-auth/username)
|
TWINE_USERNAME=$(cat /workspace/pypi-auth/username)
|
||||||
fi
|
fi
|
||||||
@ -68,22 +60,21 @@ spec:
|
|||||||
TWINE_PASSWORD=$(cat /workspace/pypi-auth/password)
|
TWINE_PASSWORD=$(cat /workspace/pypi-auth/password)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[INFO] Twine Upload URL: $HOSTED_URL"
|
# poetry 설정이 필요한 경우 pyproject.toml 분석
|
||||||
|
|
||||||
# poetry config (install용 group-url 사용)
|
|
||||||
if [ -f pyproject.toml ]; then
|
if [ -f pyproject.toml ]; then
|
||||||
REPO_NAME=$(echo "$GROUP_URL" | sed -E 's#https?://([^/]+)/repository/([^/]+)/?.*#\1_\2#' | tr -cd '[:alnum:]_')
|
REPO_NAME=$(python3 -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["source"][0]["name"])')
|
||||||
echo "[INFO] Configuring poetry install repo: $REPO_NAME -> $GROUP_URL"
|
REPO_URL=$(python3 -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["source"][0]["url"])')
|
||||||
|
|
||||||
poetry config repositories."$REPO_NAME" "$GROUP_URL"
|
echo "[INFO] Configuring poetry source '$REPO_NAME' → $REPO_URL"
|
||||||
|
poetry config repositories."$REPO_NAME" "$REPO_URL"
|
||||||
poetry config http-basic."$REPO_NAME" "$TWINE_USERNAME" "$TWINE_PASSWORD"
|
poetry config http-basic."$REPO_NAME" "$TWINE_USERNAME" "$TWINE_PASSWORD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[INFO] Uploading artifacts with Twine..."
|
echo "[INFO] Uploading artifacts to $HOSTED_URL"
|
||||||
twine upload \
|
twine upload \
|
||||||
--repository-url "$HOSTED_URL" \
|
--repository-url "$HOSTED_URL" \
|
||||||
--username "$TWINE_USERNAME" \
|
--username "$TWINE_USERNAME" \
|
||||||
--password "$TWINE_PASSWORD" \
|
--password "$TWINE_PASSWORD" \
|
||||||
"$(params.build-artifact-path)"/*
|
"$(params.build-artifact-path)"/*
|
||||||
|
|
||||||
echo "[INFO] Successfully uploaded to PyPI"
|
echo "[INFO] ✅ Upload to PyPI complete"
|
||||||
|
@ -24,11 +24,6 @@ spec:
|
|||||||
description: PyPI password or token (fallback)
|
description: PyPI password or token (fallback)
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
- name: pypi-group-url
|
|
||||||
type: string
|
|
||||||
description: PyPI repository URL (install endpoint)
|
|
||||||
default: https://upload.pypi.org/legacy/
|
|
||||||
|
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
description: Workspace containing the cloned Git repository from git-clone-checkout
|
description: Workspace containing the cloned Git repository from git-clone-checkout
|
||||||
@ -54,17 +49,16 @@ spec:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
pip install --upgrade pip --root-user-action=ignore
|
pip install --upgrade pip --root-user-action=ignore
|
||||||
pip install pytest
|
pip install pytest --root-user-action=ignore
|
||||||
|
|
||||||
if [ -f pyproject.toml ]; then
|
if [ -f pyproject.toml ]; then
|
||||||
echo "[INFO] Using Poetry to install dependencies"
|
echo "[INFO] Using Poetry to install dependencies"
|
||||||
pip install poetry --root-user-action=ignore
|
pip install poetry tomli --root-user-action=ignore
|
||||||
poetry config virtualenvs.in-project true
|
poetry config virtualenvs.in-project true
|
||||||
poetry lock --no-cache --regenerate
|
poetry lock --no-cache --regenerate
|
||||||
|
|
||||||
PYPI_USER="$(params.pypi-username)"
|
PYPI_USER="$(params.pypi-username)"
|
||||||
PYPI_PASS="$(params.pypi-password)"
|
PYPI_PASS="$(params.pypi-password)"
|
||||||
PYPI_URL="$(params.pypi-group-url)"
|
|
||||||
|
|
||||||
if [ -f /workspace/pypi-auth/username ]; then
|
if [ -f /workspace/pypi-auth/username ]; then
|
||||||
PYPI_USER=$(cat /workspace/pypi-auth/username)
|
PYPI_USER=$(cat /workspace/pypi-auth/username)
|
||||||
@ -73,17 +67,17 @@ spec:
|
|||||||
PYPI_PASS=$(cat /workspace/pypi-auth/password)
|
PYPI_PASS=$(cat /workspace/pypi-auth/password)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PYPI_URL" ]; then
|
REPO_NAME=$(python3 -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["source"][0]["name"])')
|
||||||
REPO_NAME=$(echo "$PYPI_URL" | sed -E 's#https?://([^/]+)/repository/([^/]+)/?.*#\1_\2#' | tr -cd '[:alnum:]_')
|
REPO_URL=$(python3 -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["source"][0]["url"])')
|
||||||
echo "[INFO] Configuring poetry source '$REPO_NAME': $PYPI_URL"
|
|
||||||
poetry config repositories."$REPO_NAME" "$PYPI_URL"
|
echo "[INFO] Configuring poetry source '$REPO_NAME' → $REPO_URL"
|
||||||
|
poetry config repositories."$REPO_NAME" "$REPO_URL"
|
||||||
poetry config http-basic."$REPO_NAME" "$PYPI_USER" "$PYPI_PASS"
|
poetry config http-basic."$REPO_NAME" "$PYPI_USER" "$PYPI_PASS"
|
||||||
fi
|
|
||||||
|
|
||||||
poetry install --no-root
|
poetry install --no-root
|
||||||
elif [ -f requirements.txt ]; then
|
elif [ -f requirements.txt ]; then
|
||||||
echo "[INFO] Using pip to install dependencies"
|
echo "[INFO] Using pip to install dependencies"
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt --root-user-action=ignore
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: run-tests
|
- name: run-tests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user