Current Node version on IBM DevOps Delivery Pipeline lost in next stage





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















In the first stage of a Bluemix pipeline, by following approximately instructions from SO 42269590 and from the article I am able to get NVM installed and update to the latest version of nodejs with:



#!/bin/bash

echo " "
echo "= = = = = = = = = = = "
echo "PATH $PATH" | tr ':' 'n'

echo " "
echo "= = = = = = = = = = = "
echo "loading nvm ..."
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

# make nvm available immediately
export NVM_DIR="$HOME/.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

echo " "
echo "= = = = = = = = = = = "
echo "Is nvm installed?"
command -v nvm
nvm --version

# based on this recommendation in the error logs
# nvm is not compatible with the npm config "prefix" option: currently set to "/home/pipeline/.npm-global"
# Run `npm config delete prefix` or `nvm use --delete-prefix v11.2.0` to unset it.
echo " "
echo "= = = = = = = = = = = "
echo "config delete prefix..."
npm config delete prefix


echo " "
echo "= = = = = = = = = = = "
echo "Installing the latest version of nodejs"
nvm install node

# remember to add below directory name to
# Build Archive Directory field of this configuration
mkdir build_archive_dir

echo " "
echo "= = = = = = = = = = = "
echo "Which node version is it?"
node -v

echo " "
echo "= = = = = = = = = = = = = = = = = = ="
echo "prepare to load nvm in the next stage"
# do not do this with every build. It only needs to be added once.
#echo 'export NVM_DIR="$HOME/.nvm" ' >> /home/pipeline/.bashrc
#echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm ' >> /home/pipeline/.bashrc
#echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion ' >> /home/pipeline/.bashrc

echo " "
echo "= = = = = = = = = = = = = = = = = = ="
echo "contents of /home/pipeline/.bashrc:"
cat /home/pipeline/.bashrc

echo " "
echo "= = = = = = = = = = = = = = = = = = ="
currentDirectory=`pwd`
echo "Contents of directory "$currentDirectory
ls -al

echo " "


However, in the next pipeline stage I am expecting to be able to use my recently loaded node version. The problem is that nodejs latest is not enabled and reverted back to the original default nodejs version. Not only that but it appears the pipeline is editing the .bashrc file and removing lines added in the previous stage and removing the .nvm folder. Hmmm mmm, totally bizarre. There is not much sense in running a bash script in a stage, if the pipeline is going to undo all the work of the previous stage.



The next stage Input is set to Input Type : Build artifacts.



How can I keep the NVM updated node version available in the next stage?



This is not the first time that I have spent an exorbitant amount of time debugging bluemix, only to have switch to another provider that functions the way I need it to.





It turns out that by switching builder type to NPM and using the bluemix recommended script:



# To use Node.js 6.7.0, uncomment the following line:
export PATH=/opt/IBM/node-v6.7.0/bin:$PATH


the selected node version also is lost to the next stage of the pipeline, ie it has nothing to do with my long NVM script from above.










