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

[WAYP-2819] Support creating no-code workspaces #927

Merged
merged 9 commits into from
Jul 26, 2024

Conversation

paladin-devops
Copy link
Contributor

@paladin-devops paladin-devops commented Jul 2, 2024

The registry no-code module resource is updated with this commit to include an additional method which can be used to create workspaces using the registry no-code module.

Description

Testing plan

Run go-tfe go test -run TestRegistryNoCodeModule -v ./... with the necessary environment variables.

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.

👋 I know this PR is still a draft, but figured I'd leave some general pointers below.

Comment on lines 48 to 61
Name *string `jsonapi:"attr,name,omitempty"`

// Description is a description for the workspace.
Description *string `jsonapi:"attr,description,omitempty"`

AutoApply *bool `jsonapi:"attr,auto-apply,omitempty"`

// Project is the associated project with the workspace. If not provided,
// default project of the organization will be assigned to the workspace.
Project *Project `jsonapi:"relation,project,omitempty"`

// Variables is the slice of variables to be configured for the no-code
// workspace.
Variables []*Variable `jsonapi:"relation,vars,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

As a convention, we don't express required fields as pointers or with omitempty.

Comment on lines 309 to 311
if !validStringID(o.Name) {
return ErrInvalidName
}
Copy link
Contributor

Choose a reason for hiding this comment

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

validStringID ensures the field follows the resource external ID format used by our API (e.g for a workspace it would be ws-1234abcde).

So either this field accepts a workspace's external ID or a org/workspace name pair to identify a workspace, but not both.

However since this creates a workspace using a no-code module, my guess would be to provide the name not an external ID? In which case we only need to call validString(o.Name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sebasslash thanks for the feedback! I've addressed this and your other comment in this commit.

The registry no-code module resource is updated with this commit to include an additional method which can be used to create workspaces using the registry no-code module.
Also fix validation of the no-code workspace name.
@paladin-devops paladin-devops force-pushed the i-no-code-workspace-creation branch from 0174a85 to 12402eb Compare July 16, 2024 18:58
@paladin-devops paladin-devops marked this pull request as ready for review July 16, 2024 19:01
@paladin-devops paladin-devops requested a review from a team as a code owner July 16, 2024 19:01
Copy link
Collaborator

@uturunku1 uturunku1 left a comment

Choose a reason for hiding this comment

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

These changes look good! Please update the changelog.md to make a note of the support you are adding.

@@ -95,6 +95,7 @@ runs:
TFC_RUN_TASK_URL: "http://testing-mocks.tfe:22180/runtasks/pass"
GITHUB_POLICY_SET_IDENTIFIER: "hashicorp/test-policy-set"
GITHUB_REGISTRY_MODULE_IDENTIFIER: "hashicorp/terraform-random-module"
GITHUB_REGISTRY_NO_CODE_MODULE_IDENTIFIER: "hashicorp/terraform-random-no-code-module"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could my team be provided with an admin permissions to this repo? I'm just thinking of the future scenario where we may want to add an gh action secret or adjust the settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added your team as admin!

@@ -20,7 +20,7 @@ There are instances where several new resources being added (i.e Workspace Run T

After opening a PR, our CI system will perform a series of code checks, one of which is linting. Linting is not strictly required for a change to be merged, but it helps smooth the review process and catch common mistakes early. If you'd like to run the linters manually, follow these steps:

1. Ensure you have [installed golangci-lint](https://golangci-lint.run/usage/install/#local-installation)
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, "page not found". Thanks for this update!

@paladin-devops paladin-devops requested a review from uturunku1 July 26, 2024 19:12
@paladin-devops paladin-devops changed the title [WAYP-2742] Support creating no-code workspaces [WAYP-2819] Support creating no-code workspaces Jul 26, 2024
CHANGELOG.md Outdated
@@ -1,5 +1,11 @@
# UNRELEASED

# v1.61.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you remove this # v1.61.0 line please? My team likes to add this line right when we are about to release to signify that we are ready to release a new version. It is okay for your changelog note to be right under the # UNRELEASED line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha - will fix this!

@paladin-devops paladin-devops requested a review from uturunku1 July 26, 2024 19:49
@paladin-devops paladin-devops merged commit 7b423ec into main Jul 26, 2024
7 checks passed
@paladin-devops paladin-devops deleted the i-no-code-workspace-creation branch July 26, 2024 20:56
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.

3 participants