-
Notifications
You must be signed in to change notification settings - Fork 55
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 contributions through .spec.contributions
field in DevWorkspace
#939
Add support for contributions through .spec.contributions
field in DevWorkspace
#939
Conversation
/retest |
@amisevsk the code looks good to me, though in my testing on Minikube I found that the devworkspace URL does not appear with the
Is there something I'm missing here? |
@AObuchow Weird, that doesn't reproduce for me. Are you sure you're running the changes from this PR? New CRDs + old DWO image would explain that. |
I deleted my minikube cluster and reinstalled everything, just to make sure I had a clean slate. I was able to get the I checked the git log and diff'ed the CRD's and code changes and everything seems in place. Are you testing with the controller running locally as well? If so, then it's something else on my end for sure. |
@AObuchow doesn't reproduce when running locally either. Try a clean install: |
I've only tested locally, and got the same behaviour as @AObuchow if I apply the template with However, I'm able to do |
@dkwon17 does this still occur if you run |
@amisevsk yes, it still happens if I run:
and then run:
After |
I've tested on OpenShift 4.11 and minikube (k8s 1.23.3) and could not reproduce this issue 🤔 Tested also on latest minikube (
In either case, make sure that the webhooks deployment for your test environment is running a PR branch build -- if your webhooks server is using the old DevWorkspace definitions, it's likely not deserializing the components field to begin with, causing it to be dropped when the mutating webhook adds a creator label. |
Thanks @amisevsk , I realized this was the culprit. If I update the |
Thank goodness, I'm glad we figured it out -- I thought I was losing my mind! 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an optional suggestion, LGTM
annotate.AddSourceAttributesForTemplate(contribution.Name, resolvedPlugin) | ||
pluginSpecContents = append(pluginSpecContents, &resolvedPlugin.DevWorkspaceTemplateSpecContent) | ||
} | ||
if workspace != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the best practice for Go, but a small optional suggestion to put the initialization for resolvedParent
and resolvedContent
here, so that it looks like:
resolvedParent := &dw.DevWorkspaceTemplateSpecContent{}
resolvedContent := &dw.DevWorkspaceTemplateSpecContent{}
if workspace != nil {
resolvedContent = workspace.DevWorkspaceTemplateSpecContent.DeepCopy()
resolvedContent.Components = nil
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks. Squashed change into earlier commit.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, dkwon17, ibuziuk 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:
Approvers can indicate their approval by writing |
Update devfile/api commit used for Go dependency and CRDs to devfile/api@fe7c10e Signed-off-by: Angel Misevski <[email protected]>
…endency Regenerate files to pull in changes from devfile/api@fe7c10e Signed-off-by: Angel Misevski <[email protected]>
Add support for specifying additional components in the `.spec.contributions` field of the DevWorkspace. These components are defined and handled similarly to plugin components. Signed-off-by: Angel Misevski <[email protected]>
Add tests covering .spec.contributions field use in DevWorkspaces. This is done by copying tests for plugin components and adapting them to use contributions instead to make sure we cover as many use cases as possible. Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
af200e8
to
9dc8ca3
Compare
New changes are detected. LGTM label has been removed. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #939 +/- ##
=======================================
Coverage ? 48.81%
=======================================
Files ? 36
Lines ? 2325
Branches ? 0
=======================================
Hits ? 1135
Misses ? 1077
Partials ? 113 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
What does this PR do?
Adds support for the
.spec.contributions
field as described in devfile/api#874. The new field functions the same as currentplugin
components but can be defined separately from.spec.template
, allowing easier conversion from devfile to devworkspace and back.For test cases, I copied most of the existing tests for plugins functionality and adapted them to use contributions instead.
What issues does this PR fix or reference?
Part of #656
Is it tested? How?
This PR adds a new sample:
samples/theia-next-contributions.yaml
that uses the new field instead of a theia plugin component. This should behave identically to the currenttheia-next.yaml
sample.In addition I've rewritten the samples from #844 to use contributions instead of plugin components:
checode + golang [link]:
theia + golang [link]:
PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che