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 support for DevWorkspaces with parents #346

Merged
merged 12 commits into from
Mar 27, 2021

Conversation

amisevsk
Copy link
Collaborator

What does this PR do?

This PR is a copy of devfile/library#74. It adds support for parents in DevWorkspaces (since most of the functionality was already there, and a majority of the work was renaming things to make sense). It also allows plugins/parents specified by URI to point at devfiles, devworkspaces, or devworkspacetemplates, and processes each accordingly.

What issues does this PR fix or reference?

No issue, but the work was done for #334

Is it tested? How?

I haven't prepared a test that uses parents, but regular functionality we currently use should still be supported.

Make the utility functions used for resolving plugins by ID, URI, or
Kubernetes reference not depend on the PluginComponent type and instead
take the relevant information directly. This is required to allow
reusing these functions for resolving Devfile parents

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Add support for resolving devfile parents in same way we resolve plugins
(supporting id, URI, and kubernetes reference)

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
If attempting to unmarshal a network response to a devfile results in a
struct without a schemaVersion, attempt to unmarshal to a DevWorkspace
or DevWorkspaceTemplate instead.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Rename plugin-related struct fields in tests to be generic, to allow
them to hold any resources referenced. Required for reusing these
structs cleanly in parent tests.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Make flatten library work without an HTTP or Kubernetes client to allow
supporting only kubernetes or http references. If attempting to flatten
a devfile that contains an import that doesn't have the required client,
return a descriptive error.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Adds test cases to cover:
- Using resolver when HttpClient or K8sClient are nil
- Resolving Kubernetes resources when no namespace can be determined
- Resolving resources by ID when no registryURL can be determined

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Add attribute 'controller.devfile.io/imported-by: parent' to Components,
Commands, Projects, and StarterProjects imported via a parent in the
original devfile, to help track where resources in the resolved Devfile
came from

Signed-off-by: Angel Misevski <amisevsk@redhat.com>

fixup annotate parent
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

LGTM
I looked through the PR diff and only managed to find end-find empty lines )

I did not tested but we have pretty good unit testing )

Copy link
Contributor

@JPinkney JPinkney left a comment

Choose a reason for hiding this comment

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

LGTM, other than Serhii's comments

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [JPinkney,amisevsk,sleshchenko]

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

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
@openshift-ci-robot
Copy link
Collaborator

New changes are detected. LGTM label has been removed.

@sleshchenko
Copy link
Member

/test v5-devworkspaces-operator-e2e

@sleshchenko
Copy link
Member

/retest

@amisevsk amisevsk merged commit f0a963d into devfile:main Mar 27, 2021
@amisevsk amisevsk deleted the support-parent branch March 27, 2021 00:01
@amisevsk
Copy link
Collaborator Author

🙄 even writing instructions in my commit message was not enough to get me to remember: 173f242.

Sorry all, I should've thought before merging.

@sleshchenko
Copy link
Member

sleshchenko commented Mar 30, 2021

@amisevsk Why you just don't use git commit --fixup COMMIT ?
When you don't need to order it manually, but just do git rebase origin/main -i --autosquash
P.S. It won't help you to remember do rebase before merge )

@amisevsk
Copy link
Collaborator Author

Why you just don't use git commit --fixup COMMIT ?

Today I learned...

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

Successfully merging this pull request may close these issues.

4 participants