Skip to content

use AWS ERC - #2985

Merged
a777m merged 4 commits into
mainfrom
a777m/devx-logs-changes
Nov 6, 2026
Merged

a777m merged 4 commits into
mainfrom
a777m/devx-logs-changes

Conversation

@a777m

@a777m a777m commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What does this change?

This PR allows allows us to build and push the logging sidecar to AWS ECR from within the GuCDK libraray. We then consume the image from ECR instead of the previously used GHCR.

How to test

This has successfully been deployed to CDK playground via a canary.

How can we measure success?

Have we considered potential risks?

Checklist

  • I have listed any breaking changes, along with a migration path 1
  • I have updated the documentation as required for the described changes 2

Footnotes

  1. Consider whether this is something that will mean changes to projects that have already been migrated, or to the CDK CLI tool. If changes are required, consider adding a checklist here and/or linking to related PRs. ↩

  2. If you are adding a new construct or pattern, has new documentation been added? If you are amending defaults or changing behaviour, are the existing docs still valid? ↩

@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa0fd66

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@guardian/cdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@a777m a777m added 🐥 Canaries feature Departmental tracking: work on a new feature labels Oct 8, 2026
@a777m
a777m force-pushed the a777m/devx-logs-changes branch from 3cc80ed to 18bd523 Compare October 8, 2026 09:37
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Note

The following canaries were published to NPM:

🐥

@a777m
a777m force-pushed the a777m/devx-logs-changes branch 2 times, most recently from 2e5a04c to 3809790 Compare October 8, 2026 14:33
@github-actions

Copy link
Copy Markdown
Contributor

Note

The following canaries were published to NPM:

🐥

@github-actions

Copy link
Copy Markdown
Contributor

Note

The following canaries were published to NPM:

🐥

@github-actions

Copy link
Copy Markdown
Contributor

Note

The following canaries were published to NPM:

🐥

@github-actions

Copy link
Copy Markdown
Contributor

Note

The following canaries were published to NPM:

🐥

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Image pushed to AWS ECR

Image digest: sha256:6427503bcd59bdaeb79ddcc0df279acdc88955bb52e8e9fcd035b8a242288784

🐛 Run the image locally

The following can be used to run the image locally:

# Refer to image using the immutable digest. Find alternatives below.
IMAGE_IDENTIFIER="@sha256:6427503bcd59bdaeb79ddcc0df279acdc88955bb52e8e9fcd035b8a242288784"

# Refer to image using branch tag
# IMAGE_IDENTIFIER=":branch-a777m-devx-logs-changes"

# Refer to image using build tag
# IMAGE_IDENTIFIER=":build-14"

# Set environment variables for the AWS CLI
AWS_PROFILE="<A_PROFILE_FROM_JANUS>"
AWS_DEFAULT_REGION="eu-west-1"

IMAGE_ACCOUNT_ID=$(aws ssm get-parameter --name /organisation/accounts/artifacts --query "Parameter.Value" --output text)
REGISTRY="${IMAGE_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com"
IMAGE="${REGISTRY}/guardian/cdk/logging${IMAGE_IDENTIFIER}"

# Login to AWS ECR https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html
aws ecr get-login-password | docker login --username AWS --password-stdin $REGISTRY

# Pull the image
docker pull $IMAGE

# Run the image. You'll likely need to set additional flags. See https://docs.docker.com/reference/cli/docker/container/run.
docker run $IMAGE

From guardian/actions-ecr.

@a777m
a777m force-pushed the a777m/devx-logs-changes branch from 564634f to 8466cfe Compare October 17, 2026 18:48
@a777m
a777m marked this pull request as ready for review October 19, 2026 09:07
@a777m
a777m requested a review from a team as a code owner October 19, 2026 09:07
Comment thread .github/workflows/publish-image.yml Outdated
run: docker buildx build --load --platform linux/amd64,linux/arm64 -t logging:latest tools/logging

- name: Publish image to ECR
uses: guardian/actions-ecr/push@a777m/support-multi-arch-builds

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.

Blocking: Will update this when he PR is merged in the action repo.

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.

Updated

repositoryName: "guardian/cdk/logging",
}),
// branch-a777m-devx-logs-changes, will be updated when merged and built on main
"sha256:32dce4e7a9e628b053ca42c271d7bbdf3697b4980c4612e845a15257c2bd1d99",

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.

Non-blocking: Will update this when we have a build off main (separate PR)

@a777m

a777m commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

I also need to investigate the merge conflict. Seems like the inline repo definition has moved 😭

