Jenkins pipeline: how to download artifacts with s3 plugin

I am trying to load artifacts into the s3 bucket after a successful build, but I can not find any working example that will be implemented in the stage / node block.

any idea (s3 plugin installed, jenkins v2.32)?

node {
  sh 'echo ""> 1.jar'
  archiveArtifacts artifacts: '1.jar', fingerprint: true
  // upload to s3 bucket ???
}    
+10
source share
3 answers

Looking at the Pipeline Documentation on the Jenkins website, it shows that the Pipeline AWS Plugin provides a step s3Upload.

+9
source

Try it:

s3Upload(file:'file.txt', bucket:'my-bucket', path:'path/to/target/file.txt')

, URL . .

S3, .

+5

:

  1. Pipeline AWS Plugin. Jenkins → → "" → " AWS". .

  2. . :

    Jenkins> > > ( ) →

    = AWS AWS

  3. Pipeline ( , )

    node {
    
        stage('Upload') {
    
            dir('path/to/your/project/workspace'){
    
                pwd(); //Log current directory
    
                withAWS(region:'yourS3Region',credentials:'yourIDfromStep2') {
    
                     def identity=awsIdentity();//Log AWS credentials
    
                    // Upload files from working directory 'dist' in your project workspace
                    s3Upload(bucket:"yourBucketName", workingDir:'dist', includePathPattern:'**/*');
                }
    
            };
        }
    }
    
+3

Source: https://habr.com/ru/post/1668959/


All Articles