Repository navigation
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
dist/quarkus
Describe the bug
Hello 👋
I open this request after this request in another already closed issue. I hope I selected the area correctly.
The main issue is when we want to use and follow practices from Reproducible Builds, some are interfering with the way the kc.sh build --optimized system is working.
It's important to note our issue is mainly buildah related, managed by IronBank, but under certain circumstances, that could be reproduced with any kind of build system (docker, kaniko…).
The problem is buildah, when used with the --timestamp parameter and some provider jars, the kc.sh build --optimized generates a text file with the "now" timestamp associated to the jar (mechanism to validate if the jar has changed or not).
The main issue is after the RUN step, buildah applies this timestamp to every file of this layer.
Then, we end up with an error at keycloak startup with the following error:
A provider JAR was updated since the last build, please rebuild for this to be fully utilized.
This can be reproduced with any build system, as soon as it changes date of files created after the complete build.
Version
26.2+
Regression
- The issue is a regression
Expected behavior
We should be able to start the app if the last-modify-date is changed, because the file itself should be verified (and not only the date that represent nothing really valuable).
In another thread, we recommended to base this mechanism on something less fragile than date, like digest (CRC32, MD5, SHA…).
Actual behavior
The built container can't be executed correctly. We have the following error when we launch it:
A provider JAR was updated since the last build, please rebuild for this to be fully utilized.
How to Reproduce?
Because we use the IronBank system, I don't have (atm) a clear reproducer, but some are described in the original issue.
The main way to reproduce it is to:
- Build a first version of
keycloak
ADDany 3rd party jar into./providers/RUNthekc.sh build --optimizedcommand
- Build the inherited image with
--timestamp 0, usingbuildahfor example
COPY /opt/keycloakfrom image created in step 1- (implicitly, all files from this second image will have
last-modify-dateto the 1970-1-1
docker run -it --rm image-from-step-2
Anything else?
Our IronBank repository is accessible if you want more context.
Activity
mabartos commentedon Jul 21, 2025
@shawkins Could you please check it? Thanks
shawkins commentedon Jul 21, 2025
Based upon the discussions on the other issue, we generally would want users to touch the files to a known timestamp. As shown here any manipulation of the last modified date in the inherited image to an arbitrary timestamp will be problematic.
The workaround is to touch the provider files in the base image to 1970-1-1 prior to running build --optimized and require that timestamp 0 be used in any derived image.
We rejected computing a hash / digest on every start as a solution. We have lighter weight options:
I am more open to the first option. We also already have an KC_RUN_IN_CONTAINER env variable in our base image Dockerfile that could be used to automatically drive it - If KC_RUN_IN_CONTAINER=true, then default to ignore / warn and document that any containerized manipulation of providers with build --optimized requires creating a new image.
Let's get more input from @keycloak/cloud-native-maintainers
Whatever we decide to do here will influence #38894 - as we want to make sure that our behavior is as clear as possible moving forward.
davinkevin commentedon Jul 21, 2025
Thank you for those details and consideration of this request 😇
5 remaining items
fix: warn instead of an error if optimized provider timestamps change (…
fix: warn instead of an error if optimized provider timestamps change (…
fix: warn instead of an error if optimized provider timestamps change (…
bartlomiejduda commentedon Jan 30, 2026
This solution worked for me:
// buildah
buildah run $runtimecontainer -- find /opt/keycloak/providers -type f -exec touch -a -m --date=@1743465600 {} +
// docker
RUN find /opt/keycloak/providers -type f -exec touch -a -m --date=@1743465600 {} +