-
Notifications
You must be signed in to change notification settings - Fork 61
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
Cleanup PATH variable mangling #1026
Conversation
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
Dockerfile_mbtci_template
Outdated
@@ -212,6 +212,12 @@ RUN set -ex \ | |||
&& python2.7 --version \ | |||
&& python3 --version | |||
|
|||
# Allow global npm packages install without sudo | |||
RUN set -ex \ | |||
&& mkdir ${USER_HOME_DIR}/.npm-global \ |
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.
wonder why USER/USER_HOME_DIR instead of MTA_USER/MTA_USER_HOME is used!?
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.
Cut&paste typo ...
Thanks.
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
Dockerfile_mbtci_template
Outdated
RUN set -ex \ | ||
&& mkdir ${MTA_USER_HOME}/.npm-global \ | ||
&& chown -R ${MTA_USER}:${MTA_USER} ${MTA_USER_HOME} | ||
ENV NPM_CONFIG_PREFIX ${MTA_USER_HOME}/.npm-global |
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.
according to the spec it's
ENV <key>=<value>
does it work without the equal too?
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.
Both are working. The current Dockerfile use space, so let's keep it consistent with the style already used.
Dockerfile_mbtci_template
Outdated
&& mkdir ${MTA_USER_HOME}/.npm-global \ | ||
&& chown -R ${MTA_USER}:${MTA_USER} ${MTA_USER_HOME} | ||
ENV NPM_CONFIG_PREFIX ${MTA_USER_HOME}/.npm-global | ||
|
||
ENV PATH=$PATH:./node_modules/.bin HOME=${MTA_USER_HOME} |
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.
on the image i used i do not have this path entry:
mta@63fceb6d640d:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
is it intended that the root user has the home of mta?
root@b40df04c7063:/project# id
uid=0(root) gid=0(root) groups=0(root)
root@b40df04c7063:/project# echo $HOME
/home/mta
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.
It's not intended and a genuine security bug, and as well as the HOME env variable redefinition.
The PATH env variable mangling is buggy as hell in that Dockerfile. I plan to fix it but in another PR.
Thanks.
As stated in the PR description, yes, but for currently supported node.js/java versions combination. It does not include node 14 and java 8.
That PR is a duplicate of #1013 unrelated to the issue fixed here. |
Which node/java versions does it cover. we offer the following to the customer:
Unfortunately, the CICD service doesn't allow to easily switch to an arbitrary image. So we have to wait for the release of #1023, right? |
devxci/mbtci-java11-node14:
devxci/mbtci-java11-node16:
devxci/mbtci-java11-node18:
—
Only Java 8 based images are not yet shipped as images generated with the latest Dockerfile in that repo.
…--
Jerome BENOIT - SAP E-Mobility R&D Security and Software Engineer
SAP S/4HANA IC & Q2C ENG Europe III
SAP Labs France SAS, BP1216,805 Av. du Dr. Maurice Donat, 06254 Mougins Cedex, France
***@***.*** - +33 6 35 50 78 40
OpenPGP Key ID : 27B535D3
Key fingerprint : B799 BBF6 8EC8 911B B8D7 CDBC C3B1 92C6 27B5 35D3
Please consider the impact on the environment before printing this email.
|
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.
LGTM
@young-yang03: I think the Since that PR can't cause any regressions as as long as npm -g is used, it's fine to merge it, ship the images and let @rodibrin confirm it works. |
@rodibrin: Have you also tested the node 16 java variant: https://hub.docker.com/repository/docker/fraggle0/mbt-node16-java8-docker/general? |
Test of
|
Ok, thanks. I'm pushing the test images with the directory pre-creation. Dunno why npm does not properly populate it with latest version. Could you please re-test? |
test succeeded:
|
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
Description
Checklist