Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/providers-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ Provider type: `codebuild`.
> pipeline to consume a custom image if required.
> Along with `repository_arn`, we also support a `tag` key which can be used
> to define which image should be used (defaults to `latest`).
>
> Image can also take an object that contains a reference to a
> public docker hub image such as `bitnami/mongodb`. This allows your
> pipeline to consume a public docker hub image if required.
> Along with the docker hub image name, we also support using a tag which can
> be provided after the docker hub image name to define which image should
> be used (defaults to `latest`).
>
- *size* *(String)* **(small|medium|large)** - default: `small`.
> The Compute type to use for the build, types can be found
> [here](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html).
Expand Down
16 changes: 16 additions & 0 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,22 @@ pipelines:
- ...
```

Public images from docker hub can be defined in your deployment map like so:

```yaml
pipelines:
- name: example-custom-image
default_providers:
source:
...
build:
provider: codebuild
properties:
image: bitnami/mongodb
targets:
- ...
```

### CloudFormation Parameters and Tagging

When you define CloudFormation templates as artifacts to push through a pipeline you might want to have a set of parameters associated with the templates. You can utilize the `params` folder in your repository to add in parameters as you see fit. To avoid having to create a parameter file for each of the stacks you wish to deploy to, you can create a parameter file called `global.yml` *(or .json)* any parameters defined in this file will be merged into the parameters for any specific account parameter file at build time. For example you might have a single parameter for a template called `CostCenter` the value of this will be the same across every deployment of your application however you might have another parameter called `InstanceType` that you want to be different per account. Using this example we can create a `global.yml` file that contains the following content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ def determine_build_spec(codebuild_id, default_props, target=None):
else DEFAULT_BUILD_SPEC_FILENAME
),
)

@staticmethod
def get_image_by_name(specific_image: str):
if hasattr(_codebuild.LinuxBuildImage,
(specific_image or DEFAULT_CODEBUILD_IMAGE).upper()):
return getattr(_codebuild.LinuxBuildImage,
(specific_image or DEFAULT_CODEBUILD_IMAGE).upper())
else:
return _codebuild.LinuxBuildImage.from_docker_registry(specific_image)

@staticmethod
def determine_build_image(scope, target, map_params):
Expand All @@ -183,10 +192,7 @@ def determine_build_image(scope, target, map_params):
repo_arn,
specific_image.get('tag', 'latest'),
)
return getattr(
_codebuild.LinuxBuildImage,
(specific_image or DEFAULT_CODEBUILD_IMAGE).upper(),
)
return CodeBuild.get_image_by_name(specific_image)

@staticmethod
def generate_build_env_variables(codebuild, shared_modules_bucket, map_params, target=None):
Expand Down