Skip to content

Support for deploying helm charts#130

Merged
crohr merged 28 commits intomainfrom
poc/helm-workflow
Mar 13, 2026
Merged

Support for deploying helm charts#130
crohr merged 28 commits intomainfrom
poc/helm-workflow

Conversation

@crohr
Copy link
Member

@crohr crohr commented Mar 9, 2026

Summary

  • add deployment_target support alongside the existing Compose path, with compose remaining the default and helm added as a first-pass Hetzner-only target
  • bootstrap k3s and Helm on Hetzner preview instances for deployment_target=helm, deploy one Helm release into one namespace per preview, and keep the existing single preview URL model through a PullPreview-managed Caddy gateway
  • add Helm-specific action/CLI inputs for chart selection, values files, and --set overrides, including placeholder expansion for {{ pullpreview_url }}, {{ pullpreview_public_dns }}, {{ pullpreview_public_ip }}, {{ namespace }}, and {{ release_name }}
  • add a dedicated pullpreview_helm workflow using the pullpreview-helm label, with sequential deploy and redeploy smoke coverage on Hetzner
  • scope scheduled dangling cleanup by workflow label via a stored pullpreview_label instance tag so pullpreview, pullpreview-helm, and other custom labels do not clean up each other's instances
  • add unit coverage for Helm parsing, validation, source resolution, value expansion, generated SSH/Helm command scripts, Caddy manifest rendering, and cleanup label scoping
  • update the bundled CLI binary in dist/ and expand the README with Helm deployment notes plus a full action outputs table

Supported Inputs

These are the action inputs currently supported by action.yml and documented in the README.

Input Default Description
app_path . Path to the application directory relative to ${{ github.workspace }}.
dns my.preview.run DNS suffix used for generated preview hostnames.
max_domain_length 62 Maximum generated FQDN length.
label pullpreview Label that triggers preview deployments and scheduled cleanup for this workflow.
github_token ${{ github.token }} Token used for PR comments, labels, collaborator lookup, and SSH key lookup.
admins @collaborators/push GitHub users whose SSH keys are installed on preview instances.
ports 80/tcp,443/tcp Publicly exposed firewall ports. SSH 22 is always open.
cidrs 0.0.0.0/0 Allowed source CIDR ranges for exposed ports.
default_port 80 Port used when building the preview URL.
deployment_target compose Deployment target: compose or helm. helm is Hetzner-only in this pass.
compose_files docker-compose.yml Compose files to pass to docker compose when deployment_target=compose.
compose_options --build Extra docker compose up options when deployment_target=compose.
chart "" Helm chart path, name, or OCI reference when deployment_target=helm.
chart_repository "" Helm repository URL for chart when deployment_target=helm.
chart_values "" Comma-separated Helm values files relative to app_path when deployment_target=helm.
chart_set "" Comma-separated Helm --set overrides when deployment_target=helm.
license "" PullPreview license key.
instance_type small Provider-specific instance type.
region "" Provider region or datacenter override.
image ubuntu-24.04 Hetzner image override. Ignored by AWS Lightsail.
deployment_variant "" Optional short suffix for multiple previews per PR.
provider lightsail Cloud provider: lightsail or hetzner.
registries "" Private registry credentials.
proxy_tls "" HTTPS forwarding target (service:port). Required for deployment_target=helm.
pre_script "" Local shell script executed inline over SSH before deployment.
ttl infinite Maximum deployment lifetime.

Supported Outputs

These are the action outputs currently supported by action.yml and documented in the README.

Output Description
live true when the run produced or updated a live preview deployment, otherwise false.
url Public preview URL. With proxy_tls, this is HTTPS on port 443.
host Preview instance hostname or IP address.
username SSH username for the preview instance.

Verification

  • mise exec -- go test ./...
  • local Hetzner Helm WordPress deploy and trusted-HTTPS verification
  • local consecutive redeploy verification on the same Hetzner instance
  • GitHub workflow smoke: pullpreview_helm / run 22854660547

@crohr crohr added the pullpreview-helm Trigger Helm preview smoke workflow label Mar 9, 2026
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_1
Status ✅ Deploy successful
Preview URL https://ip-54-84-203-228.my.preview.run:443

View logs

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_2
Status ✅ Deploy successful
Preview URL https://ip-54-84-203-228.my.preview.run:443

View logs

@crohr crohr changed the title Add Helm deployment target smoke workflow Support for deploying helm charts Mar 9, 2026
@crohr crohr requested a review from Copilot March 9, 2026 13:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class Helm (k3s) deployment support (Hetzner-only) alongside the existing Docker Compose flow, including new CLI/action inputs, validation, and a dedicated Helm smoke workflow.

Changes:

  • Introduce deployment_target (compose/helm) with Helm chart inputs and validation (chart, repo, values, set).
  • Implement Helm deployment flow (sync app tree when needed, helm upgrade/install, Caddy gateway manifest, failure diagnostics).
  • Expand CI/docs/action surface area to exercise and document Helm deployments.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/pullpreview/up.go Validates deployment config early; prints Helm-specific log tailing instructions.
