mirror of
https://github.com/truenas/charts.git
synced 2026-02-03 02:23:49 +08:00
* Adapt charts CI and improve/fix common * add check on permissions contaienr * add postgres template * update comments * Update create_app.sh * add check * update script * auto gen item.yaml from Chart,yaml * rename readme on dest * duplicate readme from the same source * correct comment * reoder * remove extra space * keep both README and app-readme * update regex, to also allow 2 letter names, which is also valid * No need to check host network if there aren't any pod values * use same pattern as the pod.name label (not prepending release-name * update deps * add chart dirs to ci * Add a validation to check if there is any yaml errors after merging files * update charts path on ci * common/1.0.0/ -> common/ * update common-test dep path * temp update create_app script * make permissions container name configurable, incase we want to change order of execution * update naming convention * fix typo and a missed name change * do not allow `--` in names
60 lines
1.6 KiB
Bash
Executable File
60 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
VERSION="v4.31.1"
|
|
BINARY="yq_linux_amd64"
|
|
YQ_PATH="/tmp/yq"
|
|
BASE_PATH="library/ix-dev"
|
|
|
|
if [[ ! -f "$YQ_PATH" ]]; then
|
|
wget "https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}" -O "$YQ_PATH" && \
|
|
chmod +x "$YQ_PATH"
|
|
fi
|
|
|
|
function check_args(){
|
|
local arg=$1
|
|
if [[ -z "$arg" ]]; then
|
|
echo "Error: $2 not specified"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
function copy_app() {
|
|
local train=$1
|
|
local app=$2
|
|
|
|
# Check arguments have values
|
|
check_args "$train"
|
|
check_args "$app"
|
|
|
|
# Grab version from Chart.yaml
|
|
version=$("$YQ_PATH" '.version' "$BASE_PATH/$train/$app/Chart.yaml")
|
|
check_args "$version"
|
|
|
|
# Make sure directories exist
|
|
mkdir -p "$train/$app/$version"
|
|
|
|
helm dependency update "$BASE_PATH/$train/$app"
|
|
# Copy files over
|
|
rsync --archive --delete "$BASE_PATH/$train/$app/" "$train/$app/$version"
|
|
# Rename values.yaml to ix_values.yaml
|
|
mv "$train/$app/$version/values.yaml" "$train/$app/$version/ix_values.yaml"
|
|
|
|
# Remove CI directory from the versioned app
|
|
rm -r "$train/$app/$version/ci"
|
|
|
|
# Grab icon and categories from Chart.yaml
|
|
icon=$("$YQ_PATH" '.icon' "$BASE_PATH/$train/$app/Chart.yaml")
|
|
check_args "$icon"
|
|
categories=$("$YQ_PATH" '.keywords' "$BASE_PATH/$train/$app/Chart.yaml")
|
|
check_args "$categories"
|
|
|
|
# Create item.yaml
|
|
echo "" > "$train/$app/item.yaml"
|
|
ICON="$icon" "$YQ_PATH" '.icon_url = env(ICON)' --inplace "$train/$app/item.yaml"
|
|
CATEGORIES="$categories" "$YQ_PATH" '.categories = env(CATEGORIES)' --inplace "$train/$app/item.yaml"
|
|
|
|
}
|
|
|
|
# TODO: Call this function for each changed app
|
|
copy_app "$1" "$2"
|