Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

SSE-2685: Disambiguate SAM and Docker build paths #8

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CharlesIC
Copy link
Member

@CharlesIC CharlesIC commented Aug 23, 2023

Description

Disambiguate SAM and Docker build paths

This action builds two things (SAM app and a Docker image) and therefore needs two build directories, defaulting to the current dir, as we cannot assume they're the same.

We already have a docker build path so replace the "working dir" with the SAM base dir to avoid confusion. The singular "working directory" is confusing and misunderstood, which causes breaking changes to the action being made.

For Docker, allow dockerfile and docker path to be different since the dockerfile doesn't necessarily always reside in the docker path so the filename cannot be prefixed with the build path by default - use the docker build args accordingly.

Allow the SAM template file to be different than the base build dir - the path from which SAM resources are resolved is not always the same as the template file, which is the default, therefore the --base-dir param must be used.

Don't cd into any directory as the current working dir is set by the calling workflow and it's unexpected behaviour to cd away from it.

Set default working dirs in the script as the "." default value doesn't get carried to the script env vars. Handle default value of null in the script itself.

Ticket number

SSE-2685

Checklist

  • I have updated the changelog

  • I have tested this and added output to Jira
    Comment:

A workflow run where this version of the action is used - the action succeeds (the overall workflow fails due to an unrelated issue)
https://github.com/alphagov/di-onboarding-self-service-experience/actions/runs/5951180253/job/16140513640#step:2:573

  • Documentation added (link)
    Comment:

@CharlesIC CharlesIC force-pushed the sse-2732-ecr-in-dev branch from 5f42cdf to 674635e Compare August 23, 2023 07:16
@CharlesIC CharlesIC changed the title SSE-2685: Make container signing optional SSE-2685: Allow dockerpath and dockerfile to be different Aug 23, 2023
@CharlesIC CharlesIC force-pushed the sse-2732-ecr-in-dev branch 3 times, most recently from 2381f69 to 0903dd2 Compare August 23, 2023 07:23
@CharlesIC CharlesIC marked this pull request as draft August 23, 2023 07:27
@CharlesIC CharlesIC force-pushed the sse-2732-ecr-in-dev branch 6 times, most recently from e7dfefa to d9a1e1d Compare August 23, 2023 11:42
This action builds two things (SAM app and a Docker image) and therefore needs two build directories, defaulting to the current dir, as we cannot assume they're the same.

We already have a docker build path so replace the "working dir" with the SAM base dir to avoid confusion. The singular "working directory" is confusing and misunderstood, which causes breaking changes to the action being made.

For Docker, allow dockerfile and docker path to be different since the dockerfile doesn't necessarily always reside in the docker path so the filename cannot be prefixed with the build path by default - use the docker build args accordingly.

Allow the SAM template file to be different than the base build dir - the path from which SAM resources are resolved is not always the same as the template file, which is the default, therefore the --base-dir param must be used.

Don't cd into any directory as the current working dir is set by the calling workflow and it's unexpected behaviour to cd away from it.

Set default working dirs in the script
The "." default value doesn't get carried to the script env vars. Handle default value of null in the script itself.
@CharlesIC CharlesIC force-pushed the sse-2732-ecr-in-dev branch from d9a1e1d to 0645481 Compare August 23, 2023 11:57
@CharlesIC CharlesIC changed the title SSE-2685: Allow dockerpath and dockerfile to be different SSE-2685: Disambiguate SAM and Docker build paths Aug 23, 2023
This action builds two things (SAM app and a Docker image) and therefore needs two build directories, defaulting to the current dir, as we cannot assume they're the same.

We already have a docker build path so replace the "working dir" with the SAM base dir to avoid confusion. The singular "working directory" is confusing and misunderstood, which causes breaking changes to the action being made.

The working-directory input is retained for backwards compatibility and is used as the SAM build dir if the new param is not set.

For Docker, allow dockerfile and docker path to be different since the dockerfile doesn't necessarily always reside in the docker path so the filename cannot be prefixed with the build path by default - use the docker build args accordingly.

Allow the SAM template file to be different than the base build dir - the path from which SAM resources are resolved is not always the same as the template file, which is the default, therefore the --base-dir param must be used.

Don't cd into any directory as the current working dir is set by the calling workflow and it's unexpected behaviour to cd away from it.

Set default working dirs in the script
The "." default value doesn't get carried to the script env vars. Handle default value of null in the script itself.
@CharlesIC CharlesIC marked this pull request as ready for review August 23, 2023 12:27
template-file:
description: "The name of the CF template for the application. This defaults to template.yaml"
required: false
default: template.yaml
working-directory:
description: "The working directory containing the app"
description: "Deprecated - use sam-base-directory instead"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a breaking change and will we need a new major release? Can you update the readme also :)

@monhaque monhaque marked this pull request as draft September 15, 2023 10:39
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants