-
Notifications
You must be signed in to change notification settings - Fork 61
Add support for devfile 2.0 global variables #509
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
Conversation
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
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 tested and it LGTM
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 just tested and works as expected. Please create an issue for dashboard to take into account DevWorkspaceWarning.
for starterProjectName, warnings := range warn.StarterProjects { | ||
msg = append(msg, fmt.Sprintf("invalid variables in starter project %s: '%s'", starterProjectName, strings.Join(warnings, "', '"))) | ||
} | ||
return fmt.Sprintf("Error processing variable replacements: %s", strings.Join(msg, "; ")) |
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.
when I tested I noticed that probably there are even more quotas than we would like to have
conditions:
- lastTransitionTime: "2021-07-28T12:57:33Z"
message: 'Error processing variable replacements: invalid variables in component
vsix-installer: ''test-variable''; invalid variables in component tools: ''test-variable'''
Ah, I see. It's ' is used for multilines, and ''
is escaped '
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.
The joys of YAML :D
For a while I wanted to use %q
instead of %s
(so that it would print "var"
instead of print var
), but that ends up requiring escapes all the time.
[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:
Approvers can indicate their approval by writing |
Created dashboard issue: eclipse-che/che#20220 |
Signed-off-by: Angel Misevski <[email protected]>
New changes are detected. LGTM label has been removed. |
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path |
What does this PR do?
Add support for devfile 2.0 variables. In most string fields in a DevWorkspace, DWO will attempt to replace the string
{{ some-variable }}
with the corresponding variable from.spec.template.variables
.If a replacement cannot be found, a new condition
DevWorkspaceWarning
is set on the DevWorkspace with a message likeand the info message will be updated to include some warning text, e.g.
What issues does this PR fix or reference?
#508
Is it tested? How?
Apply the DevWorkspace below:
The value in the env var should be replaced once the pod is created.
To test warnings, delete the variable from the devworkspace
PR Checklist
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path
to trigger)v7-devworkspaces-operator-e2e
: DevWorkspace e2e testv7-devworkspace-happy-path
: DevWorkspace e2e test