Skip to content

feat: Switch internal service deploy command to deploy image digest under the hood (DBTP-3150) - #1564

Open
DeveloperConnor wants to merge 3 commits into
mainfrom
feature/DBTP-3150-deploy-sha
Open

feat: Switch internal service deploy command to deploy image digest under the hood (DBTP-3150)#1564
DeveloperConnor wants to merge 3 commits into
mainfrom
feature/DBTP-3150-deploy-sha

Conversation

@DeveloperConnor

Copy link
Copy Markdown
Contributor

Addresses https://uktrade.atlassian.net/browse/DBTP-3150.

platform-helper internal service deploy now deploys image digest to the ECS task definition, instead of tag. See ticket for further details behind reasoning.

Added unit test case to cover the new method, also manually tested by deploying to ECS and validating the resulting task definition.


Checklist:

Title:

Description:

  • Link to ticket included (unless it's a quick out of ticket thing)
  • Includes tests (or an explanation for why it doesn't)
  • If the work includes user interface changes, before and after screenshots included in description
  • Includes any applicable changes to the documentation in this code base
  • Includes link(s) to any applicable changes to the documentation in the DBT Platform Documentation (can be to a pull request)

Tasks:

Reviewer Checklist

  • I have reviewed the PR and ensured no secret values are present

@DeveloperConnor
DeveloperConnor requested a review from a team as a code owner July 15, 2026 12:23
@github-actions

Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

image_uri="563763463626.dkr.ecr.eu-west-2.amazonaws.com/some-app/web:latest"
)

assert digest == "sha256:123456"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we assert that batch_get_image got called with the right arguments too (so that the regex matching is testing)?

assert register_task_def_kwargs["service"] == "web"
assert register_task_def_kwargs["image_tag"] == "tag-123"
assert register_task_def_kwargs["task_definition"] == {"fakeTaskDefinition": "FAKE"}
assert register_task_def_kwargs["task_definition"] == {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be good to test the value of register_task_def_kwargs["image_digest"]

- [platform-helper secrets](#platform-helper-secrets)
- [platform-helper secrets create](#platform-helper-secrets-create)
- [platform-helper secrets copy](#platform-helper-secrets-copy)
- [platform-helper secrets list](#platform-helper-secrets-list)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this being added back in? Do you need to regenerate the docs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice spot, shouldn't be there

@ksugden

ksugden commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Once we upgrade our test tier (and maybe low tier) services, we should maybe run the codebase pipelines before rolling out to higher tiers

for container in task_definition["containerDefinitions"]:
if container["name"] == service:
image_digest = self.ecr_provider.get_image_digest_for_uri(
f"{container['image']}:{image_tag}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

so the containerDefinitions.image field in the task def doesn't already contain the tag?

return image_ref

def get_image_digest_for_uri(self, image_uri: str) -> str:
pattern = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what if it is like great, where they already use a sha?
123456789.dkr.ecr.eu-west-2.amazonaws.com/great/subfolder@sha256:123456789blablablaetcetcetc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants