Uploaded image for project: 'Jenkins Artifactory Plug-in'
  1. Jenkins Artifactory Plug-in
  2. HAP-1389

rtUpload step support for git submodules.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: 5 - Minor
    • Resolution: Done
    • Affects Version/s: 3.10.0
    • Fix Version/s: 3.10.1
    • Component/s: None
    • Labels:
      None

      Description

      ISSUE: On "rtUpload" step, the HEAD file from the .git folder is searched on the current working directory, whereas in the submodules concept there will be no ".git" directory but rather it will be a file which contains the reference to the original directory.

      Steps to Reproduce:

      • **Add any git repository as a submodule to any git project.
        "git submodule add https://github.com/<path>.git"
      • In the Jenkinsbuild, have the following configuration: 
        pipeline {
         agent any
         tools {
           maven "M3"
         }
        stages {
            stage('Build') {
               steps {
                 dir('<submodule_path>') {
                    sh 'mvn clean install -DskipTests=true'
                   rtUpload (
                      serverId: 'ARTIFACTORY_SERVER',
                      failNoOp: true,
                      spec: """{
                         "files": [
                            {
                             "pattern": "target/*.jar",
                              "target": "generic-local/test/"
                            }
                          ]
                      }"""
                   )
                 }
               }
            }
          }
        }
        

      This will produce the below error:

       

      java.io.FileNotFoundException: WORKDIR/SUBMODULE/.git/HEAD (Not a directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at java.io.FileReader.<init>(FileReader.java:72) at org.jfrog.build.extractor.clientConfiguration.util.GitUtils.getRevisionOrBranchPath(GitUtils.java:123) at org.jfrog.build.extractor.clientConfiguration.util.GitUtils.extractVcsRevision(GitUtils.java:78) at org.jfrog.build.extractor.clientConfiguration.util.GitUtils.extractVcs(GitUtils.java:38) at org.jfrog.hudson.pipeline.common.Utils$1.invoke(Utils.java:129) at org.jfrog.hudson.pipeline.common.Utils$1.invoke(Utils.java:127)
      

       

       

      It looks like we need to have a further check here. We need to check if it is actually a file or directory and if it is a file change the file to point to the content which is the link of the original file directory.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              eyalb Eyal Ben Moshe
              Reporter:
              satheeshb Satheesh Balachandran
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: