Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save darinpope/443f1d54b09b914fbeb59e5a12bf6dc1 to your computer and use it in GitHub Desktop.
Save darinpope/443f1d54b09b914fbeb59e5a12bf6dc1 to your computer and use it in GitHub Desktop.

Gist to support https://www.youtube.com/watch?v=u6LF-T-daS4

Documentation

Jenkinsfile

pipeline {
  agent any
  options {
    buildDiscarder(logRotator(numToKeepStr: '5'))
    durabilityHint('PERFORMANCE_OPTIMIZED')
    disableConcurrentBuilds()
  }
  stages{
    stage('build') {
      steps {
        sh 'echo "Hello World" > hello.txt'
      }
    }
    stage('archive') {
      steps {
        archiveArtifacts(artifacts: '**/*.txt', followSymlinks: false)
      }
    }
  }
}

AWS IAM policy

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetBucketLocation",
        "s3:ListAllMyBuckets"
      ],
      "Resource": "arn:aws:s3:::*"
    },
    {
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::dpope-jenkins-archiveartifacts"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::dpope-jenkins-archiveartifacts/*"
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment