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

Rename workspace to devworkspace #396

Merged
merged 3 commits into from
Apr 2, 2021

Conversation

sleshchenko
Copy link
Member

@sleshchenko sleshchenko commented Mar 30, 2021

What does this PR do?

This PR finalize workspace to DevWorkspace renaming. So, I mainly did next replacement:

  • Workspace -> DevWorkspace
  • workspace -> devworkspace

The only model change that is done DevWorkspace.status.workspaceId is renamed to devworkspaceId.
Everything else is just docs changes with workspace -> devworkspace replacement, and a few go types renaming.

We still use workspace for two pieces:

  • workspace.devfile.io K8s API group, since it's not possible to rename in backward compatible manner, but it's not a big deal.
  • devfile-api/pkg/apis/workspaces go package. If we rename it - it's again breaking change and we should adapt depending projects, like http://github.com/devfile/library.

Note: v1alpha1 is not touched since it will fail updated with OLM, and it's critical for WTO.

So, there are still workspace words(131).
If you want to check them, the following regexp should help you: grep -r "[^v-][wW]orkspace" .

output of: grep -r "grep -r "[^v-][wW]orkspace" ."
~/projects/devfile-api workspace2DevWorkspace > grep -r "[^v-][wW]orkspace" .
./README.md:# Kube-native API for cloud development workspaces specification
./README.md:[devworkspace_types.go source file](pkg/apis/workspaces/v1alpha2/devworkspace_types.go)
./README.md:A Subset of this `DevWorkspace` API defines a structure (workspace template content), which is also at the core of the **Devfile 2.0** format specification.
./README.md:In order to test existing or new Devfile 2.0 or DevWorkspace sample files in a self-service Che workspace (hosted on che.openshift.io), just click on the button below:
./.github/actions/generate_types/generate.py:            # Create a ref from the property such as spec to the new path such as v1alpha1.devworkspaces.workspace.devfile.io_spec
Binary file ./generator/build/generator matches
./generator/main.go:            Long:  "Generates additional GO source files (for devfile overriding, union support, deep-copy), K8S CRD YAML files and Json Schemas from the from the `workspaces` K8S API source code.",
./generator/main.go:# Generate Plugin Overrides based on the workspaces/v1alpha2 K8S API
./generator/main.go:generator overrides:isForPluginOverrides=true paths=./pkg/apis/workspaces/v1alpha2
./generator/main.go:# Generate Parent Overrides based on the workspaces/v1alpha2 K8S API
./generator/main.go:generator overrides:isForPluginOverrides=false paths=./pkg/apis/workspaces/v1alpha2
./generator/main.go:# Generate Interface Implementations based on the workspaces/v1alpha2 K8S API
./generator/main.go:generator interfaces paths=./pkg/apis/workspaces/v1alpha2
./generator/main.go:# Generate K8S CRDs based on the workspaces/v1alpha2 K8S API
./generator/main.go:generator crds output:crds:artifacts:config=crds paths=./pkg/apis/workspaces/v1alpha2
./generator/main.go:# Generate DeepCopy implementations based on the workspaces/v1alpha2 K8S API
./generator/main.go:generator deepcopy paths=./pkg/apis/workspaces/v1alpha2
./generator/main.go:# Generate JsonSchemas based on the workspaces/v1alpha2 K8S API
./generator/main.go:generator schemas output:schemas:artifacts:config=schemas paths=./pkg/apis/workspaces/v1alpha2
./generator/vendor/github.com/gobuffalo/flect/azure-tests.yml:    displayName: "Setup Go Workspace"
./generator/vendor/github.com/gobuffalo/flect/azure-pipelines.yml:  GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path
./generator/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go:// using the workspace layout conventions of go/build.
./generator/vendor/golang.org/x/tools/go/gcexportdata/importer.go:// Export data files are located using "go build" workspace conventions
./generator/vendor/golang.org/x/tools/go/packages/doc.go:executes an external query tool appropriate to the current workspace.
./generator/vendor/golang.org/x/tools/go/packages/packages.go:  // underlying workspaces use the gc toolchain. (Even build
./generator/vendor/golang.org/x/tools/go/packages/packages.go:  // systems that support gccgo don't use it for workspace
./build.sh:generator/build/generator "overrides:isForPluginOverrides=true" "paths=./pkg/apis/workspaces/v1alpha2"
./build.sh:generator/build/generator "overrides:isForPluginOverrides=false" "paths=./pkg/apis/workspaces/v1alpha2"
./build.sh:generator/build/generator "validate" "paths=./pkg/apis/workspaces/v1alpha2"
./build.sh:generator/build/generator "interfaces" "paths=./pkg/apis/workspaces/v1alpha2"
./build.sh:generator/build/generator "crds" "output:crds:artifacts:config=crds" "paths=./pkg/apis/workspaces/v1alpha2;./pkg/apis/workspaces/v1alpha1"
./build.sh:generator/build/generator "deepcopy" "paths=./pkg/apis/workspaces/v1alpha2;./pkg/apis/workspaces/v1alpha1"
./build.sh:generator/build/generator "schemas" "output:schemas:artifacts:config=schemas" "paths=./pkg/apis/workspaces/v1alpha2;./pkg/apis/workspaces/v1alpha1"
./devfile.api.code-workspace:                "program": "${workspaceFolder:generator}",
./devfile.api.code-workspace:                "env": { "GOMOD": "${workspaceFolder:generator}/go.mod"},
./devfile.api.code-workspace:                "args": [ "overrides:isForPluginOverrides=true", "paths=./pkg/apis/workspaces/v1alpha2"],
./devfile.api.code-workspace:                "cwd": "${workspaceFolder:api}"
./devfile.api.code-workspace:                "program": "${workspaceFolder:generator}",
./devfile.api.code-workspace:                "env": { "GOMOD": "${workspaceFolder:generator}/go.mod"},
./devfile.api.code-workspace:                "args": [ "overrides", "paths=./pkg/apis/workspaces/v1alpha2" ],
./devfile.api.code-workspace:                "cwd": "${workspaceFolder:api}"
./devfile.api.code-workspace:                "program": "${workspaceFolder:generator}",
./devfile.api.code-workspace:                "env": { "GOMOD": "${workspaceFolder:generator}/go.mod"},
./devfile.api.code-workspace:                "args": [ "interfaces", "paths=./pkg/apis/workspaces/v1alpha2" ],
./devfile.api.code-workspace:                "cwd": "${workspaceFolder:api}"
./devfile.api.code-workspace:                "program": "${workspaceFolder:generator}",
./devfile.api.code-workspace:                "env": { "GOMOD": "${workspaceFolder:generator}/go.mod"},
./devfile.api.code-workspace:                "args": [ "crds", "paths=./pkg/apis/workspaces/v1alpha2;./pkg/apis/workspaces/v1alpha1", "output:crds:artifacts:config=crds" ],
./devfile.api.code-workspace:                "cwd": "${workspaceFolder:api}"
./devfile.api.code-workspace:                "program": "${workspaceFolder:generator}",
./devfile.api.code-workspace:                "env": { "GOMOD": "${workspaceFolder:generator}/go.mod"},
./devfile.api.code-workspace:                "args": [ "deepcopy", "paths=./pkg/apis/workspaces/v1alpha2;./pkg/apis/workspaces/v1alpha1" ],
./devfile.api.code-workspace:                "cwd": "${workspaceFolder:api}"
./devfile.api.code-workspace:                "program": "${workspaceFolder:generator}",
./devfile.api.code-workspace:                "env": { "GOMOD": "${workspaceFolder:generator}/go.mod"},
./devfile.api.code-workspace:                "args": [ "schemas", "paths=./pkg/apis/workspaces/v1alpha2;./pkg/apis/workspaces/v1alpha1", "output:schemas:artifacts:config=schemas" ],
./devfile.api.code-workspace:                "cwd": "${workspaceFolder:api}"
./devfile.api.code-workspace:                "program": "${workspaceFolder:generator}",
./devfile.api.code-workspace:                "env": { "GOMOD": "${workspaceFolder:generator}/go.mod"},
./devfile.api.code-workspace:                "args": [ "validate", "paths=./pkg/apis/workspaces/v1alpha2" ],
./devfile.api.code-workspace:                "cwd": "${workspaceFolder:api}"
./test/v200/utils/common/component_test_utils.go:       schema "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./test/v200/utils/common/endpoint-test-utils.go:        schema "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./test/v200/utils/common/events-utils.go:       schema "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./test/v200/utils/common/command_test_utils.go: schema "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./test/v200/utils/common/test_utils.go: schema "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./test/v200/utils/common/project_test_utils.go: schema "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./test/v200/apiTest/api_test.go:        schema "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./crds/workspace.devfile.io_devworkspaces.yaml:  name: devworkspaces.workspace.devfile.io
./crds/workspace.devfile.io_devworkspaces.yaml:  group: workspace.devfile.io
./crds/workspace.devfile.io_devworkspacetemplates.yaml:  name: devworkspacetemplates.workspace.devfile.io
./crds/workspace.devfile.io_devworkspacetemplates.yaml:  group: workspace.devfile.io
./crds/workspace.devfile.io_devworkspaces.v1beta1.yaml:  name: devworkspaces.workspace.devfile.io
./crds/workspace.devfile.io_devworkspaces.v1beta1.yaml:  group: workspace.devfile.io
./crds/workspace.devfile.io_devworkspacetemplates.v1beta1.yaml:  name: devworkspacetemplates.workspace.devfile.io
./crds/workspace.devfile.io_devworkspacetemplates.v1beta1.yaml:  group: workspace.devfile.io
./pkg/utils/overriding/merging.go:      devworkspaces "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/utils/overriding/merging.go:// The result is a transformed `DevfileWorkspaceTemplateSpec` object, that does not contain any `plugin` component
./pkg/utils/overriding/keys.go: devworkspaces "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/utils/overriding/overriding.go:   dw "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/utils/overriding/overriding.go:// The result is a transformed `DevfileWorkspaceTemplateSpec` object that can be serialized back to yaml or json.
./pkg/utils/overriding/overriding.go:// On an `original` `DevfileWorkspaceTemplateSpec` (which is the core part of a devfile, without the `apiVersion` and `metadata`),
./pkg/utils/overriding/overriding.go:// The result is a transformed `DevfileWorkspaceTemplateSpec` object.
./pkg/utils/overriding/overriding_test.go:      dw "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/utils/unions/normalize.go:        dw "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/utils/unions/normalize_test.go:   dw "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/commands_test.go:      "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/commands.go:   "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/projects.go:   "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/events.go:     "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/endpoints.go:import "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/projects_test.go:      "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/utils.go:      "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/events_test.go:        "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/components_test.go:    "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/endpoints_test.go:     "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/validation/components.go: "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha2/register.go:// +groupName=workspace.devfile.io
./pkg/apis/workspaces/v1alpha2/register.go:     SchemeGroupVersion = schema.GroupVersion{Group: "workspace.devfile.io", Version: "v1alpha2"}
./pkg/apis/workspaces/v1alpha2/doc.go:// +groupName=workspace.devfile.io
./pkg/apis/workspaces/v1alpha1/parent_conversion.go:    "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/components_conversion.go:        "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/conversion_test.go:      "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/plugin_conversion.go:    "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/events_conversion.go:    "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/components_conversion_test.go:   "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/commands_conversion.go:  "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/conversion.go:   "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/register.go:// +groupName=workspace.devfile.io
./pkg/apis/workspaces/v1alpha1/register.go:     SchemeGroupVersion = schema.GroupVersion{Group: "workspace.devfile.io", Version: "v1alpha1"}
./pkg/apis/workspaces/v1alpha1/commands_conversion_test.go:     "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/doc.go:// +groupName=workspace.devfile.io
./pkg/apis/workspaces/v1alpha1/devworkspacetemplate_conversion.go:      "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/devworkspace_conversion.go:      "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/parent_conversion_test.go:       "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/projects_conversion.go:  "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/events_conversion_test.go:       "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/v1alpha1/projects_conversion_test.go:     "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./pkg/apis/workspaces/group.go:package workspaces
./pkg/apis/addtoscheme_workspaces_v1alpha2.go:  "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
./docs/proposals/versioning-and-release.md:   1) Add a new folder for the version in the [devfile/api](https://github.com/devfile/api/) repository under [pkg/apis/workspaces](https://github.com/devfile/api/tree/master/pkg/apis/workspaces). For example `pkg/apis/workspaces/v1` if bumping the K8S API version to `v1`.
./docs/proposals/versioning-and-release.md:   1) Update the schema version string in the `// +devfile:jsonschema:version=<schema-version>` annotation in `pkg/apis/workspace/<k8s-api-version>/doc.go`
./docs/proposals/versioning-and-release.md:The Devfile JSON schema is generated from the Kubernetes API, and the version for the JSON schema is set in the doc.go file in the K8S API (`pkg/apis/workspace/<api-version>/doc.go`).
./docs/proposals/versioning-and-release.md:      ii) The schema-version is updated in `pkg/apis/workspace/<api-version>/doc.go`.
./make-release.sh:  apply_sed "s#jsonschema:version=.*#jsonschema:version=${SCHEMA_VERSION}#g" pkg/apis/workspaces/$K8S_VERSION/doc.go #src/constants.ts
./samples/devfiles/spring-boot-http-booster-devfile.yaml:    type: workspace
./samples/devworkspaces/custom.devworkspace.yaml:apiVersion: "workspace.devfile.io/v1alpha2"
./samples/devworkspaces/example.devworkspace.yaml:apiVersion: "workspace.devfile.io/v1alpha2"
./samples/devworkspaces/with-nodejs-parent-devfile.devworkspace.yaml:apiVersion: "workspace.devfile.io/v1alpha2"
./samples/devworkspaces/with-nodejs-parent-template.devworkspace.yaml:apiVersion: workspace.devfile.io/v1alpha2
./samples/devworkspace-templates/nodejs.devworkspacetemplate.yaml:apiVersion: "workspace.devfile.io/v1alpha2"

