Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm-fan-out script to prepare a release. #46

Closed
wants to merge 1 commit into from
Closed

Conversation

vdemeester
Copy link
Member

Each file need to be on its own file to be released (and taken into
account but catalog-cd release. This adds a script to do that, in
preparation of a "make release" target.

Signed-off-by: Vincent Demeester [email protected]

Each file need to be on its own file to be released (and taken into
account but `catalog-cd release`. This adds a script to do that, in
preparation of a "make release" target.

Signed-off-by: Vincent Demeester <[email protected]>
Comment on lines +1 to +26
#!/usr/bin/env bash
# Based on https://github.com/helm/helm/issues/4680#issuecomment-1152289297
# helm-fan-out

if [ -z "$1" ]; then
echo "Please provide an output directory"
exit 1
fi

awk -vout="$1" -F": " '
$0~/^# Source: / {
file=out"/"$2;
if (!(file in filemap)) {
filemap[file] = 1
print "Creating "file;
system ("mkdir -p $(dirname "file")");
}
print "---" >> file;
}
$0!~/^# Source: / {
if ($0!~/^---$/) {
if (file) {
print $0 >> file;
}
}
}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use helm template to render the individual files by adopting the --show-only flag. As in the following example:

for t in $(ls -1 templates/task-*.yaml); do
    task_file="$(basename ${t})"
    echo "# Rendering template ${t} into ${task_file}"
    make helm-template ARGS="--show-only=${t}" >/tmp/${task_file}
done

A better place for this is the Makefile, adding a new helm-template-tasks target, i.e.:

helm-template-tasks:
    for t in $(ls -1 templates/task-*.yaml); do
        helm template --show-only=${t} >/tmp/`basename ${t}``
    done

With a configurable directory instead of /tmp like on the example above. So the task repository can prepare it's own files for later release.

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I didn't know that, it would definitely be better then.

@vdemeester vdemeester closed this Sep 28, 2023
@otaviof otaviof mentioned this pull request Sep 28, 2023
@vdemeester vdemeester deleted the helm-fan-out branch December 19, 2023 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants