Unable to override or properly set the created time for oci manifests - flux push artifact #5934
-
|
We have a cleanup task that sorts by timestamp to keep the latest N manifests and images and runs over all repositories and tried different strategies to inject a custom timestamp/override, but neither approach works out of the box. The time is always 0001-01-01 00:00:00 UTC
This is a screenshot from the docker Docker Registry Browser
kustomize build "path/to/manifests" | flux push artifact $OCI_MANIFEST \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)"
-f -kustomize build "path/to/manifests" > ./compiled.yaml
flux push artifact $OCI_MANIFEST \
--path="./compiled.yaml" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)"We' also tried to set an annotation --annotations="org.opencontainers.image.created=$(date -u +"%Y-%m-%dT%H:%M:%SZ")"We would expect that Is there an option to accomplish this? Thanks in advance. Cheers |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
In fluxcd/pkg#1239 we are allowing the override with |
Beta Was this translation helpful? Give feedback.
-
|
Hey Michael, This is a config timestamp versus manifest annotation issueYour annotation is valid, but Docker Registry Browser appears to read the OCI image configuration's
In Flux You can confirm the difference with: The fix has been mergedThe maintainer-linked PR,
Therefore, this should work once Flux includes the updated An invalid value will now fail instead of silently creating inconsistent metadata. Important version detailFlux You will need a future Flux release containing that dependency update, or a custom CLI build from a revision that includes it. Reproducibility considerationUsing the current time changes the config blob and therefore the artifact digest on every push, even when the content is identical. If you want a meaningful timestamp while keeping builds deterministic for the same Git revision, the commit timestamp may be a better value: For cleanup before the fix reaches a Flux release, you could read the existing manifest annotation directly rather than relying on Docker Registry Browser's displayed config time. Another robust option is using immutable, sortable tags containing a timestamp and Git SHA. References: |
Beta Was this translation helpful? Give feedback.
-
|
Huge thanks to both @stefanprodan and @Lopesnextgen for looking into this and putting together a solution so quickly! Really appreciate your time and help in resolving this issue. 🙌 I'm going to mark the later comment as the accepted answer, just because it includes some extra details that might be super helpful for late joiners running into this same issue in the future. Thanks again, both of you! |
Beta Was this translation helpful? Give feedback.

In fluxcd/pkg#1239 we are allowing the override with
--annotations="org.opencontainers.image.created=$(date -u +"%Y-%m-%dT%H:%M:%SZ")"