Skip to content

feat: stream project failure text to job page#6414

Merged
chenrui333 merged 1 commit into
runatlantis:mainfrom
eamonryan:stream-job-page-failure-banner
Jun 27, 2026
Merged

feat: stream project failure text to job page#6414
chenrui333 merged 1 commit into
runatlantis:mainfrom
eamonryan:stream-job-page-failure-banner

Conversation

@eamonryan

@eamonryan eamonryan commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

When a plan or apply fails before producing any terraform output (e.g. lock contention, depends_on, requirement checks), the Atlantis job page linked from the GitHub commit status is blank because nothing is streamed to the output buffer before OperationComplete.

This is (normally) fine because the error is posted as a GitHub comment, but if you are someone who likes/needs to use silence_pr_comments because you have a lot of environments managed by Atlantis, then it's an issue because silence_pr_comments hides these errors.

This PR aims to fix that!

Solution: Emit a labeled Error:/Failure: banner to the job output stream from ProjectOutputWrapper.updateProjectPRStatus on the failure branch so the job page ends with a visible final status.

what

  • Errors from lock contention, depends_on and requirement checks (e.g. approvals) will be logged in the streamed xterm output as well as in PR comments.

why

  • If a user has silence_pr_comments enabled, they miss these errors, so this fixes that
  • This should be harmless for users who do not use silence_pr_comments since it simply means the error will be in both a comment and in the streamed output
  • We emit a labeled Error:/Failure: banner to the job output stream from ProjectOutputWrapper.updateProjectPRStatus on the failure branch so the job page ends with a visible final status.

tests

  • Added tests to project_command_runner_test.go
  • Built image locally and tested in my own environment
  • Example of streamed error in xterm due to no-approval:
Screenshot_2026-04-20_18-28-15 - Example of streamed error in xterm due to lock contention: Screenshot_2026-04-20_18-34-48

references

Refs: This was noted last year by a commenter here and obviously, also affects me or I wouldn't be submitting this ;)

Copilot AI review requested due to automatic review settings April 21, 2026 01:57
@dosubot dosubot Bot added feature New functionality/enhancement go Pull requests that update Go code labels Apr 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures that when a project plan/apply fails before any Terraform output is streamed, the per-project Atlantis job page is no longer blank by streaming a clear error/failure banner into the job output prior to the operation-complete signal.

Changes:

  • Stream Error: and/or Failure: banners to the job output stream when a project command returns an error or failure.
  • Add/extend unit tests to assert the ordering and content of streamed job messages (banners before OperationComplete).

Reviewed changes

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

File Description
server/events/project_command_runner.go Streams failure/error text into the job output stream on the failure branch of project status updates.
server/events/project_command_runner_test.go Adds test cases and assertions verifying banners are streamed (and ordered) correctly before completion.

lukemassa
lukemassa previously approved these changes May 7, 2026

@lukemassa lukemassa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, looks good to me!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 7, 2026
@eamonryan eamonryan force-pushed the stream-job-page-failure-banner branch 2 times, most recently from 86449e8 to 5508679 Compare May 12, 2026 15:17
@eamonryan

Copy link
Copy Markdown
Contributor Author

@lukemassa thanks! i don't have permission to run the workflows but hopefully someone can :)

@chenrui333 chenrui333 force-pushed the stream-job-page-failure-banner branch from 5508679 to ba4c55d Compare June 27, 2026 02:19
@chenrui333 chenrui333 force-pushed the stream-job-page-failure-banner branch 3 times, most recently from 3131f1f to 3ea846b Compare June 27, 2026 03:06
When a plan or apply fails before producing any terraform output (e.g.
lock contention, depends_on, requirement checks), the Atlantis job page
linked from the GitHub commit status was blank because nothing was
streamed to the output buffer before OperationComplete.

Emit a labeled Error:/Failure: banner to the job output stream from
ProjectOutputWrapper.updateProjectPRStatus on the failure branch so the
job page ends with a visible final status. This is especially valuable
for users with silence_pr_comments enabled, who otherwise lose all
visibility into these failures.

Refs: runatlantis#4386
Signed-off-by: Éamon Ryan <eamon.ryan@grafana.com>
Signed-off-by: Rui Chen <rui@chenrui.dev>
@chenrui333 chenrui333 force-pushed the stream-job-page-failure-banner branch from 3ea846b to bc0ec9e Compare June 27, 2026 03:24
@chenrui333

Copy link
Copy Markdown
Member

Thanks @eamonryan for your first contribution!

@chenrui333 chenrui333 merged commit 31cd481 into runatlantis:main Jun 27, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New functionality/enhancement go Pull requests that update Go code lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants