rename .tools to tools

This commit is contained in:
kjeld Schouten-Lebbing
2021-05-30 13:14:37 +02:00
parent 8b76a14c73
commit 7e63572201
17 changed files with 12 additions and 12 deletions
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eu
# This script requires pyBump to be installed using pip.
for train in stable incubator develop non-free deprecated; do
for chart in charts/${train}/*; do
if [ -d "${chart}" ]; then
echo "Bumping patch version for ${train}/${chart}"
pybump bump --file ${chart}/Chart.yaml --level major
fi
done
done
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eu
# This script requires pyBump to be installed using pip.
for train in stable incubator develop non-free deprecated; do
for chart in charts/${train}/*; do
if [ -d "${chart}" ]; then
echo "Bumping patch version for ${train}/${chart}"
pybump bump --file ${chart}/Chart.yaml --level minor
fi
done
done
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eu
# This script requires pyBump to be installed using pip.
for train in stable incubator develop non-free deprecated; do
for chart in charts/${train}/*; do
if [ -d "${chart}" ]; then
echo "Bumping patch version for ${train}/${chart}"
pybump bump --file ${chart}/Chart.yaml --level patch
fi
done
done
+36
View File
@@ -0,0 +1,36 @@
#!/bin/sh
for chart in stable/*; do
if [ -d "${chart}" ]; then
maxfolderversion=$(ls -l ${chart} | grep ^d | awk '{print $9}' | tail -n 1)
chartname=$(basename ${chart})
echo "Processing: ${chart} - folder: ${maxfolderversion} - version: ${maxchartversion}"
rm -Rf ${chart}/${maxfolderversion}/charts/*.tgz
cp -f library/common-test/charts/* ${chart}/${maxfolderversion}/charts/
fi
done
for chart in incubator/*; do
if [ -d "${chart}" ]; then
maxfolderversion=$(ls -l ${chart} | grep ^d | awk '{print $9}' | tail -n 1)
chartname=$(basename ${chart})
echo "Processing: ${chart} - folder: ${maxfolderversion} - version: ${maxchartversion}"
rm -Rf ${chart}/${maxfolderversion}/charts/*.tgz
cp -f library/common-test/charts/* ${chart}/${maxfolderversion}/charts/
fi
done
for chart in dev/*; do
if [ -d "${chart}" ]; then
maxfolderversion=$(ls -l ${chart} | grep ^d | awk '{print $9}' | tail -n 1)
chartname=$(basename ${chart})
echo "Processing: ${chart} - folder: ${maxfolderversion} - version: ${maxchartversion}"
rm -Rf ${chart}/${maxfolderversion}/charts/*.tgz
cp -f library/common-test/charts/* ${chart}/${maxfolderversion}/charts/
fi
done
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -eu
# Generate helm-docs for Helm charts
# Usage ./gen-helm-docs.sh [chart]
# require helm-docs
command -v helm-docs >/dev/null 2>&1 || {
echo >&2 "helm-docs is not installed. Aborting."
exit 1
}
# Absolute path of repository
repository=$(git rev-parse --show-toplevel)
# Templates to copy into each chart directory
readme_template="${repository}/tools/templates/docs/README.md.gotmpl"
config_template="${repository}/tools/templates/docs/CONFIG.md.gotmpl"
root="${repository}"
for train in stable incubator develop non-free deprecated; do
for chart in ${train}/*; do
if [ -d "${chart}" ]; then
maxchartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
chartname=$(basename ${chart})
echo "-] Copying templates to ${repository}/${chart}"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="README.md" \
--template-files="${repository}/tools/templates/docs/README.md.gotmpl" \
--chart-search-root="${chart}"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="CONFIG.md" \
--template-files="${repository}/tools/templates/docs/CONFIG.md.gotmpl" \
--chart-search-root="${chart}"
fi
done
done
+4
View File
@@ -0,0 +1,4 @@
pip install pre-commit
git config --unset-all core.hooksPath
cd ..
pre-commit install
+26
View File
@@ -0,0 +1,26 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# OWNERS file for Kubernetes
OWNERS
# helm-docs templates
*.gotmpl
+25
View File
@@ -0,0 +1,25 @@
apiVersion: v2
kubeVersion: ">=1.16.0-0"
name: ${CHARTNAME}
version: 1.0.0
upstream_version: 1.1.0
appVersion: 1.0.0
description: ${CHARTNAME} App for TrueNAS SCALE
type: application
deprecated: false
home: https://github.com/truecharts/apps/tree/master/charts/${CHARTNAME}
icon: https://raw.githubusercontent.com/truecharts/apps/master/stable/${CHARTNAME}/icon.png?raw=true
keywords:
- ${CHARTNAME}
sources:
- https://github.com/truecharts/apps/tree/master/charts/${CHARTNAME}
dependencies:
- name: common
repository: https://charts.truecharts.com/
version: 1.3.0
# condition:
maintainers:
- name: TrueCharts
email: info@truecharts.org
url: truecharts.org
# annotations:
+117
View File
@@ -0,0 +1,117 @@
# ${CHARTNAME}
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)
${CHARTNAME} helm package
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/k8s-at-home/charts/issues/new/choose)**
## Source Code
* <https://github.com/${CHARTNAME}/${CHARTNAME}-docker>
* <https://github.com/k8s-at-home/charts/tree/master/charts/${CHARTNAME}>
## Requirements
Kubernetes: `>=1.16.0-0`
## Dependencies
| Repository | Name | Version |
|------------|------|---------|
| https://truecharts.org/ | common | 3.0.1 |
## TL;DR
```console
helm repo add k8s-at-home https://k8s-at-home.com/charts/
helm repo update
helm install ${CHARTNAME} k8s-at-home/${CHARTNAME}
```
## Installing the Chart
To install the chart with the release name `${CHARTNAME}`
```console
helm install ${CHARTNAME} k8s-at-home/${CHARTNAME}
```
## Uninstalling the Chart
To uninstall the `${CHARTNAME}` deployment
```console
helm uninstall ${CHARTNAME}
```
The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.
## Configuration
Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
Other values may be used from the [values.yaml](../common/values.yaml) from the [common library](../common).
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
```console
helm install ${CHARTNAME} \
--set env.TZ="America/New York" \
k8s-at-home/${CHARTNAME}
```
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.
```console
helm install ${CHARTNAME} k8s-at-home/${CHARTNAME} -f values.yaml
```
## Custom configuration
N/A
## Values
**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/charts/tree/master/charts/common/)
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| env | object | `{}` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"${CHARTNAME}/${CHARTNAME}"` | |
| image.tag | string | `"1.0.0"` | |
| ingress.enabled | bool | `false` | |
| service.port.port | int | `1880` | |
| strategy.type | string | `"Recreate"` | |
## Changelog
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/charts/tree/master/charts/common/README.md#Changelog).
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [1.0.0]
#### Added
- N/A
#### Changed
- N/A
#### Removed
- N/A
[1.0.0]: #1.0.0
## Support
- See the [Wiki](https://github.com/k8s-at-home/charts/wiki)
- Open a [issue](https://github.com/k8s-at-home/charts/issues/new/choose)
- Ask a [question](https://github.com/k8s-at-home/charts/discussions)
- Join our [Discord](https://discord.gg/sTMX7Vh) community
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
+32
View File
@@ -0,0 +1,32 @@
#
# IMPORTANT NOTE
#
# This chart inherits from our common library chart. You can check the default values/options here:
# https://github.com/k8s-at-home/charts/tree/master/charts/common/values.yaml
#
image:
repository: ${CHARTNAME}/${CHARTNAME}
pullPolicy: IfNotPresent
tag: 1.0.0
strategy:
type: Recreate
# See more environment variables in the ${CHARTNAME} documentation
# https://${CHARTNAME}.org/docs
env: {}
# TZ:
service:
port:
port: 1880
ingress:
enabled: false
# persistence:
# data:
# enabled: false
# emptyDir: false
# mountPath: /data
+17
View File
@@ -0,0 +1,17 @@
{{- define "custom.custom.configuration.header" -}}
# Configuration Options
{{- end -}}
{{- define "custom.custom.configuration" -}}
{{ template "custom.custom.configuration.header" . }}
##### Connecting to other apps
If you need to connect this App to other Apps on TrueNAS SCALE, please refer to our "Linking Apps Together" guide:
https://truecharts.org/manual/linking/
##### Available config options
In the future this page is going to contain an automated list of options available in the installation/edit UI.
{{- end -}}
{{ template "custom.custom.configuration" . }}
+96
View File
@@ -0,0 +1,96 @@
{{- define "custom.introheader" -}}
# Introduction
{{- end -}}
{{- define "custom.repository.organization" -}}
TrueCharts
{{- end -}}
{{- define "custom.repository.url" -}}
https://github.com/truecharts/apps
{{- end -}}
{{- define "custom.helm.url" -}}
https://charts.truecharts.org
{{- end -}}
{{- define "custom.helm.path" -}}
{{ template "custom.repository.organization" . }}/{{ template "chart.name" . }}
{{- end -}}
{{- define "custom.notes" -}}
TrueCharts are designed to be installed as TrueNAS SCALE app only. We can not guarantee this charts works as a stand-alone helm installation.
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/truecharts/apps/issues/new/choose)**
{{- end -}}
{{- define "custom.requirements" -}}
## Requirements
{{ template "chart.kubeVersionLine" . }}
{{- end -}}
{{- define "custom.dependencies" -}}
## Dependencies
{{ template "chart.requirementsTable" . }}
{{- end -}}
{{- define "custom.install" -}}
## Installing the Chart
To install the chart with the release name `{{ template "chart.name" . }}`
- Open TrueNAS SCALE
- Go to Apps
- Click "Install" for this specific Apps
- Fill out the configuration form
{{- end -}}
{{- define "custom.uninstall" -}}
## Uninstalling the Chart
To uninstall the `{{ template "chart.name" . }}` deployment
- Open TrueNAS SCALE
- Go to Apps
- Go to "Installed Apps"
- Expand the menu in the top-right corner of this App
- Click "Remove" for this specific Apps
The command removes all the Kubernetes components associated with the chart **including storage volumes** _(Except hostPath Storage)_ and deletes the release.
{{- end -}}
{{- define "custom.support" -}}
## Support
- See the [Wiki](https://truecharts.org)
- Open a [issue](https://github.com/truecharts/apps/issues/new/choose)
- Ask a [question](https://github.com/truecharts/apps/discussions)
{{- end -}}
{{- define "custom.copyright" -}}
All Rights Reserved - The TrueCharts Project
{{- end -}}
{{ template "custom.introheader" . }}
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
{{ template "chart.description" . }}
{{ template "custom.notes" . }}
{{ template "chart.sourcesSection" . }}
{{ template "custom.requirements" . }}
{{ template "custom.dependencies" . }}
{{ template "custom.install" . }}
{{ template "custom.uninstall" . }}
{{ template "custom.support" . }}
{{ template "helm-docs.versionFooter" . }}
{{ template "custom.copyright" . }}
+128
View File
@@ -0,0 +1,128 @@
#!/usr/bin/env python3
import argparse
import errno
import os
import subprocess
from collections import defaultdict
ITEMS = defaultdict(lambda: {'success': [], 'error': []})
class ValidationException(Exception):
def __init__(self, error_msg, error_no=errno.EFAULT):
self.errmsg = error_msg
self.errno = error_no
def get_error_name(self):
return errno.errorcode.get(self.errno) or 'EUNKNOWN'
def __str__(self):
return f'[{self.get_error_name()}] {self.errmsg}'
class NotFoundException(ValidationException):
def __init__(self, error):
super().__init__(error, errno.ENOENT)
class TrainNotFoundException(NotFoundException):
def __init__(self):
super(TrainNotFoundException, self).__init__('Failed to find train')
class CatalogItemNotFoundException(NotFoundException):
def __init__(self, path):
super(CatalogItemNotFoundException, self).__init__(f'Failed to find {path!r} catalog item')
def report_result():
print('[\033[94mINFO\x1B[0m]\tExecution Complete')
for index, item in enumerate(ITEMS):
index += 1
data = ITEMS[item]
print(f'\n[\033[94mINFO\x1B[0m]\t{index}) {item}')
if data['success']:
print(
f'[\033[92mOK\x1B[0m]\t - Successfully updated dependencies for {", ".join(data["success"])} versions'
)
for i_v, version in enumerate(data['error']):
v_name, error = version
print(
f'[\033[91mFAILED\x1B[0m]\t ({i_v + 1}) Failed to update dependencies for {v_name!r} version: {error}'
)
def update_train_charts(train_path, commit):
# We will gather all charts in the train and then for each chart all it's versions will be updated
if not os.path.exists(train_path):
raise TrainNotFoundException()
print(f'[\033[94mINFO\x1B[0m]\tProcessing {train_path!r} train')
for item in os.listdir(train_path):
process_catalog_item(os.path.join(train_path, item))
report_result()
if commit and any(ITEMS[item]['success'] for item in ITEMS):
if any(ITEMS[item]['error'] for item in ITEMS):
print(f'[\033[91mFAILED\x1B[0m]\tNot committing changes as failures detected')
else:
commit_msg = f'Updated catalog item dependencies ({train_path.rsplit("/", 1)[-1]} train)\n' \
'Following items were updated:\n'
for item in ITEMS:
commit_msg += f'Updated {item} ({", ".join(ITEMS[item]["success"])} versions)\n\n'
for cmd in (
['git', '-C', train_path, 'add', train_path],
['git', '-C', train_path, 'commit', '-m', commit_msg]
):
cp = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
stderr = cp.communicate()[1]
if cp.returncode:
print(f'[\033[91mFAILED\x1B[0m]\tFailed to execute {" ".join(cmd)}: {stderr.decode()}')
exit(1)
print('[\033[92mOK\x1B[0m]\tChanges committed successfully')
def process_catalog_item(item_path):
if not os.path.exists(item_path):
raise CatalogItemNotFoundException(item_path)
item_name = item_path.rsplit('/', 1)[-1]
print(f'[\033[94mINFO\x1B[0m]\tProcessing {item_name!r} catalog item')
for item_version in os.listdir(item_path):
if os.path.isdir(os.path.join(item_path, item_version)):
update_item_version(item_name, item_version, os.path.join(item_path, item_version))
def update_item_version(item_name, version, version_path):
cp = subprocess.Popen(
['helm', 'dependency', 'update', version_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
stdout, stderr = cp.communicate()
if cp.returncode:
ITEMS[item_name]['error'].append((version, stderr.decode()))
else:
ITEMS[item_name]['success'].append(version)
def main():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(help='sub-command help', dest='action')
parser_setup = subparsers.add_parser('update', help='Update dependencies for specified train')
parser_setup.add_argument('--train', help='Specify train path to update dependencies', required=True)
parser_setup.add_argument('--commit', help='Commit after updating dependencies', default=False)
args = parser.parse_args()
if args.action == 'update':
update_train_charts(args.train, args.commit)
else:
parser.print_help()
if __name__ == '__main__':
main()
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
for chart in stable/*; do
if [ -d "${chart}" ]; then
maxfolderversion=$(ls -l ${chart} | grep ^d | awk '{print $9}' | tail -n 1)
chartname=$(basename ${chart})
echo "Processing: ${chart} - folder: ${maxfolderversion} - version: ${maxchartversion}"
mv -f ${chart}/${maxfolderversion}/values.yaml ${chart}/${maxfolderversion}/ix_values.yaml
fi
done
for chart in incubator/*; do
if [ -d "${chart}" ]; then
maxfolderversion=$(ls -l ${chart} | grep ^d | awk '{print $9}' | tail -n 1)
chartname=$(basename ${chart})
echo "Processing: ${chart} - folder: ${maxfolderversion} - version: ${maxchartversion}"
mv -f ${chart}/${maxfolderversion}/values.yaml ${chart}/${maxfolderversion}/ix_values.yaml
fi
done