share|improve this question





























    0















    In the first stage of a Bluemix pipeline, by following approximately instructions from SO 42269590 and from the article I am able to get NVM installed and update to the latest version of nodejs with:



    #!/bin/bash

    echo " "
    echo "= = = = = = = = = = = "
    echo "PATH $PATH" | tr ':' 'n'

    echo " "
    echo "= = = = = = = = = = = "
    echo "loading nvm ..."
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

    # make nvm available immediately
    export NVM_DIR="$HOME/.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

    echo " "
    echo "= = = = = = = = = = = "
    echo "Is nvm installed?"
    command -v nvm
    nvm --version

    # based on this recommendation in the error logs
    # nvm is not compatible with the npm config "prefix" option: currently set to "/home/pipeline/.npm-global"
    # Run `npm config delete prefix` or `nvm use --delete-prefix v11.2.0` to unset it.
    echo " "
    echo "= = = = = = = = = = = "
    echo "config delete prefix..."
    npm config delete prefix


    echo " "
    echo "= = = = = = = = = = = "
    echo "Installing the latest version of nodejs"
    nvm install node

    # remember to add below directory name to
    # Build Archive Directory field of this configuration
    mkdir build_archive_dir

    echo " "
    echo "= = = = = = = = = = = "
    echo "Which node version is it?"
    node -v

    echo " "
    echo "= = = = = = = = = = = = = = = = = = ="
    echo "prepare to load nvm in the next stage"
    # do not do this with every build. It only needs to be added once.
    #echo 'export NVM_DIR="$HOME/.nvm" ' >> /home/pipeline/.bashrc
    #echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm ' >> /home/pipeline/.bashrc
    #echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion ' >> /home/pipeline/.bashrc

    echo " "
    echo "= = = = = = = = = = = = = = = = = = ="
    echo "contents of /home/pipeline/.bashrc:"
    cat /home/pipeline/.bashrc

    echo " "
    echo "= = = = = = = = = = = = = = = = = = ="
    currentDirectory=`pwd`
    echo "Contents of directory "$currentDirectory
    ls -al

    echo " "


    However, in the next pipeline stage I am expecting to be able to use my recently loaded node version. The problem is that nodejs latest is not enabled and reverted back to the original default nodejs version. Not only that but it appears the pipeline is editing the .bashrc file and removing lines added in the previous stage and removing the .nvm folder. Hmmm mmm, totally bizarre. There is not much sense in running a bash script in a stage, if the pipeline is going to undo all the work of the previous stage.



    The next stage Input is set to Input Type : Build artifacts.



    How can I keep the NVM updated node version available in the next stage?



    This is not the first time that I have spent an exorbitant amount of time debugging bluemix, only to have switch to another provider that functions the way I need it to.





    It turns out that by switching builder type to NPM and using the bluemix recommended script:



    # To use Node.js 6.7.0, uncomment the following line:
    export PATH=/opt/IBM/node-v6.7.0/bin:$PATH


    the selected node version also is lost to the next stage of the pipeline, ie it has nothing to do with my long NVM script from above.










    share|improve this question

























      0












      0








      0








      In the first stage of a Bluemix pipeline, by following approximately instructions from SO 42269590 and from the article I am able to get NVM installed and update to the latest version of nodejs with:



      #!/bin/bash

      echo " "
      echo "= = = = = = = = = = = "
      echo "PATH $PATH" | tr ':' 'n'

      echo " "
      echo "= = = = = = = = = = = "
      echo "loading nvm ..."
      curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

      # make nvm available immediately
      export NVM_DIR="$HOME/.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

      echo " "
      echo "= = = = = = = = = = = "
      echo "Is nvm installed?"
      command -v nvm
      nvm --version

      # based on this recommendation in the error logs
      # nvm is not compatible with the npm config "prefix" option: currently set to "/home/pipeline/.npm-global"
      # Run `npm config delete prefix` or `nvm use --delete-prefix v11.2.0` to unset it.
      echo " "
      echo "= = = = = = = = = = = "
      echo "config delete prefix..."
      npm config delete prefix


      echo " "
      echo "= = = = = = = = = = = "
      echo "Installing the latest version of nodejs"
      nvm install node

      # remember to add below directory name to
      # Build Archive Directory field of this configuration
      mkdir build_archive_dir

      echo " "
      echo "= = = = = = = = = = = "
      echo "Which node version is it?"
      node -v

      echo " "
      echo "= = = = = = = = = = = = = = = = = = ="
      echo "prepare to load nvm in the next stage"
      # do not do this with every build. It only needs to be added once.
      #echo 'export NVM_DIR="$HOME/.nvm" ' >> /home/pipeline/.bashrc
      #echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm ' >> /home/pipeline/.bashrc
      #echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion ' >> /home/pipeline/.bashrc

      echo " "
      echo "= = = = = = = = = = = = = = = = = = ="
      echo "contents of /home/pipeline/.bashrc:"
      cat /home/pipeline/.bashrc

      echo " "
      echo "= = = = = = = = = = = = = = = = = = ="
      currentDirectory=`pwd`
      echo "Contents of directory "$currentDirectory
      ls -al

      echo " "


      However, in the next pipeline stage I am expecting to be able to use my recently loaded node version. The problem is that nodejs latest is not enabled and reverted back to the original default nodejs version. Not only that but it appears the pipeline is editing the .bashrc file and removing lines added in the previous stage and removing the .nvm folder. Hmmm mmm, totally bizarre. There is not much sense in running a bash script in a stage, if the pipeline is going to undo all the work of the previous stage.



      The next stage Input is set to Input Type : Build artifacts.



      How can I keep the NVM updated node version available in the next stage?



      This is not the first time that I have spent an exorbitant amount of time debugging bluemix, only to have switch to another provider that functions the way I need it to.





      It turns out that by switching builder type to NPM and using the bluemix recommended script:



      # To use Node.js 6.7.0, uncomment the following line:
      export PATH=/opt/IBM/node-v6.7.0/bin:$PATH


      the selected node version also is lost to the next stage of the pipeline, ie it has nothing to do with my long NVM script from above.










      share|improve this question














      In the first stage of a Bluemix pipeline, by following approximately instructions from SO 42269590 and from the article I am able to get NVM installed and update to the latest version of nodejs with:



      #!/bin/bash

      echo " "
      echo "= = = = = = = = = = = "
      echo "PATH $PATH" | tr ':' 'n'

      echo " "
      echo "= = = = = = = = = = = "
      echo "loading nvm ..."
      curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

      # make nvm available immediately
      export NVM_DIR="$HOME/.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

      echo " "
      echo "= = = = = = = = = = = "
      echo "Is nvm installed?"
      command -v nvm
      nvm --version

      # based on this recommendation in the error logs
      # nvm is not compatible with the npm config "prefix" option: currently set to "/home/pipeline/.npm-global"
      # Run `npm config delete prefix` or `nvm use --delete-prefix v11.2.0` to unset it.
      echo " "
      echo "= = = = = = = = = = = "
      echo "config delete prefix..."
      npm config delete prefix


      echo " "
      echo "= = = = = = = = = = = "
      echo "Installing the latest version of nodejs"
      nvm install node

      # remember to add below directory name to
      # Build Archive Directory field of this configuration
      mkdir build_archive_dir

      echo " "
      echo "= = = = = = = = = = = "
      echo "Which node version is it?"
      node -v

      echo " "
      echo "= = = = = = = = = = = = = = = = = = ="
      echo "prepare to load nvm in the next stage"
      # do not do this with every build. It only needs to be added once.
      #echo 'export NVM_DIR="$HOME/.nvm" ' >> /home/pipeline/.bashrc
      #echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm ' >> /home/pipeline/.bashrc
      #echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion ' >> /home/pipeline/.bashrc

      echo " "
      echo "= = = = = = = = = = = = = = = = = = ="
      echo "contents of /home/pipeline/.bashrc:"
      cat /home/pipeline/.bashrc

      echo " "
      echo "= = = = = = = = = = = = = = = = = = ="
      currentDirectory=`pwd`
      echo "Contents of directory "$currentDirectory
      ls -al

      echo " "


      However, in the next pipeline stage I am expecting to be able to use my recently loaded node version. The problem is that nodejs latest is not enabled and reverted back to the original default nodejs version. Not only that but it appears the pipeline is editing the .bashrc file and removing lines added in the previous stage and removing the .nvm folder. Hmmm mmm, totally bizarre. There is not much sense in running a bash script in a stage, if the pipeline is going to undo all the work of the previous stage.



      The next stage Input is set to Input Type : Build artifacts.



      How can I keep the NVM updated node version available in the next stage?



      This is not the first time that I have spent an exorbitant amount of time debugging bluemix, only to have switch to another provider that functions the way I need it to.





      It turns out that by switching builder type to NPM and using the bluemix recommended script:



      # To use Node.js 6.7.0, uncomment the following line:
      export PATH=/opt/IBM/node-v6.7.0/bin:$PATH


      the selected node version also is lost to the next stage of the pipeline, ie it has nothing to do with my long NVM script from above.







      node.js ibm-cloud upgrade pipeline






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 26 '18 at 17:35









      NorthDecoderNorthDecoder

      106




      106
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Each stage has a clean environment by design. You can install into the stage and it is kept for all the jobs in that stage. You probably need to look into running multiple jobs as part of a stage, so that you can reuse the installed Node.js version. That would be a typical usage scenario.



          Another option is to us a custom Docker image as foundation for your stage.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53486309%2fcurrent-node-version-on-ibm-devops-delivery-pipeline-lost-in-next-stage%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Each stage has a clean environment by design. You can install into the stage and it is kept for all the jobs in that stage. You probably need to look into running multiple jobs as part of a stage, so that you can reuse the installed Node.js version. That would be a typical usage scenario.



            Another option is to us a custom Docker image as foundation for your stage.






            share|improve this answer




























              1














              Each stage has a clean environment by design. You can install into the stage and it is kept for all the jobs in that stage. You probably need to look into running multiple jobs as part of a stage, so that you can reuse the installed Node.js version. That would be a typical usage scenario.



              Another option is to us a custom Docker image as foundation for your stage.






              share|improve this answer


























                1












                1








                1







                Each stage has a clean environment by design. You can install into the stage and it is kept for all the jobs in that stage. You probably need to look into running multiple jobs as part of a stage, so that you can reuse the installed Node.js version. That would be a typical usage scenario.



                Another option is to us a custom Docker image as foundation for your stage.






                share|improve this answer













                Each stage has a clean environment by design. You can install into the stage and it is kept for all the jobs in that stage. You probably need to look into running multiple jobs as part of a stage, so that you can reuse the installed Node.js version. That would be a typical usage scenario.



                Another option is to us a custom Docker image as foundation for your stage.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 27 '18 at 9:46









                data_henrikdata_henrik

                9,55221031




                9,55221031
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53486309%2fcurrent-node-version-on-ibm-devops-delivery-pipeline-lost-in-next-stage%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    To store a contact into the json file from server.js file using a class in NodeJS

                    Redirect URL with Chrome Remote Debugging Android Devices

                    Dieringhausen