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

add exclude tags to workspace list options #438

Merged
merged 1 commit into from Jun 29, 2022

Conversation

Uk1288
Copy link
Contributor

@Uk1288 Uk1288 commented Jun 20, 2022

Description

Currently the list of Workspaces within an Organization can be filtered with Tags string to include. This PR adds the ability to exclude workspaces by tags using the ExcludeTags option.

For example, given workspace1 with tag one and workspace2 with tag two, invoking

client.Workspaces.List(ctx, orgName, &WorkspaceListOptions{
			ExcludeTags: "two",
		})

should only return workspace1.

Testing plan

  • Create an organization
  • Create workspaces with tags in that organization
  • List workspaces using the ExcludeTags options, should list all workspaces excluding ones with the excluded tags.

External links

Output from tests

Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.

$ TFE_ADDRESS="https://example" TFE_TOKEN="example" TF_ACC="1" go test ./... -v -tags=integration -run TestWorkspacesList

=== RUN   TestWorkspacesList
=== RUN   TestWorkspacesList/without_list_options
=== RUN   TestWorkspacesList/with_list_options
=== RUN   TestWorkspacesList/when_searching_a_known_workspace
=== RUN   TestWorkspacesList/when_searching_using_a_tag
=== RUN   TestWorkspacesList/when_searching_using_exclude-tags
=== RUN   TestWorkspacesList/when_searching_an_unknown_workspace
=== RUN   TestWorkspacesList/without_a_valid_organization
=== RUN   TestWorkspacesList/with_organization_included
=== RUN   TestWorkspacesList/with_current-state-version,current-run_included
--- PASS: TestWorkspacesList (80.58s)
    --- PASS: TestWorkspacesList/without_list_options (0.29s)
    --- PASS: TestWorkspacesList/with_list_options (0.22s)
    --- PASS: TestWorkspacesList/when_searching_a_known_workspace (0.25s)
    --- PASS: TestWorkspacesList/when_searching_using_a_tag (0.55s)
    --- PASS: TestWorkspacesList/when_searching_using_exclude-tags (0.70s)
    --- PASS: TestWorkspacesList/when_searching_an_unknown_workspace (0.23s)
    --- PASS: TestWorkspacesList/without_a_valid_organization (0.00s)
    --- PASS: TestWorkspacesList/with_organization_included (0.33s)
    --- PASS: TestWorkspacesList/with_current-state-version,current-run_included (75.02s)
PASS

Copy link
Contributor

@annawinkler annawinkler left a comment

Choose a reason for hiding this comment

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

🌟 Thanks for opening this PR! It looks like you need to complete the contributor agreement for this repo. I took a quick look at the test failures, and one might be failing because of this change. Maybe take a look?

sebasslash
sebasslash previously approved these changes Jun 22, 2022
Copy link
Contributor

@sebasslash sebasslash left a comment

Choose a reason for hiding this comment

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

Tests are failing since it's not available in tflocal yet. Code changes look good to me 🔥

brandonc
brandonc previously approved these changes Jun 23, 2022
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.

👍 once API & docs are merged

@Uk1288 Uk1288 dismissed stale reviews from brandonc and sebasslash via 5ff2232 June 24, 2022 18:15
@Uk1288 Uk1288 force-pushed the uk1288-add-exclude-tags-to-workspace-list-options branch from 8a4ff98 to 5ff2232 Compare June 24, 2022 18:15
Copy link
Contributor

@sebasslash sebasslash left a comment

Choose a reason for hiding this comment

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

Woohoo! 🔥

@Uk1288 Uk1288 merged commit efab77c into main Jun 29, 2022
@Uk1288 Uk1288 deleted the uk1288-add-exclude-tags-to-workspace-list-options branch June 29, 2022 23:55
@github-actions
Copy link

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants