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

API to read a single file from the repository

    XMLWordPrintable

Details

    • frank, tethys, christmas

    Description

      Requirements

      • Read natively from any branch of a Git repository hosted on Github
      • Read from any branch of a Git repository
      • Must maintain compatibility with Jenkins 2.7.1 and above

      Desired user experience

      Notes
      jglick said there is beginnings of this in the scm-api but no implementations.

      Attachments

        Issue Links

          Activity

            michaelneale Michael Neale added a comment -

            hrmpw currently it is missing returning the content sha to allow saving back to github - Vivek is looking if we can calculate this to make it unnecessary, otherwise we won't be able to use it for the purposes of load/save just yet.

            michaelneale Michael Neale added a comment - hrmpw currently it is missing returning the content sha to allow saving back to github - Vivek is looking if we can calculate this to make it unnecessary, otherwise we won't be able to use it for the purposes of load/save just yet.
            jglick Jesse Glick added a comment -

            michaelneale that is tracked as JENKINS-42080.

            jglick Jesse Glick added a comment - michaelneale that is tracked as JENKINS-42080 .
            michaelneale Michael Neale added a comment -

            jglick I probably worded that poorly - the sha is required at some point or else you won't be able to save back any changes.
            In theory this can be calculated, but github don't specify the 11 secret herbs and spices for how it is calculated.

            All I found was this: http://stackoverflow.com/questions/39873507/how-to-calculate-sha-from-a-string-with-the-github-api-in-python

            which uses a string involving "blob" and length (wut? why?) - which implies they may change how it is calculated, and that is why they return it on content load.

            So it may be required on load (hopefully not though).

            michaelneale Michael Neale added a comment - jglick I probably worded that poorly - the sha is required at some point or else you won't be able to save back any changes. In theory this can be calculated, but github don't specify the 11 secret herbs and spices for how it is calculated. All I found was this: http://stackoverflow.com/questions/39873507/how-to-calculate-sha-from-a-string-with-the-github-api-in-python which uses a string involving "blob" and length (wut? why?) - which implies they may change how it is calculated, and that is why they return it on content load. So it may be required on load (hopefully not though).
            vivek Vivek Pandey added a comment -

            I have opened to get GitHub API returned data (sha included), https://issues.jenkins-ci.org/browse/JENKINS-42270. We definitely need sha and other elements returned by GitHub should be pretty much pass thru, otherwise it defeats the purpose of consumers who are really interested in getting content data specific to GitHub.

            For now I am using 'git' way of computing sha, its a hack for now as who knows git changes it in future, better I get it from upstream library/github directly:

            DigestUtils.sha1Hex("blob " + data.length() + "\0" + data)
            
            vivek Vivek Pandey added a comment - I have opened to get GitHub API returned data (sha included), https://issues.jenkins-ci.org/browse/JENKINS-42270 . We definitely need sha and other elements returned by GitHub should be pretty much pass thru, otherwise it defeats the purpose of consumers who are really interested in getting content data specific to GitHub. For now I am using 'git' way of computing sha, its a hack for now as who knows git changes it in future, better I get it from upstream library/github directly: DigestUtils.sha1Hex( "blob " + data.length() + "\0" + data)
            michaelneale Michael Neale added a comment - - edited

            Ah right - yes it is a git standard, of course. Of course sha1 is topical this week...

            In any case, this ticket can be closed, I consider it done (now have seen it working). There is a follow on for github specific fields/properties which isn't needed right now.

            michaelneale Michael Neale added a comment - - edited Ah right - yes it is a git standard, of course. Of course sha1 is topical this week... In any case, this ticket can be closed, I consider it done (now have seen it working). There is a follow on for github specific fields/properties which isn't needed right now.

            People

              stephenconnolly Stephen Connolly
              jamesdumay James Dumay
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: