JSON on the command line with jq in Jenkinsnpm issues with uglify-jsHow to run builds in Docker containers...

Preventing Employees from either switching to Competitors or Opening Their Own Business

What should the arbiter and what should have I done in this case?

PhD - Well known professor or well known school?

What risks are there when you clear your cookies instead of logging off?

An average heaven where everyone has sexless golden bodies and is bored

Show that this function is bounded

Genetic limitations to learn certain instruments

What could have caused a rear derailleur to end up in the back wheel suddenly?

Does an ice chest packed full of frozen food need ice?

How did they achieve the Gunslinger's shining eye effect in Westworld?

Find the Factorial From the Given Prime Relationship

Random Unitary Matrices

Why is one of Madera Municipal's runways labelled with only "R" on both sides?

Do any instruments not produce overtones?

Dual boot macOS Catalina 10.15 and macOS Mojave 10.14

Smooth switching between 12 V batteries, with a toggle switch

Investing in a Roth IRA with a Personal Loan?

What makes Ada the language of choice for the ISS's safety-critical systems?

Were Alexander the Great and Hephaestion lovers?

Was there a priest on the Titanic who stayed on the ship giving confession to as many as he could?

Russian equivalents of "no love lost"

Taxi Services at Didcot

What can I, as a user, do about offensive reviews in App Store?

Should I compare a std::string to "string" or "string"s?



JSON on the command line with jq in Jenkins


npm issues with uglify-jsHow to run builds in Docker containers from JenkinsExecute commands without sudo inside jenkinsUnable to scp in JenkinsPermission denied in jenkinsIs it possible to download and configure jenkins with a script?Jenkins write permission on linuxJenkins on solaris operating systemcurl in Jenkins,find command fails in jenkins, but not in terminal






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I used jq -r '.version' package.json command to filter the version from package.json file using the terminal.



Can we use jq command in Jenkins shell without locally installing it?










share|improve this question
















bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1





    I don't think it is possible to use jq without installing it. if you don't want to install any additional tools to manipulate your JSON then you can use existing tools that are most likely installed in your system. You can use Python for the task.

    – ANIL
    Nov 9 '18 at 8:42













  • Could you expand on what you mean by "without locally installing"? jq's download page mentions that it has "no runtime dependencies", so it could be run as a standalone executable.

    – JigglyNaga
    Nov 9 '18 at 15:38




















0















I used jq -r '.version' package.json command to filter the version from package.json file using the terminal.



Can we use jq command in Jenkins shell without locally installing it?










share|improve this question
















bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1





    I don't think it is possible to use jq without installing it. if you don't want to install any additional tools to manipulate your JSON then you can use existing tools that are most likely installed in your system. You can use Python for the task.

    – ANIL
    Nov 9 '18 at 8:42













  • Could you expand on what you mean by "without locally installing"? jq's download page mentions that it has "no runtime dependencies", so it could be run as a standalone executable.

    – JigglyNaga
    Nov 9 '18 at 15:38
















0












0








0








I used jq -r '.version' package.json command to filter the version from package.json file using the terminal.



Can we use jq command in Jenkins shell without locally installing it?










share|improve this question
















I used jq -r '.version' package.json command to filter the version from package.json file using the terminal.



Can we use jq command in Jenkins shell without locally installing it?







shell node.js jenkins npm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 '18 at 10:17









Jeff Schaller

46.3k1166150




46.3k1166150










asked Nov 9 '18 at 5:59









JanithJanith

84




84





bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 1





    I don't think it is possible to use jq without installing it. if you don't want to install any additional tools to manipulate your JSON then you can use existing tools that are most likely installed in your system. You can use Python for the task.

    – ANIL
    Nov 9 '18 at 8:42













  • Could you expand on what you mean by "without locally installing"? jq's download page mentions that it has "no runtime dependencies", so it could be run as a standalone executable.

    – JigglyNaga
    Nov 9 '18 at 15:38
















  • 1





    I don't think it is possible to use jq without installing it. if you don't want to install any additional tools to manipulate your JSON then you can use existing tools that are most likely installed in your system. You can use Python for the task.

    – ANIL
    Nov 9 '18 at 8:42













  • Could you expand on what you mean by "without locally installing"? jq's download page mentions that it has "no runtime dependencies", so it could be run as a standalone executable.

    – JigglyNaga
    Nov 9 '18 at 15:38










1




1





