Allow set `container_image` labels by json file
PR Type
What kind of change does this PR introduce?
- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:
What is the new behavior?
Allow set docker labels by .json file.
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Is there an issue open where this feature has been discussed? Could you explain why this may be useful?
Is there an issue open where this feature has been discussed? No.
Could you explain why this may be useful? We use file for labels in two places:
- set Docker labels for image garbage collector policy (we have differ policy for master and feature-branches. Branch type passed by stable stamping variables);
- set marker for "upload if not uploaded yet" logic.
Little bit about "upload if not uploaded yet" workflow:
- we check image in docker registry with upload marker (some uniuqe for build value) and return passed upload marker if image is not uploaded or image marker from uploaded image;
- upload marker passed to labels;
- rule makes push to registry.
As a result, we get the following effect:
- initially image will be upload to registry;
- if image already in registry, we got CACHE HIT (same image and upload marker) and push step will be skipped without downloading all layers to worker;
- if image was remove from registry by GC, we got CACHE MISS (same image but new upload marker) and it will be upload.
This Pull Request has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!
Changes:
- rebased to
master; - use
labels_fileattribute instead of reusinglabel_filesattribute.