-
Notifications
You must be signed in to change notification settings - Fork 243
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
Fixes export and execution of env variables for devfile commands #4267
Fixes export and execution of env variables for devfile commands #4267
Conversation
@mik-dass @kadel @adisky correct me if I'm doing something dumb here. Here's the devfile that I used: schemaVersion: 2.0.0
metadata:
name: nodejs
version: 1.0.0
alpha.build-dockerfile: "https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/nodejs/build/Dockerfile"
alpha.deployment-manifest: "https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/nodejs/deploy/deployment-manifest.yaml"
starterProjects:
- name: nodejs-starter
git:
remotes:
origin: "https://github.com/odo-devfiles/nodejs-ex.git"
components:
- name: runtime
container:
image: registry.access.redhat.com/ubi8/nodejs-12:1-45
memoryLimit: 1024Mi
mountSources: true
sourceMapping: /project
endpoints:
- name: http-3000
targetPort: 3000
commands:
- id: run
exec:
component: runtime
commandLine: "sh -c 'mkdir $foo'"
group:
kind: run
isDefault: true
env:
- name: foo
value: bar And here's the $ odo push
Validation
✓ Validating the devfile [34638ns]
Creating Kubernetes resources for component node-todo
✓ Waiting for component to start [6s]
Applying URL changes
✓ URL http-3000: http://http-3000-node-todo-buikmestmo.apps-crc.testing/ created
Syncing to component node-todo
✓ Checking files for pushing [680178ns]
✓ Syncing files to the component [243ms]
Executing devfile commands for component node-todo
✓ Executing run command "sh -c 'mkdir $foo'" [1s]
Pushing devfile component node-todo
✓ Changes successfully pushed to component But if I spin up another shell, the env var doesn't seem to persist: $ kubectl exec node-todo-5f5d5d5dd-7mcxm -- env | grep foo
ODO_COMMAND_RUN=export foo="bar" && sh -c 'mkdir $foo'
$ kubectl exec node-todo-5f5d5d5dd-7mcxm -- echo $foo Am I doing or expecting something that's out of place or doing something wrong here? |
d4033e4
to
7e98200
Compare
These env vars are only used during the execution of run, debug etc commands from the devfile. |
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dharmit, mik-dass 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 |
What type of PR is this?
/kind bug
What does does this PR do / why we need it:
Fixes export and execution of env variables for command in the devfile.
Which issue(s) this PR fixes:
Fixes #4232
PR acceptance criteria:
Unit test
Integration test
Documentation
I have read the test guidelines
How to test changes / Special notes to the reviewer: