Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use Depot ephemeral registry for faster pulls #18216

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

jacobwgillespie
Copy link
Contributor

Problem

The current E2E tests are (1) building a container image with Depot then (2) running 20+ Cypress jobs that each run a 2nd Depot build with load: true to download the image result.

This works, but is slow, because all the images must download from a single build host, which results in longer build times.

Changes

This PR uses a new Depot feature that allows saving a build to a Depot ephemeral registry and then pulling the image back with depot pull <build-id>.

This is faster because the Depot ephemeral registry uses a CDN to distribute layer blobs, and so does not bottleneck on EC2. Additionally, there is no charge for pull time with depot pull.

Note: I'm not entirely sure what the production-unit.Dockerfile is, but the behavior of this PR should match what was happening before.

How did you test this code?

We've tested this with our own GHA tests.

Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

very excited for this!

if: needs.changes.outputs.shouldTriggerCypress == 'true'
# Build the container image in preparation for the E2E tests
uses: ./.github/actions/build-n-cache-image
id: build
Copy link
Member

Choose a reason for hiding this comment

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

is this just the string "build"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is assigning an ID to the step so that its outputs can be referenced as outputs of the job (to eventually be passed to the depot/pull-action):

https://github.com/PostHog/posthog/pull/18216/files#diff-3ce26ccacf5c6f81ff8b72f0d50589fc67bbb4049f8931e0fc1471968b894131R79-R82

@pauldambra pauldambra merged commit 345a043 into PostHog:master Oct 26, 2023
64 checks passed
@jacobwgillespie jacobwgillespie deleted the depot-pull branch October 26, 2023 16:21
Gilbert09 pushed a commit that referenced this pull request Oct 30, 2023
* ci: use Depot ephemeral registry for faster pulls

* Install Depot CLI before pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants