I have an existing CodePipeline which listens to changes to a CodeCommit repository and triggers a CodeBuild of a build project with specific environment variables and a specific artifact upload location. Is there a way to create another CodeBuild step where the same build project is run but with overridden environment variables and another artifact upload location, or will I have to create another build project with these settings?
You can set up the CodeBuild project to allow the build to override artifact names when using S3 as the artifact location. Each artifact has a OverrideArtifactName
(in the console it is a checkbox called 'Enable semantic versioning') property that is a boolean. If you set this to true
the buildspec
will need to specify the name of the file in the artifacts
section. While this field is called name
, it can include the path as well. That means that you can calculate the name (including the path) based on values inside the build spec (including using environment variables).