|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 |
| -.PHONY: all test-image-list test-image-tags |
| 15 | +include ../../hack/make-rules/Makefile.manifest |
| 16 | +include ../../hack/make-rules/BASEIMAGES |
16 | 17 |
|
17 |
| -all: test-image-list test-image-tags |
| 18 | +.PHONY: all-push all-push-images test-image-tags test-image-tag push-manifest |
18 | 19 |
|
19 |
| -IMAGES_LIST = test-image-1 test-image-2 test-image-3 test-image-latest test-image-digest test-image-tag:test |
20 |
| -test-image-list: |
21 |
| - $(foreach name,$(IMAGES_LIST),docker build . -t gcr.io/cri-tools/$(name) --build-arg TEST=$(name);) |
22 |
| - $(foreach name,$(IMAGES_LIST),gcloud docker -- push gcr.io/cri-tools/$(name);) |
| 20 | +REGISTRY ?= gcr.io/cri-tools |
| 21 | +TAG = latest |
| 22 | +ALL_ARCH = amd64 arm64 ppc64le s390x |
| 23 | +IMAGES_LIST = test-image-1 test-image-2 test-image-3 test-image-latest test-image-digest |
| 24 | + |
| 25 | +all-push: all-push-images test-image-tags test-image-tag push-manifest |
| 26 | + |
| 27 | +all-push-images: $(addprefix sub-push-,$(ALL_ARCH)) |
| 28 | + |
| 29 | +sub-push-%: |
| 30 | + $(foreach name,$(IMAGES_LIST),touch $(name) && docker build . -t $(REGISTRY)/$(name)-$*:$(TAG) --build-arg TEST=$(name) --build-arg ARCH=$($*) && rm -f $(name);) |
| 31 | + $(foreach name,$(IMAGES_LIST),docker push $(REGISTRY)/$(name)-$*:$(TAG);) |
23 | 32 |
|
24 | 33 | test-image-tags:
|
25 |
| - docker build . -t gcr.io/cri-tools/$@:1 --build-arg TEST=$@ |
26 |
| - docker tag gcr.io/cri-tools/$@:1 gcr.io/cri-tools/$@:2 |
27 |
| - docker tag gcr.io/cri-tools/$@:1 gcr.io/cri-tools/$@:3 |
28 |
| - gcloud docker -- push gcr.io/cri-tools/$@:1 |
29 |
| - gcloud docker -- push gcr.io/cri-tools/$@:2 |
30 |
| - gcloud docker -- push gcr.io/cri-tools/$@:3 |
| 34 | + $(foreach arch,$(ALL_ARCH),touch $@ && docker build . -t $(REGISTRY)/$@-$(arch):1 --build-arg TEST=$@ --build-arg ARCH=$($(arch)) && rm -f $@;) |
| 35 | + $(foreach arch,$(ALL_ARCH),docker tag $(REGISTRY)/$@-$(arch):1 $(REGISTRY)/$@-$(arch):2;) |
| 36 | + $(foreach arch,$(ALL_ARCH),docker tag $(REGISTRY)/$@-$(arch):1 $(REGISTRY)/$@-$(arch):3;) |
| 37 | + $(foreach arch,$(ALL_ARCH),docker push $(REGISTRY)/$@-$(arch):1;) |
| 38 | + $(foreach arch,$(ALL_ARCH),docker push $(REGISTRY)/$@-$(arch):2;) |
| 39 | + $(foreach arch,$(ALL_ARCH),docker push $(REGISTRY)/$@-$(arch):3;) |
| 40 | + |
| 41 | +test-image-tag: |
| 42 | + $(foreach arch,$(ALL_ARCH),touch $@ && docker build . -t $(REGISTRY)/$@-$(arch):test --build-arg TEST=$@ --build-arg ARCH=$($(arch)) && rm -f $@;) |
| 43 | + $(foreach arch,$(ALL_ARCH),docker push $(REGISTRY)/$@-$(arch):test;) |
| 44 | + |
| 45 | +push-manifest: manifest-tool |
| 46 | + $(foreach image,$(IMAGES_LIST),manifest-tool push from-args --platforms $(call join_platforms,$(ALL_ARCH)) --template $(REGISTRY)/$(image)-ARCH:$(TAG) --target $(REGISTRY)/$(image):$(TAG);) |
| 47 | + $(foreach arch,$(ALL_ARCH),manifest-tool push from-args --platforms $(call join_platforms,$(ALL_ARCH)) --template $(REGISTRY)/test-image-tags-ARCH:1 --target $(REGISTRY)/test-image-tags:1;) |
| 48 | + $(foreach arch,$(ALL_ARCH),manifest-tool push from-args --platforms $(call join_platforms,$(ALL_ARCH)) --template $(REGISTRY)/test-image-tags-ARCH:2 --target $(REGISTRY)/test-image-tags:2;) |
| 49 | + $(foreach arch,$(ALL_ARCH),manifest-tool push from-args --platforms $(call join_platforms,$(ALL_ARCH)) --template $(REGISTRY)/test-image-tags-ARCH:3 --target $(REGISTRY)/test-image-tags:3;) |
| 50 | + $(foreach arch,$(ALL_ARCH),manifest-tool push from-args --platforms $(call join_platforms,$(ALL_ARCH)) --template $(REGISTRY)/test-image-tag-ARCH:test --target $(REGISTRY)/test-image-tag:test;) |
0 commit comments