Dynamic Specfile name and location

0

We're attempting to set up a generic CodeBuild project which will be executed from a CodePipeline job. While we are able to create a CodeBuild project which defines a specific file name and location to run, this is starting to lead towards multiple projects where the only difference is the name of the spec file.
Our question is whether or not we can create a generic CodeBuild project which has a dynamic specfile name and location? Such as can we set an environment variable that is passed from the pipeline to the build project?
Any insight into this and/or any best practices for achieving our goal would be appreciated.

CoryMcC
asked 4 years ago512 views
1 Answer
0

Hi CoryMcC,

Using a dynamic name for the buildspec.yml is not currently supported when using CodeBuild with CodePipeline, but filed this as a feature request.

However, CodePipeline does support passing environment variables to CodeBuild. If it is possible to model your build commands in a separate shell script, you could pass the path/name of the shell script in an environment variable, and then run a different script based on that variable.

You may additionally pass environment variables for other portions of the buildspec.yml, for example, the artifacts->paths specification supports environment variable expansion as well.

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions