Skip to content

Commit

Permalink
Updating S3 create to work by using defaults when there is no existin… (
Browse files Browse the repository at this point in the history
#59)

* Updating S3 create to work by using defaults when there is no existing herman configuration bucket. Also updating travis config to include jar file in the GH release.

* adding more specific exception handling and logging
  • Loading branch information
binaryblake authored Dec 10, 2018
1 parent 34c45c8 commit 4a763d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ notifications:
deploy:
- provider: releases
api_key: $GH_DEPLOY_TOKEN
file: target/herman-bamboo-plugin-$BUILD_VERSION.jar
file: target/herman-$BUILD_VERSION.jar
skip_cleanup: true
on:
repo: libertymutual/herman
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.libertymutualgroup.herman.aws.credentials.CredentialsHandler;
import com.libertymutualgroup.herman.aws.ecs.PropertyHandler;
import com.libertymutualgroup.herman.aws.ecs.broker.s3.BucketMeta;
import com.libertymutualgroup.herman.aws.ecs.broker.s3.S3Broker;
import com.libertymutualgroup.herman.aws.ecs.broker.s3.S3BrokerProperties;
import com.libertymutualgroup.herman.aws.ecs.broker.s3.S3CreateContext;
import com.libertymutualgroup.herman.aws.ecs.broker.s3.S3EncryptionOption;
import com.libertymutualgroup.herman.cli.Cli;
import com.libertymutualgroup.herman.logging.HermanLogger;
import com.libertymutualgroup.herman.task.s3.S3CreateTaskProperties;
Expand Down Expand Up @@ -74,7 +77,15 @@ public void executeS3Task(

PropertyHandler propertyHandler = propertyHandlerUtil.getCliPropertyHandler(sessionCredentials, logger, environmentName, absPath, customVariables);

S3CreateTaskProperties properties = configurationUtil.getConfigProperties(sessionCredentials, logger, region, S3CreateTaskProperties.class);
S3CreateTaskProperties properties;

try {
properties = configurationUtil.getConfigProperties(sessionCredentials, logger, region, S3CreateTaskProperties.class);
} catch(AmazonS3Exception ex) {
logger.addLogEntry("Could not locate existing herman configuaration bucket, continuing with defaults.");
S3BrokerProperties brokerProperties = new S3BrokerProperties().withDefaultEncryption(S3EncryptionOption.AES256);
properties = new S3CreateTaskProperties().withS3(brokerProperties);
}

S3CreateContext s3CreateContext = new S3CreateContext().withPropertyHandler(propertyHandler).withLogger(logger).withRegion(region).withRootPath(absPath).withSessionCredentials(sessionCredentials).withTaskProperties(properties).withFileUtil(new FileUtil(absPath, logger));

Expand Down

0 comments on commit 4a763d2

Please sign in to comment.