Skip to content

nvm being "installed" on jenkins-workspace hosts #988

Closed

Description

@rvagg

This in .bashrc on test-packetnet-ubuntu1604-x64-1

export NVM_DIR="$HOME/build/workspace/node-inspect@tmp/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Looks like something in the node-inspect job is fully installing nvm. Can we stop that cause it's screwing up bash cause that NVM_DIR isn't stable.

@maclover7 @refack who's is this?

Activity

  1. rvagg commented on Nov 8, 2017

    @rvagg
    MemberAuthor

    I've changed perms on .bashrc and .profile to 444 to prevent this happening again (crossing fingers that nvm isn't too clever)

  2. refack commented on Nov 8, 2017

    @refack
    Contributor

    who's is this?

    Ack, that's me.
    That job - https://ci.nodejs.org/job/node-inspect/ - is still in "beta" and hasn't landed yet (ATM only admins should have "run" capa) - #956.

    /CC @jkrems

  3. refack commented on Nov 8, 2017

    @refack
    Contributor

    Ping @ljharb is there a way to use nvm in a local scope, without it changing global state?

  4. self-assigned this
    on Nov 8, 2017
  5. hybrist commented on Nov 8, 2017

    @hybrist

    Ugh, changed NVM_HOME but forgot that its install script is messing with .bashrc w/o asking.

    @refack It's already installing it in local scope (that's why it's trying to load nvm from the workspace's tmp dir). The problem is that I'm running the install script instead of just git-cloning nvm into the directory myself.

  6. hybrist commented on Nov 8, 2017

    @hybrist

    Switching to direct git clone which should remove the side effect on bashrc: 1fb7b60

  7. ljharb commented on Nov 8, 2017

    @ljharb
    SponsorMember

    The primary purposes of the install script is to install nvm and update your profile files; a direct git clone works fine too.

    I'm confused tho why simply having those lines in bashrc would be a problem; unless you have a default alias specified, sourcing nvm.sh should be a noop.

  8. refack commented on Nov 8, 2017

    @refack
    Contributor

    The directory defined by export NVM_DIR="$HOME/build/workspace/node-inspect@tmp/.nvm" is ephemeral and when it's doesn't exist those statements return exit code 1.

  9. ljharb commented on Nov 8, 2017

    @ljharb
    SponsorMember

    They shouldn't; it's in a test - both lines are guarded by -s checks. The $NVM_DIR never has to exist; it's designed to gracefully do nothing in that case.

    Are you setting some sort of bash options that might make it abnormally exit nonzero?

  10. rvagg commented on Nov 8, 2017

    @rvagg
    MemberAuthor

    darn, I wish I had have saved the error output because I can't replicate it now by putting it back in. Basically I noticed this when I logged in as root and did su iojs to switch to that account and was confronted with 1/2 a screen of error messages, stack traces and whatnot.

    so my guess now is that $HOME/build/workspace/node-inspect@tmp/.nvm was partly intact so the bash was executing to load it, but something about the node installation wasn't, causing the problem. I'm pretty sure the error I was seeing was Node stack traces, so it was loading Node but not fully somehow?

  11. hybrist commented on Nov 8, 2017

    @hybrist

    Sorry for the confusion! Should've thought of that. :)

  12. refack commented on Nov 8, 2017

    @refack
    Contributor

    @jkrems I'm trying to learn from this. For example, we should do beta testing only on sandboxed bots.

  13. ljharb commented on Nov 8, 2017

    @ljharb
    SponsorMember

    It seems like the issue was that [ -s "$NVM_DIR/nvm.sh" ] will not, in fact, fail with set -e - but if it's the last line of .bashrc, it will cause the process to exit 1.

    A simple fix is to make the last line of .bashrc exit zero, perhaps by adding test ||: or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions