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

s3upload can't find file - Unable to calculate MD5 hash

XMLWordPrintable

      We have a windows slave with a linux master and when uploading to S3, we get "uploading file file:/c:/<path_to_zip>/whatever.zip to s3://artifacts/<repo_path_to_zip>/whatever.zip". It almost looks like it's trying to run from the master because of the "/" before the "c:/" in the file path. I'm not sure about that though so I've included the log below and my pipeline script. The file IS there and I was able to verify it is in the exact place it's looking on my windows slave, so I'm not (entirely) stupid.

      [Pipeline] s3Upload
      Uploading file file:/c:/jenkins/workspace/<zip_file>.zip to s3://ln-artifacts/<zip_file>.zip
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      com.amazonaws.SdkClientException: Unable to calculate MD5 hash: /c:/jenkins/workspace/<zip_file>.zip (No such file or directory)
      at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1587)
      at de.taimos.pipeline.aws.S3UploadStep$Execution$1.run(S3UploadStep.java:121)
      Caused by: java.io.FileNotFoundException: /c:/jenkins/workspace/<zip_file>.zip (No such file or 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 com.amazonaws.util.Md5Utils.computeMD5Hash(Md5Utils.java:97)
      at com.amazonaws.util.Md5Utils.md5AsBase64(Md5Utils.java:104)
      at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1583)
      ... 1 more
      Finished: FAILURE

      pipeline {
      agent any
      options

      { skipDefaultCheckout() }

      parameters

      { string (name : 'buildName') string (name : 'buildNumber') string (name : 'targetRepo') string (name : 'sourceRepo') string (name : 'sourcePath') booleanParam (name : 'publishToS3) }

      stages {
      stage('Promote') {
      steps {
      script

      { def server = Artifactory.server('artifactory') def promotionConfig = [ 'buildName' : buildName , 'buildNumber' : buildNumber , 'targetRepo' : targetRepo , 'copy' : true ] server.promote promotionConfig }

      }
      }
      stage('S3 Publish') {
      when {
      expression

      { return params.publishToS3 }

      }
      steps {
      script {
      def server = Artifactory.server('artifactory')
      def downloadSpec = """{
      "files": [

      { "pattern": "$sourceRepo/$sourcePath", "target": "$sourceRepo/" }

      ]
      }"""
      server.download(downloadSpec)
      }
      s3Upload(file : "$sourceRepo/$sourcePath", bucket : 'artifacts', path : "$sourceRepo/$sourcePath")

      }
      }
      }
      }

            hoegertn Thorsten Hoeger
            cjmead Corey Mead
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: