Skip to content

Commit

Permalink
Merge pull request #24 from tkozma/add-kustomize-build-options
Browse files Browse the repository at this point in the history
Provide build options to kustomize build
  • Loading branch information
karancode authored Sep 17, 2020
2 parents 25e870e + 1513292 commit 57c6d56
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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`.

4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/kustomize_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 57c6d56

Please sign in to comment.