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

Update Run and Workspace Run Tasks for Pre-plan Run Tasks #469

Merged
merged 1 commit into from Aug 1, 2022

Conversation

glennsarti
Copy link
Contributor

@glennsarti glennsarti commented Jul 18, 2022

Description

This commit updates the client for the new Pre-plan Run tasks:

  • New run statuses; FetchingCompleted, Queuing which are ephemeral and will rarely be seen.
    PrePlanRunning and PrePlanCompleted are for the pre-plan tasks
  • Add missing Run Status Time Stamps
  • New Task stage; PrePlan
  • Ability to set/update the stage for a Workspace Run Task. This is a beta feature and must
    be opted into. However it is optional and is not a breaking API change.
  • Adds additional Workspace Run Tasks tests which are gated behind the BETA flag. Note that
    the original tests still remain to affirm that this commit does not change any existing
    behaviour.

Testing plan

Run the acceptance tests against a TFC/TFE instance with the pre-plan feature flag enabled

External links

Output from tests

With go test -v ./... -tags=integration -run TestWorkspaceRunTasks -count=1

=== RUN   TestWorkspaceRunTasksCreate
=== RUN   TestWorkspaceRunTasksCreate/attach_run_task_to_workspace
=== RUN   TestWorkspaceRunTasksCreate/attach_run_task_to_workspace/ensure_run_task_is_deserialized_properly
--- PASS: TestWorkspaceRunTasksCreate (3.39s)
    --- PASS: TestWorkspaceRunTasksCreate/attach_run_task_to_workspace (0.64s)
        --- PASS: TestWorkspaceRunTasksCreate/attach_run_task_to_workspace/ensure_run_task_is_deserialized_properly (0.00s)
=== RUN   TestWorkspaceRunTasksCreateBeta
=== RUN   TestWorkspaceRunTasksCreateBeta/attach_run_task_to_workspace
=== RUN   TestWorkspaceRunTasksCreateBeta/attach_run_task_to_workspace/ensure_run_task_is_deserialized_properly
--- PASS: TestWorkspaceRunTasksCreateBeta (3.28s)
    --- PASS: TestWorkspaceRunTasksCreateBeta/attach_run_task_to_workspace (0.60s)
        --- PASS: TestWorkspaceRunTasksCreateBeta/attach_run_task_to_workspace/ensure_run_task_is_deserialized_properly (0.00s)
=== RUN   TestWorkspaceRunTasksList
=== RUN   TestWorkspaceRunTasksList/with_no_params
--- PASS: TestWorkspaceRunTasksList (5.18s)
    --- PASS: TestWorkspaceRunTasksList/with_no_params (0.36s)
=== RUN   TestWorkspaceRunTasksRead
=== RUN   TestWorkspaceRunTasksRead/by_ID
=== RUN   TestWorkspaceRunTasksRead/by_ID/ensure_run_task_is_deserialized
=== RUN   TestWorkspaceRunTasksRead/by_ID/ensure_workspace_is_deserialized
--- PASS: TestWorkspaceRunTasksRead (3.48s)
    --- PASS: TestWorkspaceRunTasksRead/by_ID (0.25s)
        --- PASS: TestWorkspaceRunTasksRead/by_ID/ensure_run_task_is_deserialized (0.00s)
        --- PASS: TestWorkspaceRunTasksRead/by_ID/ensure_workspace_is_deserialized (0.00s)
=== RUN   TestWorkspaceRunTasksUpdate
=== RUN   TestWorkspaceRunTasksUpdate/rename_task
--- PASS: TestWorkspaceRunTasksUpdate (3.79s)
    --- PASS: TestWorkspaceRunTasksUpdate/rename_task (0.56s)
=== RUN   TestWorkspaceRunTasksUpdateBeta
=== RUN   TestWorkspaceRunTasksUpdateBeta/update_task
--- PASS: TestWorkspaceRunTasksUpdateBeta (3.90s)
    --- PASS: TestWorkspaceRunTasksUpdateBeta/update_task (0.51s)
=== RUN   TestWorkspaceRunTasksDelete
=== RUN   TestWorkspaceRunTasksDelete/with_valid_options
=== RUN   TestWorkspaceRunTasksDelete/when_the_workspace_run_task_does_not_exist
=== RUN   TestWorkspaceRunTasksDelete/when_the_workspace_does_not_exist
--- PASS: TestWorkspaceRunTasksDelete (4.10s)
    --- PASS: TestWorkspaceRunTasksDelete/with_valid_options (0.52s)
    --- PASS: TestWorkspaceRunTasksDelete/when_the_workspace_run_task_does_not_exist (0.24s)
    --- PASS: TestWorkspaceRunTasksDelete/when_the_workspace_does_not_exist (0.25s)
PASS
ok      github.com/hashicorp/go-tfe     27.384s
?       github.com/hashicorp/go-tfe/examples/organizations      [no test files]
?       github.com/hashicorp/go-tfe/examples/workspaces [no test files]
?       github.com/hashicorp/go-tfe/mocks       [no test files]

@glennsarti glennsarti self-assigned this Jul 18, 2022
@glennsarti glennsarti force-pushed the gs/add-pre-plan branch 3 times, most recently from efed688 to 270f10b Compare Jul 20, 2022
@glennsarti glennsarti changed the title {DO NOT MERGE} Update for Pre-plan Run Tasks Update Run and Workspace Run Tasks for Pre-plan Run Tasks Jul 20, 2022
@glennsarti glennsarti marked this pull request as ready for review Jul 20, 2022
@glennsarti glennsarti requested a review from a team as a code owner Jul 20, 2022
@glennsarti
Copy link
Contributor Author

glennsarti commented Jul 20, 2022

Note that while this is adding "beta" features, the APIs for these are basically set in stone. And these changes are not breaking, and opt-in.

@glennsarti glennsarti added the enhancement New feature or request label Jul 20, 2022
workspace_run_task.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Uk1288 Uk1288 left a comment

🎉 I was able to smoke test this on my local. Nice work!

Uk1288
Uk1288 previously approved these changes Jul 26, 2022
This commit updates the client for the new Pre-plan Run tasks:
* New run statuses; FetchingCompleted, Queuing which are ephemeral and will rarely be seen.
  PrePlanRunning and PrePlanCompleted are for the pre-plan tasks
* Add missing Run Status Time Stamps
* New Task stage; PrePlan
* Ability to set/update the stage for a Workspace Run Task. This is a beta feature and must
  be opted into. However it is optional and is not a breaking API change.
* Adds additional Workspace Run Tasks tests which are gated behind the BETA flag. Note that
  the original tests still remain to affirm that this commit does not change any existing
  behaviour.
@glennsarti
Copy link
Contributor Author

glennsarti commented Jul 27, 2022

Hi @Uk1288 . I had to rebase again (merge conflict in changelog). Can you do me a favour, can you approve and merge this for me. Unfortunately it's very common that I have to rebase approved PRs due to changelog conflicts and adds days for me to get work in. Thanks!

Uk1288
Uk1288 approved these changes Aug 1, 2022
@glennsarti glennsarti merged commit ce0f146 into main Aug 1, 2022
6 checks passed
@glennsarti glennsarti deleted the gs/add-pre-plan branch Aug 1, 2022
@github-actions
Copy link

github-actions bot commented Aug 1, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants