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

Forward slash in branch name makes artifact inaccessible

      When multibranch project contains branch with forward slash in the name (for example `feature/foobar`) corresponding Job gets name `feature%2Ffoobar`  from multibranch pipeline plugin.

      artifact-manager-s3 plugin later uses this name to generate object key:
      https://github.com/jenkinsci/artifact-manager-s3-plugin/blob/master/src/main/java/io/jenkins/plugins/artifact_manager_jclouds/JCloudsArtifactManager.java#L98

      As a result generated artifact will be placed in directory hierarchy like this:

      projectname/feature%2Ffoobar/1/artifacts/example.txt

      However when we try to download this artifact via http url
      https://bucketname.s3.amazonaws.com/projectname/feature%2Ffoobar/1/artifacts/example.txt

      %2F will be converted to forward slash by browser and request fails with NoSuchKey error from AWS.

      When branch name doesn't contain forward slash everything works as expected

          [JENKINS-52151] Forward slash in branch name makes artifact inaccessible

          Andrei Lapshin created issue -

          Jesse Glick added a comment -

          To be clear, by “download” you mean using a browser download from within the web UI displaying artifacts, right?

          Need to verify that copyartifact / unarchive / unstash can perform downloads via presigned URL. That at least should be testable via ArtifactManagerTest.

          Jesse Glick added a comment - To be clear, by “download” you mean using a browser download from within the web UI displaying artifacts, right? Need to verify that copyartifact / unarchive / unstash can perform downloads via presigned URL. That at least should be testable via ArtifactManagerTest .
          Jesse Glick made changes -
          Remote Link New: This issue links to "CloudBees-internal issue (Web Link)" [ 21109 ]
          Jesse Glick made changes -
          Labels New: multibranch
          Priority Original: Minor [ 4 ] New: Major [ 3 ]

          > To be clear, by “download” you mean using a browser download from within the web UI displaying artifacts, right?

          No, I mean using ordinary web-browser and going directly to public S3 bucket using link manually constructed from bucket name, project name, branch name and job number.

          However when branch name contains forward slash there is no artifact section on build page at all so I can't check if presigned URLs work or not. In case when branch doesn't have slashes artifact section is present and links from there works fine.

          Regarding access  to artifacts in S3 directly (without going via Jenkins web UI). I don't know if this is currently supported use-case but it would be nice to have (even if it requires manual link generation).
          In our case I wanted to provide these links to QA-team (that don't have access to Jenkins UI) so that they could download them later for testing. Presigned URLs don't work in this situation since they only valid for limited time.

          Andrei Lapshin added a comment - > To be clear, by “download” you mean using a browser download from within the web UI displaying artifacts, right? No, I mean using ordinary web-browser and going directly to public S3 bucket using link manually constructed from bucket name, project name, branch name and job number. However when branch name contains forward slash there is no artifact section on build page at all so I can't check if presigned URLs work or not. In case when branch doesn't have slashes artifact section is present and links from there works fine. Regarding access  to artifacts in S3 directly (without going via Jenkins web UI). I don't know if this is currently supported use-case but it would be nice to have (even if it requires manual link generation). In our case I wanted to provide these links to QA-team (that don't have access to Jenkins UI) so that they could download them later for testing. Presigned URLs don't work in this situation since they only valid for limited time.

          Jesse Glick added a comment -

          Ah, download from the S3 web UI, that is another case I did not consider.

          Various Jenkins steps allow you to download an artifact from this or another build. Additionally, the https://jenkins/job/x/nnn/artifact/dir/file URL is supposed to serve a 301 redirect to a presigned URL you could use for other tools.

          Jesse Glick added a comment - Ah, download from the S3 web UI, that is another case I did not consider. Various Jenkins steps allow you to download an artifact from this or another build. Additionally, the https: //jenkins/job/x/nnn/artifact/dir/file URL is supposed to serve a 301 redirect to a presigned URL you could use for other tools.
          Jesse Glick made changes -
          Assignee New: Jesse Glick [ jglick ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Jesse Glick added a comment -

          In my tests, archiveArtifact, stash, and unstash all work; and I can download the artifact from the AWS Console; but unarchive and opening the artifacts view in the Jenkins UI both fail due to what I think is JCLOUDS-1401.

          Jesse Glick added a comment - In my tests, archiveArtifact , stash , and unstash all work; and I can download the artifact from the AWS Console; but unarchive and opening the artifacts view in the Jenkins UI both fail due to what I think is JCLOUDS-1401 .
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-50591 [ JENKINS-50591 ]

            jglick Jesse Glick
            alapshin Andrei Lapshin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: