insert AWS credentials directly
We can pass credentials directly in format:
aws_sercret_key_id:aws_secret_access_key
Please keep in mind this feature breaks basic security and credentials
passed this way will be accessible in job parameters.
Change-Id: I7aab051e4a9ff77aaaa93e93e8b31e9d376099dc
diff --git a/src/com/mirantis/mk/Aws.groovy b/src/com/mirantis/mk/Aws.groovy
index fc64c25..742185e 100644
--- a/src/com/mirantis/mk/Aws.groovy
+++ b/src/com/mirantis/mk/Aws.groovy
@@ -16,14 +16,28 @@
python.setupVirtualenv(venv_path, 'python2', requirements)
}
-def getEnvVars(credentials_id, region = 'us-west-2') {
+def getEnvVars(credentials, region = 'us-west-2') {
def common = new com.mirantis.mk.Common()
- def creds = common.getCredentials(credentials_id)
+ def creds
+ def username
+ def password
+
+ if (credentials.contains(':')) {
+ // we have key and secret in string (delimited by :)
+ creds = credentials.tokenized(':')
+ username = creds[0]
+ password = creds[0]
+ } else {
+ // we have creadentials_id
+ creds = common.getCredentials(credentials)
+ username = creds.username
+ password = creds.password
+ }
return [
- "AWS_ACCESS_KEY_ID=${creds.username}",
- "AWS_SECRET_ACCESS_KEY=${creds.password}",
+ "AWS_ACCESS_KEY_ID=${username}",
+ "AWS_SECRET_ACCESS_KEY=${password}",
"AWS_DEFAULT_REGION=${region}"
]
}