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

Prebuild hook always run #8654

Open
nickdapper opened this issue Apr 7, 2023 · 2 comments
Open

Prebuild hook always run #8654

nickdapper opened this issue Apr 7, 2023 · 2 comments
Labels
area/hooks needs-reproduction needs reproduction from the maintainers to validate the issue is truly a skaffold bug priority/p2 May take a couple of releases

Comments

@nickdapper
Copy link
Contributor

The pre/post build hooks created from #1441 are a great addition. I would like to improve upon this further to always run certain hooks or add another hook.

Example:
I am building Docker images. As far as I know, the build phase parses all the contents of the docker image and generates a hash. We are building Golang apps that run within a docker container. If the Go code has changed, it will not rebuild. We can issue a go build for each command before running skaffold build. This is fine for a small project with only one service or a couple services. This becomes an issue for 20+ services in a monorepo. An optimization we are using is building all binaries at the same time. This speeds up generation of all the binaries using Go's internal cache by loading all the modules. Example here: ko-build/ko#314

Expected behavior

Always run the prebuild hook or define a new hook that always runs. This would run prior to the build phase that checks the hash.

Actual behavior

The prebuild hook only runs if the build needs to run

Information

  • Skaffold version: v2.3.0
  • Operating system: Mac
  • Installed via: brew
@renzodavid9 renzodavid9 added priority/p2 May take a couple of releases area/hooks labels Apr 17, 2023
@aaron-prindle aaron-prindle added the needs-reproduction needs reproduction from the maintainers to validate the issue is truly a skaffold bug label Apr 17, 2023
@renzodavid9
Copy link
Contributor

Hey @nickdapper, thanks for opening this issue. I have a couple of questions to understand more about the example you mentioned:

  1. Do you have a skaffold.yaml config file that you can share to understand how is the setup of your project?
  2. From the example, I understand that you are using the hooks to execute an image build, right? And also, I understand that Skaffold itself is not triggering the build process when you do a code change, and that's the reason you are doing it through the hooks, right?
  3. Could you also share which Skaffold command are you using?

If the Go code has changed, it will not rebuild.

This is something that I'm curious to understand why is not happening in your case. For example, when you run skaffold dev in a project, Skaffold should be able to detect code changes, and if needed trigger an image build, and deploy.

Thanks!

@renzodavid9
Copy link
Contributor

Hey @nickdapper! Just following up on the questions from previous comment. Please let us know if you have the details. Thanks! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hooks needs-reproduction needs reproduction from the maintainers to validate the issue is truly a skaffold bug priority/p2 May take a couple of releases
Projects
None yet
Development

No branches or pull requests

3 participants