diff --git a/README.md b/README.md index e7a50e0..1b30a89 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ jobs: kustomize_build_dir: '.' kustomize_comment: true kustomize_output_file: "gitops/rendered.yaml" + kustomize_build_options: "--load_restrictor none" enable_alpha_plugins: true env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }} @@ -43,6 +44,7 @@ Inputs configure Kustomize GitHub Actions to perform build action. * `kustomize_build_dir` - (Optional) The directory to run `kustomize build` on (assumes that the directory contains a kustomization yaml file). Defaults to `.`. * `kustomize_comment` - (Optional) Whether or not to comment on GitHub pull requests. Defaults to `false`. * `kustomize_output_file` - (Optional) Path to to file to write the kustomize build output t. +* `kustomize_build_options` - (Optional) Provide build options to kustomize build. * `enable_alpha_plugins` - (Optional) Enable Kustomize plugins. Defaults to `false`. ## Outputs @@ -56,4 +58,3 @@ Outputs are used to pass information to subsequent GitHub Actions steps. Secrets are similar to inputs except that they are encrypted and only used by GitHub Actions. It's a convenient way to keep sensitive data out of the GitHub Actions workflow YAML file. * `GITHUB_ACCESS_TOKEN` - (Optional) The GitHub API token used to post comments to pull requests. Not required if the `kustomize_comment` input is set to `false`. - diff --git a/action.yml b/action.yml index 9f25361..8cac0f7 100644 --- a/action.yml +++ b/action.yml @@ -22,6 +22,10 @@ inputs: description: 'Path to file to write the kustomize build output to' required: false default: '' + kustomize_build_options: + description: 'Provide build options to kustomize build' + required: false + default: '' enable_alpha_plugins: description: 'Enable Kustomize plugins' required: false diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 0fdeabe..4e8d28e 100755 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -25,6 +25,11 @@ function parse_inputs { kustomize_output_file=${INPUT_KUSTOMIZE_OUTPUT_FILE} fi + kustomize_build_options="" + if [ -n "${INPUT_KUSTOMIZE_BUILD_OPTIONS}" ]; then + kustomize_build_options=${INPUT_KUSTOMIZE_BUILD_OPTIONS} + fi + enable_alpha_plugins="" if [ "${INPUT_ENABLE_ALPHA_PLUGINS}" == "1" ] || [ "${INPUT_ENABLE_ALPHA_PLUGINS}" == "true" ]; then enable_alpha_plugins="--enable_alpha_plugins" diff --git a/src/kustomize_build.sh b/src/kustomize_build.sh index 05b63a1..5afef21 100755 --- a/src/kustomize_build.sh +++ b/src/kustomize_build.sh @@ -3,9 +3,9 @@ function kustomize_build { # gather output echo "build: info: kustomize build in directory ${kustomize_build_dir}." - - build_output=$(kustomize build ${enable_alpha_plugins} ${kustomize_build_dir} 2>&1) - + + build_output=$(kustomize build ${enable_alpha_plugins} ${kustomize_build_options} ${kustomize_build_dir} 2>&1) + build_exit_code=${?} # exit code 0 - success