Release: add static binaries
Fix issue 7296 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/release/Dockerfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/release/Dockerfile
									
									
									
									
										vendored
									
									
								
							| @@ -49,7 +49,7 @@ RUN \ | ||||
| 	--mount=type=cache,target=/root/.cache/go-build \ | ||||
| 	--mount=type=cache,target=/go/pkg \ | ||||
| 	export CC=$(xx-info)-gcc && xx-go --wrap && \ | ||||
| 	make release cri-release cri-cni-release && \ | ||||
| 	make release static-release cri-release cri-cni-release && \ | ||||
| 	for f in $(find bin -executable -type f); do xx-verify $f; done | ||||
|  | ||||
| # check git working tree after build | ||||
|   | ||||
							
								
								
									
										35
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								Makefile
									
									
									
									
									
								
							| @@ -75,6 +75,7 @@ WHALE = "🇩" | ||||
| ONI = "👹" | ||||
|  | ||||
| RELEASE=containerd-$(VERSION:v%=%)-${GOOS}-${GOARCH} | ||||
| STATICRELEASE=containerd-static-$(VERSION:v%=%)-${GOOS}-${GOARCH} | ||||
| CRIRELEASE=cri-containerd-$(VERSION:v%=%)-${GOOS}-${GOARCH} | ||||
| CRICNIRELEASE=cri-containerd-cni-$(VERSION:v%=%)-${GOOS}-${GOARCH} | ||||
|  | ||||
| @@ -148,7 +149,7 @@ GOTEST ?= $(GO) test | ||||
| OUTPUTDIR = $(join $(ROOTDIR), _output) | ||||
| CRIDIR=$(OUTPUTDIR)/cri | ||||
|  | ||||
| .PHONY: clean all AUTHORS build binaries test integration generate protos check-protos coverage ci check help install uninstall vendor release mandir install-man genman install-cri-deps cri-release cri-cni-release cri-integration install-deps bin/cri-integration.test | ||||
| .PHONY: clean all AUTHORS build binaries test integration generate protos check-protos coverage ci check help install uninstall vendor release static-release mandir install-man genman install-cri-deps cri-release cri-cni-release cri-integration install-deps bin/cri-integration.test | ||||
| .DEFAULT: default | ||||
|  | ||||
| # Forcibly set the default goal to all, in case an include above brought in a rule definition. | ||||
| @@ -299,18 +300,40 @@ install-man: man | ||||
| 	$(foreach manpage,$(addprefix man/,$(MANPAGES)), $(call installmanpage,$(manpage),$(subst .,,$(suffix $(manpage))),$(notdir $(manpage)))) | ||||
|  | ||||
|  | ||||
| define pack_release | ||||
| 	@rm -rf releases/$(1) releases/$(1).tar.gz | ||||
| 	@$(INSTALL) -d releases/$(1)/bin | ||||
| 	@$(INSTALL) $(BINARIES) releases/$(1)/bin | ||||
| 	@tar -czf releases/$(1).tar.gz -C releases/$(1) bin | ||||
| 	@rm -rf releases/$(1) | ||||
| endef | ||||
|  | ||||
|  | ||||
| releases/$(RELEASE).tar.gz: $(BINARIES) | ||||
| 	@echo "$(WHALE) $@" | ||||
| 	@rm -rf releases/$(RELEASE) releases/$(RELEASE).tar.gz | ||||
| 	@$(INSTALL) -d releases/$(RELEASE)/bin | ||||
| 	@$(INSTALL) $(BINARIES) releases/$(RELEASE)/bin | ||||
| 	@tar -czf releases/$(RELEASE).tar.gz -C releases/$(RELEASE) bin | ||||
| 	@rm -rf releases/$(RELEASE) | ||||
| 	$(call pack_release,$(RELEASE)) | ||||
|  | ||||
| release: releases/$(RELEASE).tar.gz | ||||
| 	@echo "$(WHALE) $@" | ||||
| 	@cd releases && sha256sum $(RELEASE).tar.gz >$(RELEASE).tar.gz.sha256sum | ||||
|  | ||||
| releases/$(STATICRELEASE).tar.gz: | ||||
| ifeq ($(GOOS),linux) | ||||
| 	@make STATIC=1 $(BINARIES) | ||||
| 	@echo "$(WHALE) $@" | ||||
| 	$(call pack_release,$(STATICRELEASE)) | ||||
| else | ||||
| 	@echo "Skipping $(STATICRELEASE) for $(GOOS)" | ||||
| endif | ||||
|  | ||||
| static-release: releases/$(STATICRELEASE).tar.gz | ||||
| ifeq ($(GOOS),linux) | ||||
| 	@echo "$(WHALE) $@" | ||||
| 	@cd releases && sha256sum $(STATICRELEASE).tar.gz >$(STATICRELEASE).tar.gz.sha256sum | ||||
| else | ||||
| 	@echo "Skipping releasing $(STATICRELEASE) for $(GOOS)" | ||||
| endif | ||||
|  | ||||
| # install of cri deps into release output directory | ||||
| ifeq ($(GOOS),windows) | ||||
| install-cri-deps: $(BINARIES) | ||||
|   | ||||
| @@ -93,3 +93,16 @@ The 2.0 release will remove any feature deprecated in 1.x. Features deprecated i | ||||
| * **Add NoSameOwner option when unpacking tars** ([#7386](https://github.com/containerd/containerd/pull/7386)) | ||||
|  | ||||
| See the changelog for complete list of changes""" | ||||
|  | ||||
| postface = """\ | ||||
| ### Which file should I download? | ||||
| * `containerd-<VERSION>-<OS>-<ARCH>.tar.gz`:         ✅Recommended. Dynamically linked with glibc 2.27 (Ubuntu 18.04). | ||||
| * `containerd-static-<VERSION>-<OS>-<ARCH>.tar.gz`:  Statically linked. Expected to be used on non-glibc Linux distributions. Not position-independent. | ||||
| * `cri-containerd-<VERSION>-<OS>-<ARCH>.tar.gz`:     (Deprecated) | ||||
| * `cri-containerd-cni-<VERSION>-<OS>-<ARCH>.tar.gz`: (Deprecated) | ||||
|  | ||||
| In addition to containerd, typically you will have to install [runc](https://github.com/opencontainers/runc/releases) | ||||
| and [CNI plugins](https://github.com/containernetworking/plugins/releases) from their official sites too. | ||||
|  | ||||
| See also the [Getting Started](https://github.com/containerd/containerd/blob/main/docs/getting-started.md) documentation. | ||||
| """ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Akihiro Suda
					Akihiro Suda