@a777m
a777m force-pushed the a777m/devx-logs-changes branch from 8466cfe to 82a777d Compare October 19, 2026 09:44
Comment thread .github/workflows/publish-image.yml Resolved
Comment thread .github/workflows/publish-image.yml Resolved
Comment thread .github/workflows/publish-image.yml Resolved
@a777m
a777m force-pushed the a777m/devx-logs-changes branch from 82a777d to c911f13 Compare October 27, 2026 11:24
@a777m
a777m force-pushed the a777m/devx-logs-changes branch 2 times, most recently from 5086ccc to aeeb2a1 Compare October 27, 2026 11:48
@a777m
a777m requested review from AshCorr and akash1810 October 27, 2026 11:51

const loggingImage = new GuRepository(scope, "loggingRepo", {
name: "guardian/cdk/logging",
}).getImage("sha256:32dce4e7a9e628b053ca42c271d7bbdf3697b4980c4612e845a15257c2bd1d99");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to think about how to make this value dynamic? That is, if a new image is created, how would we know and ensure its digest is added here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the scope of this PR is just moving the image from GHCR to ECR, in which case a fixed digest is what we used for GHCR.

I would definitely prefer updating this digest to always point to the newest build, whether that be via a tag or something automatically updating the digest, but maybe lets wait till a follow up PR.

@akash1810 akash1810 Nov 2, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Its worth noting that we currently disable version consistency in favour of always using the image digest as it improved deployment speed. See also https://aws.amazon.com/blogs/containers/announcing-software-version-consistency-for-amazon-ecs-services. I think every container in the task would need to use a digest to see the deployment speed benefits.

I'd be tempted to create some stacked PRs which implements automatically updating the digest before we merge this PR in. It would be a shame to merge in a load of Go code and remove it again if we discover the auto-update isn't possible. WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't necessarily think this PR is a bad PR if we can't do the auto-update, this is still an image that will primarily be used by CDK and should live alongside its usage!

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.

Decision after talking to Akash: We'll keep this PR as is and merge it. Spin off a separate piece of work which covers automating the digest so it points to the newest build. We have a couple different approaches which we would like to explore.

Comment thread tools/logging/README.md Outdated
Comment on lines +1 to +2
> **Warning**
> This is a work in progress.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
> **Warning**
> This is a work in progress.

I don't think this README has been updated in a while, we might want to change some bits. Considering this as a "WIP" doesn't make much sense anymore considering its used by a few PROD ecs projects now.

Comment thread tools/logging/README.md Outdated
which adds some configuration to apply a tag to all logs.

## Usage
TBD - GuCDK is being updated to support this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here, GuCDK already supports this.

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.

I've spruced up the docs here: cdaeb52 :)

@a777m
a777m requested review from AshCorr and akash1810 November 2, 2026 13:55
GuCDK applications gives user the option to ship a app logging along
with the service itself.

As part of opening up the ECS capabilities, users are able to run the
logging service as a sidecar to the main ECS task.

Due to the logging being a part of infrastructure rather than a strictly
standalone service, it was deemed that it would be simpler to ship the
logs from the GuCDK repository.

Furthermore, the original devx-logs repo[1] built and pushed the logging
image to GHCR which is not where we will be storing images going forward.
Building the image from this repo allows devx to ensure that the correct
registry is use - while also minimising registry login and setup.

This commit moves the devx-logs source code from its own repo to
the tools directory in the GuCDK repo.

[1] https://github.com/guardian/devx-logs

Co-authored-by: AshCorr <ashcorr20@gmail.com>
@a777m
a777m force-pushed the a777m/devx-logs-changes branch from cdaeb52 to 331b984 Compare November 6, 2026 11:12
a777m and others added 3 commits November 6, 2026 11:14
The commit adds a new workflow which builds and publish the logging
image to AWS ECR.

The logging image does a multi-arch build as its used across all
services and application in the guardian estate.

It has also been deemed to acceptable to tag the resulting image with
`lastest` as it simplifies user interaction with the service.

Co-authored-by: AshCorr <ashcorr20@gmail.com>
This commit ensure the logging sidecar uses the image stored in
ECR - which is now built from this repository - rather than using
GHCR which is no longer a supported registry.

Co-authored-by: AshCorr <ashcorr20@gmail.com>
This commit updates the logging README's so they correctly match the
current state of the the repo.
@a777m
a777m force-pushed the a777m/devx-logs-changes branch from 331b984 to fa0fd66 Compare November 6, 2026 11:14
@a777m
a777m merged commit 3bd2d88 into main Nov 6, 2026
10 checks passed
@a777m
a777m deleted the a777m/devx-logs-changes branch November 6, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants