Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -231,6 +231,14 @@ Provider type: `codebuild`.
> Along with `repository_arn`, we also support a `tag` key which can be used
> to define which image should be used (defaults to `latest`).
> An example of this setup is provided [here](https://github.com/awslabs/aws-deployment-framework/blob/master/docs/user-guide.md#custom-build-images).
>
> Image can also take an object that contains a reference to a
> public docker hub image with a prefix of `docker-hub://`, such as
> `docker-hub://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 such as `docker-hub://bitnami/mongodb:3.6.23`
> in order 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: docker-hub://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 @@ -160,6 +160,21 @@ def determine_build_spec(codebuild_id, default_props, target=None):
),
)

@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())
if specific_image.startswith('docker-hub://'):
specific_image = specific_image.split('docker-hub://')[-1]
return _codebuild.LinuxBuildImage.from_docker_registry(specific_image)
raise Exception(
"The CodeBuild image {0} could not be found.".format(
specific_image
),
)

@staticmethod
def determine_build_image(scope, target, map_params):
specific_image = None
Expand All @@ -184,10 +199,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