What issues does this PR fix or reference?

devfile/devworkspace-operator#321

Is your PR tested? Consider putting some instruction how to test your changes

Testing will be done on DWO side.

Docs PR

// Id of the workspace
WorkspaceId string `json:"workspaceId"`
// Id of the devworkspace
DevWorkspaceId string `json:"devworkspaceId"`
Copy link
Member Author

Choose a reason for hiding this comment

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

note: there is a place for inconsistency: DevWorkspaceId but devworkspaceId.

Consistent ways:

  • DevWorkspaceId -> devWorkspaceId
  • DevworkspaceId -> devworkspaceID

I don't like how DevworkspaceId looks like.
Angel and Josh vote for devworkspaceId instead of devWorkspaceId.
Let me know if you think we should go with any of consistent ways.

Copy link
Contributor

Choose a reason for hiding this comment

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

Go might complain that the json string doesn't match the variable name, but that's just Go being pedantic.

// Id of the workspace
WorkspaceId string `json:"workspaceId"`
// Id of the devworkspace
DevWorkspaceId string `json:"devworkspaceId"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Go might complain that the json string doesn't match the variable name, but that's just Go being pedantic.

@@ -4,7 +4,7 @@ import (
corev1 "k8s.io/api/core/v1"
)

type WorkspacePodContributions struct {
type DevWorkspacePodContributions struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this rename isn't strictly necessary, but if it's a hassle to undo then I'm fine with it. Is this struct used by anyone?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's only DWO who uses it.
I can return it back but personally I would like a bit more to use DevWorkspace to be synced with CR kind.

Copy link
Member Author

Choose a reason for hiding this comment

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

BTW File name should be synced with type )

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I checked and it's unused. DWO has it's own impl https://github.com/devfile/devworkspace-operator/blob/main/apis/controller/v1alpha1/common.go#L18

If it's unused, let's remove it then?

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like a strange thing to have in the spec API so I'm 👍 to remove as long as odo isn't using it.

@@ -1,4 +1,4 @@
apiVersion: workspace.che.eclipse.org/v1alpha2
apiVersion: workspace.devfile.io/v1alpha2
Copy link
Contributor

Choose a reason for hiding this comment

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

👀

Good catch

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: amisevsk, sleshchenko

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@sleshchenko
Copy link
Member Author

@amisevsk I checked WTO updating after renaming and it does not work. Existing CRs must be valid according to the schema. It would work if devWorkspaceId is optional, but it's not case now. Reverted changes in v1alpha1.
Screenshot_20210402_165249

@sleshchenko sleshchenko force-pushed the workspace2DevWorkspace branch from 35cde39 to f533543 Compare April 2, 2021 14:54
@sleshchenko sleshchenko merged commit 1f33556 into devfile:main Apr 2, 2021
@sleshchenko sleshchenko deleted the workspace2DevWorkspace branch April 2, 2021 14:58
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