Skip to content

fix: emit task process type in release YAML for cf run-task support#1324

Open
stokpop wants to merge 1 commit into
cloudfoundry:mainfrom
stokpop:fix/cf-task-command-presence
Open

fix: emit task process type in release YAML for cf run-task support#1324
stokpop wants to merge 1 commit into
cloudfoundry:mainfrom
stokpop:fix/cf-task-command-presence

Conversation

@stokpop

@stokpop stokpop commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cf run-task failed with "command presence FAILED" on Go buildpack v5
    while working on Ruby buildpack v4.77.0
  • Root cause: release YAML only declared web process type; Ruby declares
    both web and task with the same command
  • Fix: add task to default_process_types in writeReleaseYaml()
  • Escape single quotes in command (''' in YAML single-quoted scalar)
  • Add docs: CF task usage in container-spring_boot.md (with cross-reference)
    and container-java_main.md (PropertiesLauncher pattern, --env CF CLI v7+)

Test plan

  • go test ./src/java/... passes
  • YAML single-quote escaping verified by unit test (yaml.Unmarshal round-trip)
  • cf run-task without --command works on app staged with Go buildpack
  • cf run-task --env JAVA_OPTS="-Dloader.main=..." works with PropertiesLauncher

The two unchecked items require manual CF verification. The Switchblade
integration test framework has no task API, so these cannot be automated
in the current test suite. The unit test for writeReleaseYaml verifies
the YAML output is correct; runtime behavior needs a live CF environment.

Fixes: #1323

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the finalize phase to emit a task process type in the Cloud Foundry release YAML (alongside web) so cf run-task works without requiring an explicit --command, aligning behavior with other buildpacks.

Changes:

  • Emit both web and task under default_process_types with identical commands in writeReleaseYaml().
  • Add tests asserting both process types are present and (intended to be) command-identical.
  • Add documentation describing CF task usage and the PropertiesLauncher/-Dloader.main pattern.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/java/finalize/finalize.go Adds task to default_process_types in generated release YAML.
src/java/finalize/finalize_test.go Adds/updates tests to validate task emission and command equivalence.
docs/container-spring_boot.md Documents CF task behavior and runtime main-class override guidance for Spring Boot apps.
docs/container-java_main.md Documents CF task behavior and PropertiesLauncher/-Dloader.main override guidance for Java Main container.

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

Comment thread src/java/finalize/finalize_test.go Outdated
Comment thread docs/container-spring_boot.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread src/java/finalize/finalize.go Outdated
Comment thread src/java/finalize/finalize_test.go
Comment thread docs/debugging-the-buildpack.md Outdated
Comment thread docs/debugging-the-buildpack.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread docs/debugging-the-buildpack.md Outdated
Comment thread docs/debugging-the-buildpack.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/java/finalize/finalize_test.go
Comment thread src/integration/README.md Outdated
Comment thread docs/container-java_main.md
Ruby buildpack v4 declares both web and task in default_process_types.
Go buildpack only declared web, causing cf run-task to fail with
"command presence FAILED" when no --command is given.

- Add task process type with same command as web, matching Ruby behaviour
- Escape single quotes in command (YAML single-quoted scalar requires '')
- Add tests: web+task both present, single-quote YAML round-trip (TDD)
- Add docs: CF task usage for Spring Boot and Java Main containers,
  including PropertiesLauncher/-Dloader.main pattern for per-task class

Closes cloudfoundry#1323
@stokpop stokpop force-pushed the fix/cf-task-command-presence branch from 7615f23 to 22e272d Compare June 22, 2026 09:33
@stokpop stokpop requested a review from Copilot June 22, 2026 09:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

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.

cf run-task fails with 'command presence FAILED'

2 participants