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

feat: add support for run task results callback #929

Merged
merged 26 commits into from
Jul 3, 2024
Merged

Conversation

sebasslash
Copy link
Contributor

Description

This PR aims to address the missing support for Run Tasks Integration API. I have already raised an issue #862 about this.
It introduces the following:

  • RunTaskRequest struct which can be used to objectify the request you get from a TFC/E run task
  • RunTasksCallback interface which can be used to update the run task with status and messages
    • TaskResultsCallbackOptions defines the attributes required in order to perform the update

Testing plan

Unfortunately, it is not easy to test the Update function because you first need a running server which listens for incoming TFC/E requests. Then, you need a workspace run which is configured to use that run task endpoint.

However, I added the following unit tests and their output when run locally:

  • TestTaskResultsCallbackRequestOptions_Validate

Screenshot 2024-06-19 at 8 27 28 AM

  • TestTaskResultsCallbackRequestOptions_Marshal

Screenshot 2024-06-19 at 8 28 01 AM

  • TestTaskResultsCallbackUpdate_Validate

Screenshot 2024-06-19 at 8 28 25 AM

  • TestTaskResultsCallbackUpdate

Screenshot 2024-06-19 at 8 28 52 AM

External links

https://github.com/hashicorp/terraform-run-task-scaffolding-go this HashiCorp repo contains part of the code that can be found here.

@sebasslash sebasslash requested a review from a team as a code owner July 3, 2024 15:47
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

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

This is a great addition. I just had some minor concern about naming

run_task_request.go Outdated Show resolved Hide resolved
run_task_results_callback.go Outdated Show resolved Hide resolved
run_task_results_callback.go Outdated Show resolved Hide resolved
@sebasslash
Copy link
Contributor Author

@karvounis-form3 I'll address these suggestions on this branch that way we don't have to rebase your changes again.

@sebasslash sebasslash merged commit 5b078d2 into main Jul 3, 2024
7 checks passed
@sebasslash sebasslash deleted the sebasslash/main branch July 3, 2024 20:30
Copy link

github-actions bot commented Jul 3, 2024

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

@sebasslash
Copy link
Contributor Author

@karvounis-form3 We release roughly every week on Tuesdays, so you can expect these changes to land in v1.59.0 next week.

@karvounis-form3
Copy link
Contributor

Thank you for this!

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.

4 participants