diff --git a/README.md b/README.md index 27d1e5f..6d94f1c 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ High-level deployment action that handles both GitOps (ArgoCD) and direct kubect | `create_namespace` | Create namespace if it does not exist | ❌ | `true` | | `wait_timeout` | Timeout for waiting on deployments (seconds) | ❌ | `120` | | `env_patches` | Environment file patches (JSON format) | ❌ | - | +| `enable_helm` | Pass `--enable-helm` to `kustomize build` (required for overlays using `helmCharts:`). Requires `helm` binary on the runner; fails fast if missing. Set to `false` to skip. | ❌ | `true` | \* **Image input options** (choose one): - Option 1: `image` (with embedded tag, e.g., `registry.io/app:v1.2.3`) diff --git a/action.yml b/action.yml index bdfbc22..aff6e17 100644 --- a/action.yml +++ b/action.yml @@ -67,6 +67,10 @@ inputs: env_patches: description: 'Environment file patches (JSON format matching patch-env-files, e.g., {"container.env":{"SENTRY_RELEASE":"v1.2.3"}})' required: false + enable_helm: + description: 'Pass --enable-helm to kustomize build (requires helm binary on runner). When true, fails fast if helm is not installed.' + required: false + default: 'true' outputs: mode: @@ -101,6 +105,11 @@ runs: exit 1 fi + if [ "${{ inputs.enable_helm }}" = "true" ] && ! command -v helm >/dev/null 2>&1; then + echo "::error::enable_helm=true but 'helm' binary not found in PATH. Install helm or set enable_helm=false." + exit 1 + fi + - name: Resolve image inputs id: images shell: bash @@ -294,6 +303,7 @@ runs: uses: skyhook-io/kustomize-inspect@v1 with: overlay_dir: ${{ inputs.working_directory }}/${{ inputs.overlay_dir }} + enable_helm: ${{ inputs.enable_helm }} - name: Detect GitOps mode id: detect @@ -320,7 +330,11 @@ runs: fi # 2) Fall back to built manifests (app.kubernetes.io/managed-by) - BUILD_RESULT=$(kustomize build) + KUSTOMIZE_FLAGS=() + if [ "${{ inputs.enable_helm }}" = "true" ]; then + KUSTOMIZE_FLAGS+=(--enable-helm) + fi + BUILD_RESULT=$(kustomize build "${KUSTOMIZE_FLAGS[@]}") MANAGED_BY=$(echo "$BUILD_RESULT" | grep "app.kubernetes.io/managed-by:" | head -n1 | sed 's/.*app.kubernetes.io\/managed-by:\s*//' | tr -d '[:space:]' || true) echo "managed_by=$MANAGED_BY" >> $GITHUB_OUTPUT @@ -359,7 +373,11 @@ runs: shell: bash working-directory: ${{ inputs.working_directory }}/${{ inputs.overlay_dir }} run: | - KUSTOMIZE_BUILD_RESULT=$(kustomize build) + KUSTOMIZE_FLAGS=() + if [ "${{ inputs.enable_helm }}" = "true" ]; then + KUSTOMIZE_FLAGS+=(--enable-helm) + fi + KUSTOMIZE_BUILD_RESULT=$(kustomize build "${KUSTOMIZE_FLAGS[@]}") echo "--- Deployment plan summary ---" echo "Deployment mode: ${{ steps.mode.outputs.mode }}" echo "KUSTOMIZE_BUILD_RESULT=$KUSTOMIZE_BUILD_RESULT" @@ -383,4 +401,5 @@ runs: namespace: ${{ steps.inspect.outputs.namespace }} workloads_json: ${{ steps.inspect.outputs.workloads_json }} wait: 'true' - wait_timeout: ${{ inputs.wait_timeout }} \ No newline at end of file + wait_timeout: ${{ inputs.wait_timeout }} + enable_helm: ${{ inputs.enable_helm }} \ No newline at end of file