internal/pullpreview/types.go Adds DeploymentTarget type and new Helm-related fields to option structs.
internal/pullpreview/instance_test.go Adds tests for Helm port behavior and SSH non-interactive options.
internal/pullpreview/instance.go Adds deployment target + Helm fields, config validation, SSH arg refactor, Helm deploy routing.
internal/pullpreview/github_sync.go Persists deployment target + Helm chart fields when rebuilding common options.
internal/pullpreview/deployment_target.go Adds normalization/validation helpers for deployment target.
internal/pullpreview/deploy_helm.go Implements Helm deployment (chart resolution, values expansion/sync, k3s deploy script, diagnostics).
internal/pullpreview/deploy_helm_test.go Adds unit tests for Helm config validation, placeholder expansion, chart/value handling, deployment script generation.
internal/pullpreview/deploy_context.go Extends remote env to include deployment target + namespace/release name; avoids COMPOSE_FILE for Helm.
internal/providers/hetzner/hetzner_test.go Adds Helm userdata assertions; adjusts SSH retry test to account for cert-based SSH checks.
internal/providers/hetzner/hetzner.go Adds Helm userdata branch (k3s + helm install) and validates cert-based SSH access before deleting temp key.
cmd/pullpreview/main_test.go Adds CLI flag parsing tests for Helm-related flags and deployment target default/normalization.
cmd/pullpreview/main.go Adds CLI flags for provider/deployment target and Helm chart inputs; propagates provider name into provider creation.
action.yml Adds action inputs for deployment target + Helm chart settings and wires them into github-sync.
README.md Documents Helm support, new inputs, and provides a Hetzner Helm workflow example.
.github/workflows/pullpreview-helm.yml Adds scheduled/PR Helm smoke workflow with deploy + redeploy assertions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fs.StringVar(&values.admins, "admins", "", "Logins of GitHub users that will have their SSH key installed on the instance")
fs.StringVar(&values.cidrs, "cidrs", "0.0.0.0/0", "CIDRs allowed to connect to the instance")
fs.StringVar(&values.registries, "registries", "", "URIs of docker registries to authenticate against")
fs.StringVar((*string)(&values.options.DeploymentTarget), "deployment-target", string(pullpreview.DeploymentTargetCompose), "Deployment target to use: compose or helm")
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

deployment-target flag registration attempts to pass &values.options.DeploymentTarget (a pullpreview.DeploymentTarget) as a *string to flag.StringVar, which does not compile (cannot convert *DeploymentTarget to *string). Use a separate string field for the raw flag value (or implement flag.Value) and normalize/convert it into opts.DeploymentTarget in ToOptions().

Copilot uses AI. Check for mistakes.
@crohr crohr added pullpreview-openproject Trigger OpenProject Helm preview smoke workflow pullpreview This label allows to start a PullPreview environment pullpreview-multi-env This label starts a multi-env PullPreview environment labels Mar 10, 2026
@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit fb684a0
Variant env1
Job deploy_env1
Status ✅ Deploy successful
Preview URL http://env1-pr-130-helm-workflo-ip-44-202-19-7.my.preview.run:80

View logs

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit fb684a0
Variant env2
Job deploy_env2
Status ✅ Deploy successful
Preview URL http://env2-pr-130-helm-workf-ip-35-174-153-88.my.preview.run:80

View logs

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_hetzner
Status ✅ Deploy successful
Preview URL https://ip-178-156-202-102.rev2.click:443

View logs

@github-actions github-actions bot removed the pullpreview This label allows to start a PullPreview environment label Mar 10, 2026
@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Variant env2
Job deploy_env2
Status 🗑️ Preview destroyed
Preview URL Destroyed

View logs

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Variant env1
Job deploy_env1
Status 🗑️ Preview destroyed
Preview URL Destroyed

View logs

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_1
Status 🗑️ Preview destroyed
Preview URL Destroyed

View logs

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_2
Status ✅ Deploy successful
Preview URL https://l803d69-pr-1-ip-5-161-186-133.rev2.click:443

View logs

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_1
Status 🗑️ Preview destroyed
Preview URL Destroyed

View logs

@crohr crohr added pullpreview-helm Trigger Helm preview smoke workflow and removed pullpreview-helm Trigger Helm preview smoke workflow labels Mar 10, 2026
@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_2
Status ✅ Deploy successful
Preview URL https://la3eac9-pr-ip-178-156-245-69.rev2.click:443

View logs

@crohr crohr added pullpreview This label allows to start a PullPreview environment pullpreview-multi-env This label starts a multi-env PullPreview environment pullpreview-helm Trigger Helm preview smoke workflow pullpreview-openproject Trigger OpenProject Helm preview smoke workflow and removed pullpreview-multi-env This label starts a multi-env PullPreview environment pullpreview-helm Trigger Helm preview smoke workflow pullpreview-openproject Trigger OpenProject Helm preview smoke workflow labels Mar 11, 2026
@crohr crohr added the pullpreview-lightsail-helm Trigger Lightsail Helm preview smoke workflow label Mar 11, 2026
@github-actions
Copy link

github-actions bot commented Mar 11, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_1
Status 🗑️ Preview destroyed
Preview URL Destroyed

View logs

@github-actions
Copy link

github-actions bot commented Mar 11, 2026

Deploying action with PullPreview

Field Value
Latest commit 2505c49
Job deploy_smoke_2
Status ✅ Deploy successful
Preview URL https://l35fc8f-pr-13-ip-3-85-125-167.rev3.click:443

View logs

@github-actions github-actions bot removed the pullpreview This label allows to start a PullPreview environment label Mar 11, 2026
@crohr crohr merged commit b65e85e into main Mar 13, 2026
13 of 14 checks passed
@crohr crohr deleted the poc/helm-workflow branch March 13, 2026 07:46
@github-actions github-actions bot removed pullpreview-lightsail-helm Trigger Lightsail Helm preview smoke workflow pullpreview-multi-env This label starts a multi-env PullPreview environment pullpreview-helm Trigger Helm preview smoke workflow pullpreview-openproject Trigger OpenProject Helm preview smoke workflow labels Mar 13, 2026
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