Skip to content

ci: create Dataproc clusters with an action that deletes them in its post step - #345

Merged
tnazarew merged 1 commit into
mainfrom
ci/dataproc-cluster-action
Oct 21, 2026
Merged

tnazarew merged 1 commit into
mainfrom
ci/dataproc-cluster-action

Conversation

@tnazarew

@tnazarew tnazarew commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

The spark and hive Dataproc workflows clean up their cluster with a workaround:

  • the producer step runs with continue-on-error
  • the cluster is terminated in an always() step
  • a separate "Fail if … jobs failed" step fails the job afterwards

All this because composite actions can't have post steps, as the workflow's own comment explains. This replaces that with a small JavaScript action that has a post step.

.github/actions/dataproc_cluster

  • main: saves the cluster name, project and region, then runs create-command. Saving first means the post step also deletes a cluster left behind by a failed create.
  • post (post-if: always()): runs after all other steps of the job, whatever their result. If the cluster exists, it deletes it with gcloud dataproc clusters delete. Post steps run in reverse order, so it runs before the GCP auth step removes its credentials.
  • No dependencies: it uses only Node built-ins, so there's nothing to install or bundle.

Usage:

- uses: ./.github/actions/dataproc_cluster
  with:
    cluster-name: my-cluster
    project-id: gcp-open-lineage-testing
    region: us-west1
    create-command: |
      python producer/spark_dataproc/runner/dataproc_workflow.py create-cluster ...

Workflow changes

Relation to other PRs

Testing

  • Local simulation (main and post run with Node against a cluster that doesn't exist):
    • a failed create fails the step and still saves the state
    • a successful create passes
    • post reports "does not exist" and skips the delete
  • Not yet exercised: the delete itself, which needs a real cluster. CI on this PR does not run the Dataproc workflows: main_pr.yml starts them only when a path under producer/spark_dataproc/ or producer/hive_dataproc/ changes, and this PR changes only .github/.
  • actionlint 1.7.12: passes, apart from an existing issue on main: producer_hive_dataproc.yml builds the report name from inputs.hive_release, which isn't an input of that workflow. It's not changed here.

🤖 Generated with Claude Code

@tnazarew
tnazarew marked this pull request as ready for review October 21, 2026 20:29
@tnazarew
tnazarew force-pushed the ci/dataproc-cluster-action branch from 7fd9f0b to 105f889 Compare October 21, 2026 20:29
…post step

The spark and hive dataproc workflows ran the producer step with continue-on-error,
terminated the cluster in an always() step and then failed the job in a separate step,
because composite actions can't have post steps. The new dataproc_cluster action creates
the cluster with the given command and deletes it in its post step, which runs after all
other steps whatever their result, so the producer step can just fail.

The action uses only Node built-ins, so there is nothing to install or bundle. The cluster
name is saved before creating, so a cluster left behind by a failed create is deleted too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: tnazarew <[email protected]>
@tnazarew
tnazarew force-pushed the ci/dataproc-cluster-action branch from 105f889 to 389af25 Compare October 21, 2026 21:32
@tnazarew
tnazarew merged commit a5d85e6 into main Oct 21, 2026
10 checks passed
@tnazarew
tnazarew deleted the ci/dataproc-cluster-action branch October 21, 2026 21:39
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.

1 participant