Skip to content

Commit

Permalink
Update run tasks as not beta
Browse files Browse the repository at this point in the history
Previously Run Tasks was marked as beta in go-tfe. However Run Tasks is now
Generally Available. This commit updates go-tfe to mark Run Tasks as not
Beta.
  • Loading branch information
glennsarti committed Jun 29, 2022
1 parent 2de89fc commit f6deba7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 25 deletions.
10 changes: 7 additions & 3 deletions .circleci/config.yml
Expand Up @@ -21,10 +21,14 @@ jobs:

- run:
name: Run tests
environment:
# Note that https://httpstat.us/200 is enough to test CRUD operations on Run Tasks
# themselves BUT any Runs that use the Run Task will timeout and error
TFC_RUN_TASK_URL: "https://httpstat.us/200"
command: |
export GO111MODULE=on
gotestsum --format short-verbose --junitfile \
$TEST_RESULTS_DIR/tests.xml -- -timeout=40m -tags=integration
export GO111MODULE=on
gotestsum --format short-verbose --junitfile \
$TEST_RESULTS_DIR/tests.xml -- -timeout=40m -tags=integration
no_output_timeout: 1800

- store_test_results:
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,8 @@
## Enhancements
* Adds `RetryServerErrors` field to the `Config` object by @sebasslash [#439](https://github.com/hashicorp/go-tfe/pull/439)
* [beta] Renames the optional StateVersion field `ExtState` to `JSONState` and changes to string for base64 encoding by @annawinkler [#444](https://github.com/hashicorp/go-tfe/pull/444)
* Remove beta messaging for Run Tasks by @glennsarti [#447](https://github.com/hashicorp/go-tfe/pull/447)

# v1.3.0

## Enhancements
Expand All @@ -24,7 +26,6 @@
* Adds `Emails` query param field to `OrganizationMembershipListOptions` by @sebasslash [#393](https://github.com/hashicorp/go-tfe/pull/393)
* Adds Run Tasks API support by @glennsarti [#381](https://github.com/hashicorp/go-tfe/pull/381), [#382](https://github.com/hashicorp/go-tfe/pull/382) and [#383](https://github.com/hashicorp/go-tfe/pull/383)


## Bug fixes
* Fixes ignored comment when performing apply, discard, cancel, and force-cancel run actions [#388](https://github.com/hashicorp/go-tfe/pull/388)

Expand All @@ -46,7 +47,6 @@
* The `ID` field in Create/Update option structs has been renamed to `Type` in accordance with the JSON:API spec by @omarismail, @uturunku1 [#190](https://github.com/hashicorp/go-tfe/pull/190), [#323](https://github.com/hashicorp/go-tfe/pull/323), [#332](https://github.com/hashicorp/go-tfe/pull/332)
* Nested URL params (consisting of an organization, module and provider name) used to identify a `RegistryModule` have been refactored into a struct `RegistryModuleID` by @sebasslash [#337](https://github.com/hashicorp/go-tfe/pull/337)


## Enhancements
* Added missing include fields for `AdminRuns`, `AgentPools`, `ConfigurationVersions`, `OAuthClients`, `Organizations`, `PolicyChecks`, `PolicySets`, `Policies` and `RunTriggers` by @uturunku1 [#339](https://github.com/hashicorp/go-tfe/pull/339)
* Cleanup documentation and improve consistency by @uturunku1 [#331](https://github.com/hashicorp/go-tfe/pull/331)
Expand Down
11 changes: 7 additions & 4 deletions helper_test.go
Expand Up @@ -1189,11 +1189,14 @@ func createWorkspaceWithOptions(t *testing.T, client *Client, org *Organization,

return w, func() {
if err := client.Workspaces.Delete(ctx, org.Name, w.Name); err != nil {
t.Errorf("Error destroying workspace! WARNING: Dangling resources\n"+
"may exist! The full error is shown below.\n\n"+
"Workspace: %s\nError: %s", w.Name, err)
if errors.Is(err, ErrResourceNotFound) {
t.Logf("Cannot cleanup Workspace %s as it does not exist.", w.Name)
} else {
t.Errorf("Error destroying workspace! WARNING: Dangling resources\n"+
"may exist! The full error is shown below.\n\n"+
"Workspace: %s\nError: %s", w.Name, err)
}
}

if orgCleanup != nil {
orgCleanup()
}
Expand Down
9 changes: 4 additions & 5 deletions run_task.go
Expand Up @@ -11,8 +11,7 @@ var _ RunTasks = (*runTasks)(nil)

// RunTasks represents all the run task related methods in the context of an organization
// that the Terraform Cloud/Enterprise API supports.
// **Note: This API is still in BETA and subject to change.**
// https://www.terraform.io/cloud-docs/api-docs/run-tasks#run-tasks-api
// https://www.terraform.io/cloud-docs/api-docs/run-tasks/run-tasks#run-tasks-api
type RunTasks interface {
// Create a run task for an organization
Create(ctx context.Context, organization string, options RunTaskCreateOptions) (*RunTask, error)
Expand Down Expand Up @@ -61,7 +60,7 @@ type RunTaskList struct {
}

// RunTaskIncludeOpt represents the available options for include query params.
// https://www.terraform.io/cloud-docs/api-docs/run-tasks#list-run-tasks
// https://www.terraform.io/cloud-docs/api-docs/run-tasks/run-tasks#list-run-tasks
type RunTaskIncludeOpt string

const (
Expand All @@ -73,14 +72,14 @@ const (
type RunTaskListOptions struct {
ListOptions
// Optional: A list of relations to include with a run task. See available resources:
// https://www.terraform.io/cloud-docs/api-docs/run-tasks#list-run-tasks
// https://www.terraform.io/cloud-docs/api-docs/run-tasks/run-tasks#list-run-tasks
Include []RunTaskIncludeOpt `url:"include,omitempty"`
}

// RunTaskReadOptions represents the set of options for reading a run task
type RunTaskReadOptions struct {
// Optional: A list of relations to include with a run task. See available resources:
// https://www.terraform.io/cloud-docs/api-docs/run-tasks#list-run-tasks
// https://www.terraform.io/cloud-docs/api-docs/run-tasks/run-tasks#list-run-tasks
Include []RunTaskIncludeOpt `url:"include,omitempty"`
}

Expand Down
12 changes: 6 additions & 6 deletions run_task_integration_test.go
Expand Up @@ -13,7 +13,7 @@ import (
)

func TestRunTasksCreate(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestRunTasksCreate(t *testing.T) {
}

func TestRunTasksList(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand All @@ -75,7 +75,7 @@ func TestRunTasksList(t *testing.T) {
}

func TestRunTasksRead(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestRunTasksRead(t *testing.T) {
}

func TestRunTasksUpdate(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand All @@ -151,7 +151,7 @@ func TestRunTasksUpdate(t *testing.T) {
}

func TestRunTasksDelete(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestRunTasksDelete(t *testing.T) {
}

func TestRunTasksAttachToWorkspace(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down
10 changes: 5 additions & 5 deletions workspace_run_task_integration_test.go
Expand Up @@ -12,7 +12,7 @@ import (
)

func TestWorkspaceRunTasksCreate(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -43,7 +43,7 @@ func TestWorkspaceRunTasksCreate(t *testing.T) {
}

func TestWorkspaceRunTasksList(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestWorkspaceRunTasksList(t *testing.T) {
}

func TestWorkspaceRunTasksRead(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -112,7 +112,7 @@ func TestWorkspaceRunTasksRead(t *testing.T) {
}

func TestWorkspaceRunTasksUpdate(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -143,7 +143,7 @@ func TestWorkspaceRunTasksUpdate(t *testing.T) {
}

func TestWorkspaceRunTasksDelete(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down

0 comments on commit f6deba7

Please sign in to comment.