Skip to content

make airbyteDocker build cache functional #9362

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

Merged
merged 1 commit into from
Jan 11, 2022
Merged

Conversation

edgao
Copy link
Contributor

@edgao edgao commented Jan 8, 2022

What

We're currently rerunning the docker build unnecessarily. This change fixes how we detect image changes after some recent Dockerfile structure updates.

How

  • This PR added some COPY --from=build ... directives to our Dockerfiles. The gradle task interpreted this as a dependency on an image called build, which obviously doesn't exist - the task now correctly resolves that image alias
  • This PR updated the Dockerfiles to respect a JDK_VERSION environment variable. The gradle task now correctly resolves that environment variable, rather than trying to find a image literally named openjdk:${JDK_VERSION}-slim.

@edgao edgao requested a review from sherifnada January 8, 2022 00:27
@sherifnada sherifnada requested review from jrhizor and tuliren January 8, 2022 00:50
Copy link
Contributor

@tuliren tuliren left a comment

Choose a reason for hiding this comment

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

Nice!

Do we know the amount of build time improvement from this change?

Would you like to present this in the dev meeting?

Copy link
Contributor

@sherifnada sherifnada left a comment

Choose a reason for hiding this comment

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

is it possible to implement some sort of unit test for these functions? would be helpful to know when there's a regression in the cache functionality as it can be tricky to hunt down/detect

@edgao
Copy link
Contributor Author

edgao commented Jan 8, 2022

@tuliren each docker image takes about 1 minute to build. base-normalization spends about 5 minutes building docker images, though presumably if you're making changes + rerunning tests, you have to rebuild at least one of those images. Happy to present at a dev meeting (but not the one next monday, since sherif raises a good point)

@sherifnada makes sense, it looks like there's some sort of test ability (https://docs.gradle.org/current/userguide/custom_tasks.html#sec:writing_tests_for_your_task_class). I'll see if I can get something set up. Really the problem is that we're parsing dockerfiles in a pretty sketchy way, but I couldn't immediately find a (well-maintained) dockerfile parsing library for java 🤷

@jrhizor
Copy link
Contributor

jrhizor commented Jan 9, 2022

Longer term, I'd recommend considering using a better method of building the docker images than airbyteDocker. For platform builds we've switched to using the bmuschko Docker plugin which should have better caching behavior.

@edgao
Copy link
Contributor Author

edgao commented Jan 11, 2022

groovy unit tests look messy + we want to use a different plugin anyway; merging this as-is.

@edgao edgao merged commit dad52ed into master Jan 11, 2022
@edgao edgao deleted the edgao/docker_build_cache branch January 11, 2022 19:33
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.

4 participants