diff --git a/.github/workflows/housekeeping.yaml b/.github/workflows/housekeeping.yaml index 62ab5d9d5b7..1a4fde9dd58 100644 --- a/.github/workflows/housekeeping.yaml +++ b/.github/workflows/housekeeping.yaml @@ -80,12 +80,12 @@ jobs: helm-docs \ --ignore-file=".helmdocsignore" \ --output-file="README.md" \ - --template-files="/home/runner/work/apps/apps/tools/templates/docs/README.md.gotmpl" \ + --template-files="/home/runner/work/apps/apps/templates/docs/README.md.gotmpl" \ --chart-search-root="${chart}" helm-docs \ --ignore-file=".helmdocsignore" \ --output-file="CONFIG.md" \ - --template-files="/home/runner/work/apps/apps/tools/templates/docs/CONFIG.md.gotmpl" \ + --template-files="/home/runner/work/apps/apps/templates/docs/CONFIG.md.gotmpl" \ --chart-search-root="${chart}" fi done @@ -146,12 +146,12 @@ jobs: helm-docs \ --ignore-file=".helmdocsignore" \ --output-file="README.md" \ - --template-files="/home/runner/work/apps/apps/tools/templates/docs/README.md.gotmpl" \ + --template-files="/home/runner/work/apps/apps/templates/docs/README.md.gotmpl" \ --chart-search-root="${chart}" helm-docs \ --ignore-file=".helmdocsignore" \ --output-file="CONFIG.md" \ - --template-files="/home/runner/work/apps/apps/tools/templates/docs/CONFIG.md.gotmpl" \ + --template-files="/home/runner/work/apps/apps/templates/docs/CONFIG.md.gotmpl" \ --chart-search-root="${chart}" fi done diff --git a/tools/templates/app/.helmignore b/templates/app/.helmignore similarity index 100% rename from tools/templates/app/.helmignore rename to templates/app/.helmignore diff --git a/tools/templates/app/Chart.yaml b/templates/app/Chart.yaml similarity index 100% rename from tools/templates/app/Chart.yaml rename to templates/app/Chart.yaml diff --git a/tools/templates/app/README.md b/templates/app/README.md similarity index 100% rename from tools/templates/app/README.md rename to templates/app/README.md diff --git a/tools/placeholder/SCALE/item.yaml b/templates/app/SCALE/item.yaml similarity index 100% rename from tools/placeholder/SCALE/item.yaml rename to templates/app/SCALE/item.yaml diff --git a/tools/placeholder/SCALE/ix_values.yaml b/templates/app/SCALE/ix_values.yaml similarity index 100% rename from tools/placeholder/SCALE/ix_values.yaml rename to templates/app/SCALE/ix_values.yaml diff --git a/tools/placeholder/SCALE/questions.yaml b/templates/app/SCALE/questions.yaml similarity index 100% rename from tools/placeholder/SCALE/questions.yaml rename to templates/app/SCALE/questions.yaml diff --git a/tools/templates/app/values.yaml b/templates/app/values.yaml similarity index 100% rename from tools/templates/app/values.yaml rename to templates/app/values.yaml diff --git a/tools/templates/docs/CONFIG.md.gotmpl b/templates/docs/CONFIG.md.gotmpl similarity index 100% rename from tools/templates/docs/CONFIG.md.gotmpl rename to templates/docs/CONFIG.md.gotmpl diff --git a/tools/templates/docs/README.md.gotmpl b/templates/docs/README.md.gotmpl similarity index 100% rename from tools/templates/docs/README.md.gotmpl rename to templates/docs/README.md.gotmpl diff --git a/tools/copy-common.sh b/tools/copy-common.sh deleted file mode 100755 index 03cd46cb0af..00000000000 --- a/tools/copy-common.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/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 diff --git a/tools/output/.gitkeep b/tools/output/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tools/process.sh b/tools/process.sh index ba6637f5087..3389fce219c 100644 --- a/tools/process.sh +++ b/tools/process.sh @@ -9,7 +9,7 @@ for chart in input/*; do basename=$(basename ${chart}) echo "processing ${chart} using nodeport $nodeport" mkdir -p output/${basename} - cp -rf placeholder/SCALE output/${basename}/ + cp -rf ../templates/app/SCALE output/${basename}/ cp -rf ${chart}/ci output/${basename}/ || echo "no CI folder detected, continuing..." cp -rf ${chart}/templates output/${basename}/ cp -rf ${chart}/Chart.yaml output/${basename}/Chart.yaml diff --git a/tools/update_dependencies b/tools/update_dependencies deleted file mode 100644 index ac74b60947e..00000000000 --- a/tools/update_dependencies +++ /dev/null @@ -1,128 +0,0 @@ -#!/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() diff --git a/tools/values-change.sh b/tools/values-change.sh deleted file mode 100755 index dd80aa07275..00000000000 --- a/tools/values-change.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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