I don't think it is possible to use jq without installing it. if you don't want to install any additional tools to manipulate your JSON then you can use existing tools that are most likely installed in your system. You can use Python for the task.

– ANIL
Nov 9 '18 at 8:42







I don't think it is possible to use jq without installing it. if you don't want to install any additional tools to manipulate your JSON then you can use existing tools that are most likely installed in your system. You can use Python for the task.

– ANIL
Nov 9 '18 at 8:42















Could you expand on what you mean by "without locally installing"? jq's download page mentions that it has "no runtime dependencies", so it could be run as a standalone executable.

– JigglyNaga
Nov 9 '18 at 15:38







Could you expand on what you mean by "without locally installing"? jq's download page mentions that it has "no runtime dependencies", so it could be run as a standalone executable.

– JigglyNaga
Nov 9 '18 at 15:38












1 Answer
1






active

oldest

votes


















0














To answer your question directly, no, you can't shell out to jq if it is not installed.



However, depending on exactly what you are doing, you don't even need jq at all.



If you are running a Jenkins Pipeline job:



def version = readJSON(file: 'package.json').version


If you are running a Groovy script using the Groovy Script web UI or using the Groovy-based cli.jar (I haven't tested this, so it probably needs some debugging):



import groovy.json.*

def jsonSlurper = new JsonSlurper()
def reader = new BufferedReader(new InputStreamReader(new FileInputStream('package.json'), 'UTF-8'))
def package = jsonSlurper.parse(reader)

def version = package.version





share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f480703%2fjson-on-the-command-line-with-jq-in-jenkins%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









    0














    To answer your question directly, no, you can't shell out to jq if it is not installed.



    However, depending on exactly what you are doing, you don't even need jq at all.



    If you are running a Jenkins Pipeline job:



    def version = readJSON(file: 'package.json').version


    If you are running a Groovy script using the Groovy Script web UI or using the Groovy-based cli.jar (I haven't tested this, so it probably needs some debugging):



    import groovy.json.*

    def jsonSlurper = new JsonSlurper()
    def reader = new BufferedReader(new InputStreamReader(new FileInputStream('package.json'), 'UTF-8'))
    def package = jsonSlurper.parse(reader)

    def version = package.version





    share|improve this answer




























      0














      To answer your question directly, no, you can't shell out to jq if it is not installed.



      However, depending on exactly what you are doing, you don't even need jq at all.



      If you are running a Jenkins Pipeline job:



      def version = readJSON(file: 'package.json').version


      If you are running a Groovy script using the Groovy Script web UI or using the Groovy-based cli.jar (I haven't tested this, so it probably needs some debugging):



      import groovy.json.*

      def jsonSlurper = new JsonSlurper()
      def reader = new BufferedReader(new InputStreamReader(new FileInputStream('package.json'), 'UTF-8'))
      def package = jsonSlurper.parse(reader)

      def version = package.version





      share|improve this answer


























        0












        0








        0







        To answer your question directly, no, you can't shell out to jq if it is not installed.



        However, depending on exactly what you are doing, you don't even need jq at all.



        If you are running a Jenkins Pipeline job:



        def version = readJSON(file: 'package.json').version


        If you are running a Groovy script using the Groovy Script web UI or using the Groovy-based cli.jar (I haven't tested this, so it probably needs some debugging):



        import groovy.json.*

        def jsonSlurper = new JsonSlurper()
        def reader = new BufferedReader(new InputStreamReader(new FileInputStream('package.json'), 'UTF-8'))
        def package = jsonSlurper.parse(reader)

        def version = package.version





        share|improve this answer













        To answer your question directly, no, you can't shell out to jq if it is not installed.



        However, depending on exactly what you are doing, you don't even need jq at all.



        If you are running a Jenkins Pipeline job:



        def version = readJSON(file: 'package.json').version


        If you are running a Groovy script using the Groovy Script web UI or using the Groovy-based cli.jar (I haven't tested this, so it probably needs some debugging):



        import groovy.json.*

        def jsonSlurper = new JsonSlurper()
        def reader = new BufferedReader(new InputStreamReader(new FileInputStream('package.json'), 'UTF-8'))
        def package = jsonSlurper.parse(reader)

        def version = package.version






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 17:31









        jayhendrenjayhendren

        5,53721647




        5,53721647






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f480703%2fjson-on-the-command-line-with-jq-in-jenkins%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

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...