Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waypoint action sequence numbers are now reported on agent run completion #165

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

HenryEstberg
Copy link
Contributor

@HenryEstberg HenryEstberg commented Sep 25, 2024

Changes proposed in this PR:

When Waypoint agents have completed an action, they will now report the action sequence number like other types of Waypoint actions.

Note

The linter is failing on this PR with errors logged for cloud-vault-secrets commands, the failure is unrelated to changes in this PR. This is due to the update to the hcp-sdk-go version.

How I've tested this PR:

I have manually tested this by creating an agent group and a corresponding action, then running hcp waypoint agent run and launching the action to allow the Waypoint agent to pick it up. I then verified that the correct sequence number was displayed.

How I expect reviewers to test this PR:

Reviewers can test this PR by running an agent action of their own.

% ./hcp waypoint agent run --config=./agent.hcl 
2024-09-23T12:30:37.315-0700 [INFO]  hcp.waypoint.agent.run: Waypoint agent initialized: hcp-org=*** hcp-project=*** waypoint-namespace=*** groups=["sequence-num-testing"]
2024-09-23T12:31:37.924-0700 [INFO]  hcp.waypoint.agent.run: reporting action run starting: action-run-id=fe192bd6-30e7-4037-8734-e7f3ca6c8648 group=sequence-num-testing operation=test-null
2024-09-23T12:31:38.082-0700 [INFO]  hcp.waypoint.agent.run: finished operation: action-run-id=fe192bd6-30e7-4037-8734-e7f3ca6c8648 group=sequence-num-testing operation=test-null
2024-09-23T12:31:38.082-0700 [INFO]  hcp.waypoint.agent.run: reporting action run ended: action-run-id=fe192bd6-30e7-4037-8734-e7f3ca6c8648 group=sequence-num-testing operation=test-null status="output: hello" status-code=0 sequence=2

Checklist:

  • Tests added if applicable
  • CHANGELOG entry added or label 'pr/no-changelog' added to PR

    Run CHANGELOG_PR=<PR number> make changelog/new-entry for guidance
    in authoring a changelog entry, and commit the resulting file, which should
    have a name matching your PR number. Entries should use imperative present
    tense (e.g. Add support for...)

@HenryEstberg HenryEstberg force-pushed the waypoint/agents/sequence-num branch from 45627a7 to d7f17d7 Compare September 25, 2024 20:01
@HenryEstberg HenryEstberg marked this pull request as ready for review September 27, 2024 16:24
@HenryEstberg HenryEstberg requested a review from a team as a code owner September 27, 2024 16:24
Comment on lines 179 to 180
if resp != nil {
if resp.Payload != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I think you can do this and we can save ourself a nested if:

if resp != nil && resp.Payload != nil { ... }

defer func() {
log.Info("reporting action run ended", "status", status, "status-code", statusCode)
log.Info("reporting action run ended", "status", status, "status-code", statusCode, "sequence", sequenceNum)
Copy link
Member

Choose a reason for hiding this comment

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

We should be more specific here just so it's clear:

Suggested change
log.Info("reporting action run ended", "status", status, "status-code", statusCode, "sequence", sequenceNum)
log.Info("reporting action run ended", "status", status, "status-code", statusCode, "action-run-sequence", sequenceNum)

@paladin-devops paladin-devops mentioned this pull request Oct 2, 2024
@HenryEstberg HenryEstberg force-pushed the waypoint/agents/sequence-num branch from bdfe2eb to 946bbd0 Compare October 17, 2024 23:06
@HenryEstberg HenryEstberg merged commit 4fd98dc into main Oct 21, 2024
6 checks passed
@HenryEstberg HenryEstberg deleted the waypoint/agents/sequence-num branch October 21, 2024 22:55
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.

3 participants