MMStarr
MMStarr

Reputation: 151

CodeBuild extract in to folder in S3 bucket

I've been trying to navigate the CodeBuild docs to find an answer without any success.

I have a pipeline that pulls from github on commit and builds and deploys to S3. However, it takes the dist directory and just replaces anything currently in the bucket.

I wish to edit my buildspec to deploy to S3 in a folder named after the commit ID. Meaning CODEBUILD_RESOLVED_SOURCE_VERSION/...

Is there a way to do this in the buildspec.yml?

I want to keep a history of old builds in case I need to revert to an older.

Upvotes: 0

Views: 324

Answers (1)

MMStarr
MMStarr

Reputation: 151

Figured it out.

In the deployment stage of CodePipeline, add #{SourceVariables.CommitId} to the deployment path option.

Upvotes: 1

Related Questions