-
Notifications
You must be signed in to change notification settings - Fork 667
Support custom builder image environment variables in edit flow #10593
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
Support custom builder image environment variables in edit flow #10593
Conversation
|
/retest |
|
/cc |
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.
(remove duplicate)
christoph-jerolimov
left a comment
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.
@rottencandy Found an issue: When editing the npm start command and saving the Deployment, the BuildConfig environment variables were added and not replaced:
Can you also add some unit tests for BuilderImageEnvironments? :)
6ba9ca1 to
5cf1c6a
Compare
5cf1c6a to
a5ae128
Compare
|
Fixed duplicating envs and added tests. |
|
/retest-required |
|
Propagating Docs & PX ack labels from epic ODC-6266 /label docs-approved |
|
/retest |
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.
As discussed in slack (only as info for other reviews) that the merge here doesn't allow the user to unset the "Start command" at the moment. It is automatically restored from the collapsed environment variables.
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.
Updated to hide envs from build config section, and to not pick emptied fields.
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 personally would use the customEnvs first and then override it with user envs, but that's a big IMHO and I wouldn't add this comment if I didn't find the "not saving" issue above. :)
a5ae128 to
0239a4f
Compare
f9460a5 to
bd7feea
Compare
christoph-jerolimov
left a comment
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.
Small bug found when saving a Deployment without npm start command.
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 editing a Deployment with a BuildConfig environment variable (A=a) and no npm start command (no NPM_RUN) it was not possible to to save the edit form. It shows "Cannot convert undefined or null to object"
This happens when building the buildEnvs because imageEnv is undefined.
I think this would help but any solution is fine for me! :)
| const customBuildEnvs = imageEnv | |
| const customEnvs = imageEnv | |
| ? Object.keys(imageEnv) | |
| .filter((k) => !!imageEnv[k]) | |
| .map((k) => ({ name: k, value: imageEnv[k] })) | |
| : []; | |
| const buildEnvs = env.filter( | |
| (buildEnv) => !Object.keys(imageEnv).some((envKey) => buildEnv.name === envKey), | |
| ); | |
| const imageEnvKeys = imageEnv ? Object.keys(imageEnv) : []; | |
| const customEnvs = imageEnvKeys | |
| .filter((k) => !!imageEnv[k]) | |
| .map((k) => ({ name: k, value: imageEnv[k] })); | |
| const buildEnvs = env.filter( | |
| (buildEnv) => !imageEnvKeys.some((envKey) => buildEnv.name === envKey), | |
| ); |
Or could we simplify this by extracting buildEnvs with an imageEnvKeys?.includes(buildEnv.name) instead of .some? Not 100% sure.
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.
Thanks, I forgot it could be undefined. Updated.
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.
Not necessary change or?
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.
Was testing this but did not revert : p
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 personally would use the customEnvs first and then override it with user envs, but that's a big IMHO and I wouldn't add this comment if I didn't find the "not saving" issue above. :)
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.
Nit. Can we also check that it only exists once? Wdyt?
(Again, only add this comment because you need to touch the PR anyway because saving doesn't work when start command is not defined.)
| cy.get(`input[data-test="pairs-list-name"][value="${envKey}"]`).should('exist'); | |
| cy.get(`input[data-test="pairs-list-value"][value="${envVal}"]`).should('exist'); | |
| cy.get(`input[data-test="pairs-list-name"][value="${envKey}"]`).should('have.length', 1) | |
| cy.get(`input[data-test="pairs-list-value"][value="${envVal}"]`).should('have.length', 1) |
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.
Updated.
bd7feea to
a044195
Compare
|
/retest |
1 similar comment
|
/retest |
|
Tested this locally and on a cluster created with cluster bot. Tested many cases with and without, changing and deleting the npm "Start command". Works fine. 👍 /approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jerolimov, rottencandy The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest-required Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
|
/retest-required Please review the full test history for this PR and help us cut down flakes. |
|
@rottencandy: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |

Fixes:
https://issues.redhat.com/browse/ODC-6414
Description:
This is a follow up of #10331. Adds support for setting builder image environments defined by the ImportEnvironment extension to be loaded and shown in edit application form.
Unit test coverage report:
Test setup:
Browser conformance: