Skip to content

feat: Sentinel postrun scripts#3591

Merged
michaeljguarino merged 4 commits into
masterfrom
sentinel-post-script
May 23, 2026
Merged

feat: Sentinel postrun scripts#3591
michaeljguarino merged 4 commits into
masterfrom
sentinel-post-script

Conversation

@michaeljguarino
Copy link
Copy Markdown
Member

@michaeljguarino michaeljguarino commented May 21, 2026

This can allow users to configure custom cleanup, especially useful if the bring-their-own-tests

Test Plan

Test environment: https://console.plrldemo.onplural.sh/cd/clusters/a1748282-ce8b-48ab-ae7e-326e74fce04e/services/f3f89a54-d1a7-4bc8-9152-daa07ede918d/components

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

@michaeljguarino michaeljguarino requested a review from a team May 21, 2026 19:07
@michaeljguarino michaeljguarino added the enhancement New feature or request label May 21, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 21, 2026

Greptile Summary

This PR adds a postrunScript field to the Sentinel integration test configuration, letting users supply a shell script that runs after the test job completes — useful for custom cleanup steps when bringing their own tests.

  • New postrun_script field is added end-to-end: Elixir schema/changeset, GraphQL input/output types, Go CRD type, generated client models, and the harness execution path with unit tests.
  • runPostrunScript in the sentinel harness executes the script via /bin/sh -c, inheriting the pod environment; when it fails, the job is marked Failed but the failure reason is currently not surfaced in the console job output.

Confidence Score: 3/5

Mostly safe, but a failure in the postrun script will produce a silently failed job with no user-visible explanation.

The postrun script error is consumed and discarded at line 144: the returned output string is unchanged, so the console job output won't mention the postrun failure at all. A user whose cleanup script exits non-zero will see a Failed status with only the test output, with no indication that it was the postrun script.

go/deployment-operator/pkg/sentinel-harness/controller/controller.go — the postrun error handling at lines 143-145

Important Files Changed

Filename Overview
go/deployment-operator/pkg/sentinel-harness/controller/controller.go Adds postrun script execution after tests; error handling silently discards the failure reason, leaving users without visibility into why the run failed.
go/deployment-operator/pkg/sentinel-harness/controller/controller_test.go Adds unit tests for new postrun script functionality and existing JSON decoding helpers; tests cover nil, empty, success, and failure cases.
go/controller/internal/controller/sentinel_controller.go Passes through the new PostrunScript field from the CRD spec to the console API attributes; straightforward addition with no issues.
go/controller/api/v1alpha1/sentinel_types.go Adds PostrunScript optional field to SentinelCheckIntegrationTestConfiguration; correctly annotated as optional.
lib/console/schema/sentinel.ex Adds postrun_script string field to the embedded IntegrationTestConfiguration schema and includes it in the changeset cast; no migration needed (embedded JSON).
lib/console/graphql/deployments/sentinel.ex Exposes postrun_script on both the input object and the output type; consistent with the schema change.
go/client/models_gen.go Auto-generated Go client models updated to include PostrunScript on SentinelCheckIntegrationTestConfigurationFragment and attributes struct.

Reviews (1): Last reviewed commit: "Sentinel postrun scripts" | Re-trigger Greptile

@michaeljguarino michaeljguarino changed the title Sentinel postrun scripts feat: Sentinel postrun scripts May 21, 2026
@michaeljguarino
Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino michaeljguarino force-pushed the sentinel-post-script branch 8 times, most recently from 206a7f6 to fa598cb Compare May 22, 2026 13:42
@michaeljguarino
Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino michaeljguarino force-pushed the sentinel-post-script branch 5 times, most recently from e8a8c81 to fae4b59 Compare May 22, 2026 17:38
@michaeljguarino
Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino michaeljguarino force-pushed the sentinel-post-script branch 2 times, most recently from b5788a6 to 63368af Compare May 22, 2026 18:41
@michaeljguarino
Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino michaeljguarino force-pushed the sentinel-post-script branch 2 times, most recently from 306f076 to e5bddc4 Compare May 22, 2026 21:19
@michaeljguarino
Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino
Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino michaeljguarino force-pushed the sentinel-post-script branch 2 times, most recently from dabc822 to b82aed6 Compare May 22, 2026 23:54
@michaeljguarino
Copy link
Copy Markdown
Member Author

plural deploy this

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 23, 2026

This can allow users to configure custom cleanup, especially useful if the bring-their-own-tests
@michaeljguarino michaeljguarino force-pushed the sentinel-post-script branch 2 times, most recently from efccc99 to a163dd6 Compare May 23, 2026 01:50
@socket-security
Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: golang go.augendre.info/arangolint is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?golang/github.com/golangci/golangci-lint/v2@v2.11.4golang/go.augendre.info/arangolint@v0.4.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/go.augendre.info/arangolint@v0.4.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@michaeljguarino
Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino michaeljguarino merged commit 7969794 into master May 23, 2026
106 of 111 checks passed
@michaeljguarino michaeljguarino deleted the sentinel-post-script branch May 23, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hotfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant