Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-8797

Add support for retrieving job configuration via Jenkins CLI

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Component/s: cli
    • Labels:
      None

      Description

      The Jenkins CLI is missing support for retrieving the configuration of a job. The http://jenkins/job/name/config.xml URL only works when no authentication/authorization is required to access the file. The new command for the Jenkins CLI would complement the already existing create-job command.

        Activity

        sebastian_bergmann sebastian_bergmann created issue -
        Hide
        anthonyjeffery anthonyjeffery added a comment -

        I am also interested in this. In addition to getting the job config via CLI, we also need capability to set the job config via CLI. This is a legit use case for several of my customers and a CLI capability which other CI toolkits include.

        Parameters to the edit-job would be the job name and/or updated xml file on the filesystem. Seems easy to implement.

        -Anthony

        Show
        anthonyjeffery anthonyjeffery added a comment - I am also interested in this. In addition to getting the job config via CLI, we also need capability to set the job config via CLI. This is a legit use case for several of my customers and a CLI capability which other CI toolkits include. Parameters to the edit-job would be the job name and/or updated xml file on the filesystem. Seems easy to implement. -Anthony
        Hide
        mfriedenhagen Mirko Friedenhagen added a comment - - edited

        Hm, curl -u USERNAME http://jenkins/job/name/config.xml works for me. curl wants me to enter the password then or I could provide it via -uUSERNAME:PASSWORD.

        Show
        mfriedenhagen Mirko Friedenhagen added a comment - - edited Hm, curl -u USERNAME http://jenkins/job/name/config.xml works for me. curl wants me to enter the password then or I could provide it via -uUSERNAME:PASSWORD .
        Hide
        kscheer Karl Scheer added a comment - - edited

        Additionally, if you want to use wget, you can use

        wget --user=username --password=password http://jenkins/job/name/config.xml.

        This also works for the node toggleOffline command.

        Show
        kscheer Karl Scheer added a comment - - edited Additionally, if you want to use wget, you can use wget --user=username --password=password http://jenkins/job/name/config.xml . This also works for the node toggleOffline command.
        Hide
        scm_issue_link SCM/JIRA link daemon added a comment -

        Code changed in jenkins
        User: Kohsuke Kawaguchi
        Path:
        changelog.html
        core/src/main/java/hudson/cli/GetJobXmlCommand.java
        core/src/main/java/hudson/cli/UpdateJobXmlCommand.java
        core/src/main/java/hudson/model/AbstractItem.java
        http://jenkins-ci.org/commit/jenkins/6b2af9157a45d26f549bd2279d0f57fe8484bef9
        Log:
        [FIXED JENKINS-8797] added CLI commands to manipulate jobs by their XML
        definitions.

        Compare: https://github.com/jenkinsci/jenkins/compare/297aff0...6b2af91

        Show
        scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html core/src/main/java/hudson/cli/GetJobXmlCommand.java core/src/main/java/hudson/cli/UpdateJobXmlCommand.java core/src/main/java/hudson/model/AbstractItem.java http://jenkins-ci.org/commit/jenkins/6b2af9157a45d26f549bd2279d0f57fe8484bef9 Log: [FIXED JENKINS-8797] added CLI commands to manipulate jobs by their XML definitions. Compare: https://github.com/jenkinsci/jenkins/compare/297aff0...6b2af91
        scm_issue_link SCM/JIRA link daemon made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        dogfood dogfood added a comment -

        Integrated in jenkins_main_trunk #1038
        [FIXED JENKINS-8797] added CLI commands to manipulate jobs by their XML

        Kohsuke Kawaguchi : 6b2af9157a45d26f549bd2279d0f57fe8484bef9
        Files :

        • changelog.html
        • core/src/main/java/hudson/cli/UpdateJobXmlCommand.java
        • core/src/main/java/hudson/model/AbstractItem.java
        • core/src/main/java/hudson/cli/GetJobXmlCommand.java
        Show
        dogfood dogfood added a comment - Integrated in jenkins_main_trunk #1038 [FIXED JENKINS-8797] added CLI commands to manipulate jobs by their XML Kohsuke Kawaguchi : 6b2af9157a45d26f549bd2279d0f57fe8484bef9 Files : changelog.html core/src/main/java/hudson/cli/UpdateJobXmlCommand.java core/src/main/java/hudson/model/AbstractItem.java core/src/main/java/hudson/cli/GetJobXmlCommand.java
        Hide
        scm_issue_link SCM/JIRA link daemon added a comment -

        Code changed in jenkins
        User: Kohsuke Kawaguchi
        Path:
        changelog.html
        core/src/main/java/hudson/cli/GetJobXmlCommand.java
        core/src/main/java/hudson/cli/UpdateJobXmlCommand.java
        core/src/main/java/hudson/model/AbstractItem.java
        http://jenkins-ci.org/commit/jenkins/6b2af9157a45d26f549bd2279d0f57fe8484bef9
        Log:
        [FIXED JENKINS-8797] added CLI commands to manipulate jobs by their XML
        definitions.

        Show
        scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html core/src/main/java/hudson/cli/GetJobXmlCommand.java core/src/main/java/hudson/cli/UpdateJobXmlCommand.java core/src/main/java/hudson/model/AbstractItem.java http://jenkins-ci.org/commit/jenkins/6b2af9157a45d26f549bd2279d0f57fe8484bef9 Log: [FIXED JENKINS-8797] added CLI commands to manipulate jobs by their XML definitions.
        Hide
        scm_issue_link SCM/JIRA link daemon added a comment -

        Code changed in jenkins
        User: Kohsuke Kawaguchi
        Path:
        changelog.html
        core/src/main/java/hudson/cli/GetJobXmlCommand.java
        core/src/main/java/hudson/cli/UpdateJobXmlCommand.java
        core/src/main/java/hudson/model/AbstractItem.java
        http://jenkins-ci.org/commit/jenkins/6b2af9157a45d26f549bd2279d0f57fe8484bef9
        Log:
        [FIXED JENKINS-8797] added CLI commands to manipulate jobs by their XML
        definitions.

        Show
        scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html core/src/main/java/hudson/cli/GetJobXmlCommand.java core/src/main/java/hudson/cli/UpdateJobXmlCommand.java core/src/main/java/hudson/model/AbstractItem.java http://jenkins-ci.org/commit/jenkins/6b2af9157a45d26f549bd2279d0f57fe8484bef9 Log: [FIXED JENKINS-8797] added CLI commands to manipulate jobs by their XML definitions.

          People

          • Assignee:
            Unassigned
            Reporter:
            sebastian_bergmann sebastian_bergmann
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: