2024-11-11 15:34:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
if [[ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]]; then
|
|
|
|
echo "Create a new branch first!"
|
|
|
|
exit 1;
|
|
|
|
fi
|
2024-11-11 16:13:49 +00:00
|
|
|
CHART_NAME="$1"
|
|
|
|
REPO_PATH=$(git rev-parse --show-toplevel)
|
2024-11-11 15:34:41 +00:00
|
|
|
|
2024-11-11 16:13:49 +00:00
|
|
|
type yq >/dev/null 2>&1 || { echo "yq not found, quitting!"; exit 1; }
|
|
|
|
|
|
|
|
if [[ -z "$CHART_NAME" ]]; then
|
|
|
|
echo "no chartname given"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -d "${REPO_PATH}/charts/${CHART_NAME}" ]]; then
|
|
|
|
echo "chart-name already exists"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
cp -r "${REPO_PATH}/skeleton" "${REPO_PATH}/charts/${CHART_NAME}"
|
|
|
|
|
|
|
|
yq -i ".name=\"${CHART_NAME}\"" "${REPO_PATH}/charts/${CHART_NAME}/Chart.yaml"
|
|
|
|
yq -i ".maintainers[0].name=\"$(git config user.name)\"" "${REPO_PATH}/charts/${CHART_NAME}/Chart.yaml"
|
|
|
|
yq -i ".maintainers[0].email=\"$(git config user.email)\"" "${REPO_PATH}/charts/${CHART_NAME}/Chart.yaml"
|
|
|
|
|
2024-11-11 16:15:44 +00:00
|
|
|
echo "Start editing your chart at: ${REPO_PATH}/charts/${CHART_NAME}/"
|