Skip to content

itsallcode/awsm-credentials-gradle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

awsm-credentials-gradle

Get AWS credentials for S3 maven repos from default AWS credentials provider chain

Usage

  1. Add this plugin to your project, see https://plugins.gradle.org/plugin/com.github.kaklakariada.awsm-credentials-gradle

    plugins {
      id "com.github.kaklakariada.awsm-credentials-gradle" version "0.2.1"
    }
  2. Configure your AWS credentials as named profiles in ~/.aws/credentials (not in ~/.aws/config). Use role_arn and source_profile for role delegation:

    [root-credentials]
    aws_access_key_id = ...
    aws_secret_access_key = ...
    
    [delegate-account1]
    role_arn = arn:aws:iam::<account>:role/<role name>
    source_profile = root-credentials
    
    [delegate-account2]
    role_arn = arn:aws:iam::<account>:role/<role name>
    source_profile = root-credentials
  3. Configure the AWS profile you want to use in ~/.gradle/gradle.properties:

    systemProp.aws.profile = delegate-account1
  4. Add S3 maven repositories without specifying credentials. The plugin will automatically add credentials for repositories with s3:// urls in all projects.

  • Dependency repositories:

    repositories {
       maven {
           url "s3://bucket/path/to/repo"
       }
    }
  • Publishing repositories:

    plugins {
        id "maven-publish"
    }
    publishing {
        repositories {
            maven {
                url "s3://bucket/path/to/repo"
            }
        }
        publications {
            // ...
        }
    }

Development

$ git clone https://github.com/hamstercommunity/awsm-credentials-gradle.git

Using eclipse

Import into eclipse using buildship plugin:

  1. Select File > Import... > Gradle > Gradle Project
  2. Click "Next"
  3. Select Project root directory
  4. Click "Finish"

Generate license file header

$ ./gradlew licenseFormatMain licenseFormatTest

See https://plugins.gradle.org/docs/submit for details.

  1. Add API Key from https://plugins.gradle.org to ~/.gradle/gradle.properties:

    gradle.publish.key = ...
    gradle.publish.secret = ...
    
  2. Run ./gradlew publishPlugins