More CI improvements

This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-07-29 21:10:46 +02:00
parent d83abae451
commit bcded223a6
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
41 changed files with 359 additions and 120 deletions

View file

@ -97,8 +97,10 @@ function filterChangedCharts(files, parentFolder) {
let changedCharts = [];
filteredChartFiles.forEach((file) => {
const absoluteParentFolder = path.resolve(parentFolder);
const absoluteChartFolder = path.resolve(path.dirname(file));
const chart = absoluteChartFolder.slice(absoluteParentFolder.length + 1);
const absoluteFileDirname = path.resolve(path.dirname(file));
const relativeFileDirname = absoluteFileDirname.slice(absoluteParentFolder.length + 1);
const chartPathParts = relativeFileDirname.split("/");
const chart = `${chartPathParts[0]}/${chartPathParts[1]}`;
changedCharts.push(chart);
});
// Return only unique items

File diff suppressed because one or more lines are too long

View file

@ -71,8 +71,12 @@ function filterChangedCharts(files: string[], parentFolder: string) {
let changedCharts: string[] = [];
filteredChartFiles.forEach((file) => {
const absoluteParentFolder = path.resolve(parentFolder);
const absoluteChartFolder = path.resolve(path.dirname(file));
const chart = absoluteChartFolder.slice(absoluteParentFolder.length + 1);
const absoluteFileDirname = path.resolve(path.dirname(file));
const relativeFileDirname = absoluteFileDirname.slice(
absoluteParentFolder.length + 1
);
const chartPathParts = relativeFileDirname.split("/");
const chart = `${chartPathParts[0]}/${chartPathParts[1]}`;
changedCharts.push(chart);
});

View file

@ -0,0 +1,35 @@
name: "Override chart dependencies"
description: "Overrides the dependencies for a Helm chart"
inputs:
chart:
required: true
description: "Which chart to override the dependencies for"
overrides:
required: true
description: "A JSON encoded list of dependency overrides"
runs:
using: "composite"
steps:
- name: Override dependencies
shell: bash
run: |
overrides=( $(yq --null-input e -o=j -I=0 '${{ inputs.overrides }}[]' ) )
chartFile="charts/${{ matrix.chart }}/Chart.yaml"
if [[ ! -f ${chartFile} ]]; then
echo "Could not find ${chartFile}"!
exit 1
fi
for override in "${overrides[@]}"; do
name=$(echo "$override" | yq e '.name' -)
repository=$(echo "$override" | yq e '.repository' -)
version=$(echo "$override" | yq e '.version' -)
yq -i "(.dependencies[] | select(.name == \"$name\").repository) |= \"$repository\"" "${chartFile}"
yq -i "(.dependencies[] | select(.name == \"$name\").version) |= \"$version\"" "${chartFile}"
done
echo "Resulting chart:"
cat ${chartFile}