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

feat: add build to life cycle hooks #2653

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

stevenh
Copy link
Collaborator

@stevenh stevenh commented Jul 17, 2024

Add pre and post build life cycle hooks so the user can see when an image build is occurring and what it's tag is.

Refactor combineContainerHooks to support additional fields automatically.

Reduce overhead of hook error handling by starting with an nil error slice and use append to allocate only if needed, in other words assume the happy path by default hence minimising allocations.

Minimise code used in hook handling by using helper methods.

Eliminate unused / shadowed parameters from defaultPreCreateHook.

GetRepo and GetTag now return a consistent UUID if the Repo or Tag field aren't set by setting their values. This was needed to enable the output of the image we're going to build in the log.

Copy link

netlify bot commented Jul 17, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit a9c98d7
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/6725073451942f0008d0b465
😎 Deploy Preview https://deploy-preview-2653--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@stevenh stevenh force-pushed the feat/build-lifecycle branch 3 times, most recently from 6384301 to 90afc8b Compare July 17, 2024 02:48
@stevenh stevenh marked this pull request as ready for review July 17, 2024 02:52
@stevenh stevenh requested a review from a team as a code owner July 17, 2024 02:52
@mdelapenya
Copy link
Member

For this one, we have docs documenting the lifecycle hooks here: https://golang.testcontainers.org/features/creating_container/#lifecycle-hooks could you also update that? 🙏

@stevenh stevenh marked this pull request as draft September 10, 2024 10:33
@stevenh stevenh force-pushed the feat/build-lifecycle branch from 90afc8b to 5a9c929 Compare November 1, 2024 16:44
Add pre and post build life cycle hooks so the user can see when an image
build is occurring and what it's tag is.

Refactor combineContainerHooks to support additional fields automatically.

Reduce overhead of hook error handling by starting with an nil error
slice and use append to allocate only if needed, in other words assume
the happy path by default hence minimising allocations.

Minimise code used in hook handling by using helper methods.

Eliminate unused / shadowed parameters from defaultPreCreateHook.

GetRepo and GetTag now return a consistent UUID if the Repo or Tag field
aren't set by setting their values. This was needed to enable the output
of the image we're going to build in the log.
@stevenh stevenh force-pushed the feat/build-lifecycle branch from 5a9c929 to a9c98d7 Compare November 1, 2024 16:52
@stevenh stevenh marked this pull request as ready for review November 2, 2024 00:12
@stevenh stevenh requested a review from mdelapenya November 2, 2024 00:12
Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mdelapenya mdelapenya self-assigned this Nov 5, 2024
@mdelapenya mdelapenya added the enhancement New feature or request label Nov 5, 2024
@mdelapenya mdelapenya merged commit ac572ca into testcontainers:main Nov 5, 2024
122 checks passed
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Nov 19, 2024
* main: (34 commits)
  fix: only upload to sonar on ubuntu-latest (testcontainers#2891)
  fix: build artifact name properly (testcontainers#2890)
  fix: do not run sonar upload when ryuk is disabled (testcontainers#2889)
  fix: update GH actions for uploading/downloading artifacts (testcontainers#2888)
  feat(ci): Enable master moby with rootless (testcontainers#2880)
  fix(redpanda): temporary file use
  chore(deps): bump actions/download-artifact from 3.0.2 to 4.1.8 (testcontainers#2676)
  chore(deps): bump actions/upload-artifact from 3.1.3 to 4.4.3 (testcontainers#2885)
  fix!: port forwarding clean up and make private (testcontainers#2881)
  chore: resolve AWS deprecations for localstack (testcontainers#2879)
  docs: fix new lifecycle hooks section (testcontainers#2875)
  fix: host access port instability (testcontainers#2867)
  feat: add build to life cycle hooks (testcontainers#2653)
  fix: typo in containerd integration (testcontainers#2873)
  chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (testcontainers#2806)
  chore: use testify instead of t.Error (testcontainers#2871)
  ci: enable perfsprint linter (testcontainers#2872)
  chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (testcontainers#2807)
  chore: use testcontainers.RequireContainerExec (testcontainers#2870)
  chore(deps): bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 (testcontainers#2868)
  ...
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Nov 21, 2024
* main: (76 commits)
  fix(influxdb): Respect custom waitStrategy (testcontainers#2845)
  fix: only upload to sonar on ubuntu-latest (testcontainers#2891)
  fix: build artifact name properly (testcontainers#2890)
  fix: do not run sonar upload when ryuk is disabled (testcontainers#2889)
  fix: update GH actions for uploading/downloading artifacts (testcontainers#2888)
  feat(ci): Enable master moby with rootless (testcontainers#2880)
  fix(redpanda): temporary file use
  chore(deps): bump actions/download-artifact from 3.0.2 to 4.1.8 (testcontainers#2676)
  chore(deps): bump actions/upload-artifact from 3.1.3 to 4.4.3 (testcontainers#2885)
  fix!: port forwarding clean up and make private (testcontainers#2881)
  chore: resolve AWS deprecations for localstack (testcontainers#2879)
  docs: fix new lifecycle hooks section (testcontainers#2875)
  fix: host access port instability (testcontainers#2867)
  feat: add build to life cycle hooks (testcontainers#2653)
  fix: typo in containerd integration (testcontainers#2873)
  chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (testcontainers#2806)
  chore: use testify instead of t.Error (testcontainers#2871)
  ci: enable perfsprint linter (testcontainers#2872)
  chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (testcontainers#2807)
  chore: use testcontainers.RequireContainerExec (testcontainers#2870)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants