Skip to content

Commit 370b1a8

Browse files
committed
Cirrus: Reimplement release archive + upload
The initial implementation was far more complicated than necessary. Strip out the complexities in favor of a simpler and more direct approach. Signed-off-by: Chris Evich <[email protected]>
1 parent 8e46106 commit 370b1a8

18 files changed

+328
-294
lines changed

.cirrus.yml

+14-56
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ env:
6262
GCE_SSH_USERNAME: cirrus-ci
6363
# Name where this repositories cloud resources are located
6464
GCP_PROJECT_ID: ENCRYPTED[7c80e728e046b1c76147afd156a32c1c57d4a1ac1eab93b7e68e718c61ca8564fc61fef815952b8ae0a64e7034b8fe4f]
65+
RELEASE_GCPJSON: ENCRYPTED[789d8f7e9a5972ce350fd8e60f1032ccbf4a35c3938b604774b711aad280e12c21faf10e25af1e0ba33597ffb9e39e46]
66+
RELEASE_GCPNAME: ENCRYPTED[417d50488a4bd197bcc925ba6574de5823b97e68db1a17e3a5fde4bcf26576987345e75f8d9ea1c15a156b4612c072a1]
67+
RELEASE_GCPROJECT: ENCRYPTED[7c80e728e046b1c76147afd156a32c1c57d4a1ac1eab93b7e68e718c61ca8564fc61fef815952b8ae0a64e7034b8fe4f]
68+
6569

6670

6771
# Default VM to use unless set or modified by task
@@ -336,9 +340,8 @@ testing_task:
336340
unit_test_script: '$SCRIPT_BASE/unit_test.sh |& ${TIMESTAMP}'
337341
integration_test_script: '$SCRIPT_BASE/integration_test.sh |& ${TIMESTAMP}'
338342
system_test_script: '$SCRIPT_BASE/system_test.sh |& ${TIMESTAMP}'
339-
cache_release_archive_script: >-
340-
[[ "$TEST_REMOTE_CLIENT" == "false" ]] || \
341-
$SCRIPT_BASE/cache_release_archive.sh |& ${TIMESTAMP}
343+
build_release_script: '$SCRIPT_BASE/build_release.sh |& ${TIMESTAMP}'
344+
upload_release_archive_script: '$SCRIPT_BASE/upload_release_archive.sh |& ${TIMESTAMP}'
342345

343346
on_failure:
344347
failed_branch_script: '$CIRRUS_WORKING_DIR/$SCRIPT_BASE/notice_branch_failure.sh'
@@ -376,9 +379,6 @@ testing_crun_task:
376379
unit_test_script: '$SCRIPT_BASE/unit_test.sh |& ${TIMESTAMP}'
377380
integration_test_script: '$SCRIPT_BASE/integration_test.sh |& ${TIMESTAMP}'
378381
system_test_script: '$SCRIPT_BASE/system_test.sh |& ${TIMESTAMP}'
379-
cache_release_archive_script: >-
380-
[[ "$TEST_REMOTE_CLIENT" == "false" ]] || \
381-
$SCRIPT_BASE/cache_release_archive.sh |& ${TIMESTAMP}
382382

383383
on_failure:
384384
failed_branch_script: '$CIRRUS_WORKING_DIR/$SCRIPT_BASE/notice_branch_failure.sh'
@@ -459,14 +459,15 @@ special_testing_cross_task:
459459

460460
env:
461461
matrix:
462-
SPECIALMODE: 'windows' # See docs
463-
SPECIALMODE: 'darwin'
462+
CROSS_PLATFORM: 'windows'
463+
CROSS_PLATFORM: 'darwin'
464464

465465
timeout_in: 20m
466466

467467
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
468468
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
469-
cache_release_archive_script: '$SCRIPT_BASE/cache_release_archive.sh |& ${TIMESTAMP}'
469+
build_release_script: '$SCRIPT_BASE/build_release.sh |& ${TIMESTAMP}'
470+
upload_release_archive_script: '$SCRIPT_BASE/upload_release_archive.sh |& ${TIMESTAMP}'
470471

471472
on_failure:
472473
failed_branch_script: '$CIRRUS_WORKING_DIR/$SCRIPT_BASE/notice_branch_failure.sh'
@@ -615,6 +616,9 @@ verify_test_built_images_task:
615616
integration_test_script: >-
616617
[[ "$PACKER_BUILDER_NAME" == "xfedora-30" ]] || \
617618
$SCRIPT_BASE/integration_test.sh |& ${TIMESTAMP}
619+
build_release_script: >-
620+
[[ "$PACKER_BUILDER_NAME" == "xfedora-30" ]] || \
621+
'$SCRIPT_BASE/build_release.sh |& ${TIMESTAMP}'
618622
system_test_script: >-
619623
[[ "$PACKER_BUILDER_NAME" == "xfedora-30" ]] || \
620624
$SCRIPT_BASE/system_test.sh |& ${TIMESTAMP}
@@ -629,7 +633,7 @@ success_task:
629633
# it blocks PRs from merging if a depends_on task fails
630634
only_if: $CIRRUS_BRANCH != $DEST_BRANCH
631635

632-
# ignores any dependent task conditions, include everything except 'release'
636+
# ignores any dependent task conditions
633637
depends_on:
634638
- "gating"
635639
- "vendor"
@@ -660,49 +664,3 @@ success_task:
660664
memory: 1
661665

662666
success_script: '$CIRRUS_WORKING_DIR/$SCRIPT_BASE/success.sh |& ${TIMESTAMP}'
663-
664-
665-
release_task:
666-
667-
# Never do this when building images
668-
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\*\*\*\s*CIRRUS:\s*TEST\s*IMAGES\s*\*\*\*.*'
669-
670-
# TODO: Uncomment both to not affect pass/fail status of entire job?
671-
# allow_failures: $CI == "true"
672-
# skip_notifications: $CI == "true"
673-
674-
# Must include everything (YAML anchor/alias cannot be used here)
675-
depends_on:
676-
- "gating"
677-
- "vendor"
678-
- "varlink_api"
679-
- "build_each_commit"
680-
- "build_without_cgo"
681-
- "meta"
682-
- "image_prune"
683-
- "testing"
684-
- "testing_crun"
685-
- "special_testing_rootless"
686-
- "special_testing_in_podman"
687-
- "special_testing_cgroupv2"
688-
- "special_testing_cross"
689-
- "special_testing_endpoint"
690-
- "test_build_cache_images"
691-
- "test_building_snap"
692-
- "verify_test_built_images"
693-
- "success"
694-
695-
gce_instance:
696-
image_name: "${IMAGE_BUILDER_CACHE_IMAGE_NAME}"
697-
698-
timeout_in: 30m
699-
700-
env:
701-
GCPJSON: ENCRYPTED[789d8f7e9a5972ce350fd8e60f1032ccbf4a35c3938b604774b711aad280e12c21faf10e25af1e0ba33597ffb9e39e46]
702-
GCPNAME: ENCRYPTED[417d50488a4bd197bcc925ba6574de5823b97e68db1a17e3a5fde4bcf26576987345e75f8d9ea1c15a156b4612c072a1]
703-
GCPROJECT: ENCRYPTED[7c80e728e046b1c76147afd156a32c1c57d4a1ac1eab93b7e68e718c61ca8564fc61fef815952b8ae0a64e7034b8fe4f]
704-
705-
uncache_release_archives_script: '$SCRIPT_BASE/uncache_release_archives.sh |& ${TIMESTAMP}'
706-
707-
on_failure:
708-
failed_branch_script: '$CIRRUS_WORKING_DIR/$SCRIPT_BASE/notice_branch_failure.sh'

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ __pycache__
2020
/cmd/podman/varlink/iopodman.go
2121
.gopathok
2222
test/e2e/e2e.coverprofile
23-
/podman*zip
23+
release.txt
24+
podman-remote*.zip
2425
podman*.tar.gz
2526
.idea*

Makefile

+63-43
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,12 @@ LIBSECCOMP_COMMIT := release-2.3
8181
# caller may override in special circumstances if needed.
8282
GINKGOTIMEOUT ?= -timeout=90m
8383

84-
RELEASE_VERSION ?= $(shell git fetch --tags && git describe HEAD 2> /dev/null)
85-
RELEASE_NUMBER ?= $(shell echo $(RELEASE_VERSION) | sed 's/-.*//')
86-
RELEASE_DIST ?= $(shell ( source /etc/os-release; echo $$ID ))
87-
RELEASE_DIST_VER ?= $(shell ( source /etc/os-release; echo $$VERSION_ID | cut -d '.' -f 1))
88-
RELEASE_ARCH ?= $(shell go env GOARCH 2> /dev/null)
89-
RELEASE_BASENAME := $(shell basename $(PROJECT))
90-
84+
RELEASE_VERSION ?= $(shell hack/get_release_info.sh VERSION)
85+
RELEASE_NUMBER ?= $(shell hack/get_release_info.sh NUMBER)
86+
RELEASE_DIST ?= $(shell hack/get_release_info.sh DIST)
87+
RELEASE_DIST_VER ?= $(shell hack/get_release_info.sh DIST_VER)
88+
RELEASE_ARCH ?= $(shell hack/get_release_info.sh ARCH)
89+
RELEASE_BASENAME := $(shell hack/get_release_info.sh BASENAME)
9190

9291
# If GOPATH not specified, use one in the local directory
9392
ifeq ($(GOPATH),)
@@ -164,11 +163,9 @@ podman: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman
164163
podman-remote: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman on remote environment
165164
$(GO_BUILD) $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS) remoteclient" -o bin/$@ $(PROJECT)/cmd/podman
166165

167-
podman-remote-darwin: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman on remote OSX environment
168-
CGO_ENABLED=0 GOOS=darwin $(GO_BUILD) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "remoteclient containers_image_openpgp exclude_graphdriver_devicemapper" -o bin/$@ $(PROJECT)/cmd/podman
169-
170-
podman-remote-windows: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman for a remote windows environment
171-
CGO_ENABLED=0 GOOS=windows $(GO_BUILD) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "remoteclient containers_image_openpgp exclude_graphdriver_devicemapper" -o bin/$@.exe $(PROJECT)/cmd/podman
166+
podman-remote-%: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build podman for a specific GOOS
167+
$(eval BINSFX := $(shell test "$*" != "windows" || echo ".exe"))
168+
CGO_ENABLED=0 GOOS=$* $(GO_BUILD) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "remoteclient containers_image_openpgp exclude_graphdriver_devicemapper" -o bin/$@$(BINSFX) $(PROJECT)/cmd/podman
172169

173170
local-cross: $(CROSS_BUILD_TARGETS) ## Cross local compilation
174171

@@ -182,8 +179,9 @@ clean: ## Clean artifacts
182179
rm -rf \
183180
.gopathok \
184181
_output \
185-
podman*.zip \
186-
podman*.tar.gz \
182+
release.txt
183+
$(wildcard podman-remote*.zip) \
184+
$(wildcard podman*.tar.gz) \
187185
bin \
188186
build \
189187
docs/remote \
@@ -300,23 +298,6 @@ vagrant-check:
300298

301299
binaries: varlink_generate podman podman-remote ## Build podman
302300

303-
# Zip archives are supported on all platforms + allows embedding metadata
304-
podman.zip: binaries docs
305-
$(eval TMPDIR := $(shell mktemp -d -p '' $@_XXXX))
306-
test -n "$(TMPDIR)"
307-
$(MAKE) install "DESTDIR=$(TMPDIR)" "PREFIX=$(TMPDIR)/usr"
308-
# Encoded RELEASE_INFO format depended upon by CI tooling
309-
# X-RELEASE-INFO format depended upon by CI tooling
310-
cd "$(TMPDIR)" && echo \
311-
"X-RELEASE-INFO: $(RELEASE_BASENAME) $(RELEASE_VERSION) $(RELEASE_DIST) $(RELEASE_DIST_VER) $(RELEASE_ARCH)" | \
312-
zip --recurse-paths --archive-comment "$(CURDIR)/$@" "./"
313-
-rm -rf "$(TMPDIR)"
314-
315-
podman-remote-%.zip: podman-remote-%
316-
# Don't label darwin/windows cros-compiles with local distribution & version
317-
echo "X-RELEASE-INFO: podman-remote $(RELEASE_VERSION) $* cc $(RELEASE_ARCH)" | \
318-
zip --archive-comment "$(CURDIR)/$@" ./bin/$<*
319-
320301
install.catatonit:
321302
./hack/install_catatonit.sh
322303

@@ -333,19 +314,58 @@ docs: $(MANPAGES) ## Generate documentation
333314
install-podman-remote-docs: docs
334315
@(cd docs; ./podman-remote.sh ./remote)
335316

317+
# When publishing releases include critical build-time details
318+
.PHONY: release.txt
319+
release.txt:
320+
# X-RELEASE-INFO format depended upon by automated tooling
321+
echo -n "X-RELEASE-INFO:" > "$@"
322+
for field in "$(RELEASE_BASENAME)" "$(RELEASE_VERSION)" \
323+
"$(RELEASE_DIST)" "$(RELEASE_DIST_VER)" "$(RELEASE_ARCH)"; do \
324+
echo -n " $$field"; done >> "$@"
325+
echo "" >> "$@"
326+
327+
podman-$(RELEASE_NUMBER).tar.gz: binaries docs release.txt
328+
$(eval TMPDIR := $(shell mktemp -d -p '' podman_XXXX))
329+
$(eval SUBDIR := podman-$(RELEASE_NUMBER))
330+
mkdir -p "$(TMPDIR)/$(SUBDIR)"
331+
$(MAKE) install.bin install.man install.cni install.systemd "DESTDIR=$(TMPDIR)/$(SUBDIR)" "PREFIX=/usr"
332+
# release.txt location and content depended upon by automated tooling
333+
cp release.txt "$(TMPDIR)/"
334+
tar -czvf $@ --xattrs -C "$(TMPDIR)" "./release.txt" "./$(SUBDIR)"
335+
-rm -rf "$(TMPDIR)"
336+
337+
# Must call make in-line: Dependency-spec. w/ wild-card also consumes variable value.
338+
podman-remote-$(RELEASE_NUMBER)-%.zip:
339+
$(MAKE) podman-remote-$* install-podman-remote-docs release.txt \
340+
RELEASE_BASENAME=$(shell hack/get_release_info.sh REMOTENAME) \
341+
RELEASE_DIST=$* RELEASE_DIST_VER="-"
342+
$(eval TMPDIR := $(shell mktemp -d -p '' $podman_remote_XXXX))
343+
$(eval SUBDIR := podman-$(RELEASE_VERSION))
344+
$(eval BINSFX := $(shell test "$*" != "windows" || echo ".exe"))
345+
mkdir -p "$(TMPDIR)/$(SUBDIR)"
346+
# release.txt location and content depended upon by automated tooling
347+
cp release.txt "$(TMPDIR)/"
348+
cp ./bin/podman-remote-$*$(BINSFX) "$(TMPDIR)/$(SUBDIR)/podman$(BINSFX)"
349+
cp -r ./docs/remote "$(TMPDIR)/$(SUBDIR)/docs/"
350+
$(eval DOCFILE := $(TMPDIR)/$(SUBDIR)/docs/podman.1)
351+
cp docs/podman-remote.1 "$(DOCFILE)"
352+
sed -i 's/podman\\*-remote/podman/g' "$(DOCFILE)"
353+
sed -i 's/Podman\\*-remote/Podman\ for\ $*/g' "$(DOCFILE)"
354+
sed -i 's/podman\.conf/podman\-remote\.conf/g' "$(DOCFILE)"
355+
sed -i 's/A\ remote\ CLI\ for\ Podman\:\ //g' "$(DOCFILE)"
356+
cd "$(TMPDIR)" && \
357+
zip --recurse-paths "$(CURDIR)/$@" "./release.txt" "./"
358+
-rm -rf "$(TMPDIR)"
359+
360+
.PHONY: podman-release
361+
podman-release:
362+
rm -f release.txt
363+
$(MAKE) podman-$(RELEASE_NUMBER).tar.gz
336364

337-
brew-pkg: install-podman-remote-docs podman-remote-darwin
338-
@mkdir -p ./brew
339-
@cp ./bin/podman-remote-darwin ./brew/podman
340-
@cp -r ./docs/remote ./brew/docs/
341-
@cp docs/podman-remote.1 ./brew/docs/podman.1
342-
@cp docs/podman-remote.conf.5 ./brew/docs/podman-remote.conf.5
343-
@sed -i 's/podman\\*-remote/podman/g' ./brew/docs/podman.1
344-
@sed -i 's/Podman\\*-remote/Podman\ for\ Mac/g' ./brew/docs/podman.1
345-
@sed -i 's/podman\.conf/podman\-remote\.conf/g' ./brew/docs/podman.1
346-
@sed -i 's/A\ remote\ CLI\ for\ Podman\:\ //g' ./brew/docs/podman.1
347-
tar -czvf podman-${RELEASE_NUMBER}.tar.gz ./brew
348-
@rm -rf ./brew
365+
.PHONY: podman-remote-%-release
366+
podman-remote-%-release:
367+
rm -f release.txt
368+
$(MAKE) podman-remote-$(RELEASE_NUMBER)-$*.zip
349369

350370
docker-docs: docs
351371
(cd docs; ./dckrman.sh *.1)

README.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,9 @@ popularized by Kubernetes. Libpod also contains the Pod Manager tool `(Podman)`
88
* [Latest Version: 1.4.4](https://github.com/containers/libpod/releases/latest)
99
* [Continuous Integration:](contrib/cirrus/README.md) [![Build Status](https://api.cirrus-ci.com/github/containers/libpod.svg)](https://cirrus-ci.com/github/containers/libpod/master)
1010
* [GoDoc: ![GoDoc](https://godoc.org/github.com/containers/libpod/libpod?status.svg)](https://godoc.org/github.com/containers/libpod/libpod)
11-
* Latest, automatic binary release downloads:
12-
* Master Branch:
13-
* [Fedora 30](https://storage.cloud.google.com/libpod-master-releases/libpod-master-fedora-30-amd64.zip)
14-
* [Fedora 29](https://storage.cloud.google.com/libpod-master-releases/libpod-master-fedora-29-amd64.zip)
15-
* [Ubuntu 18](https://storage.cloud.google.com/libpod-master-releases/libpod-master-ubuntu-18-amd64.zip)
16-
* [Ubuntu 19](https://storage.cloud.google.com/libpod-master-releases/libpod-master-ubuntu-19-amd64.zip)
17-
* [Windows Client](https://storage.cloud.google.com/libpod-master-releases/podman-remote-master-windows-cc-amd64.zip)
18-
* [MacOS Client](https://storage.cloud.google.com/libpod-master-releases/podman-remote-master-darwin-cc-amd64.zip)
11+
* Automated continuous release downloads (including remote-client):
12+
* Master Branch: [https://storage.cloud.google.com/libpod-master-releases/](https://storage.cloud.google.com/libpod-master-releases/)
13+
* Pull-requests: [https://storage.cloud.google.com/libpod-pr-releases/](https://storage.cloud.google.com/libpod-pr-releases/)
1914

2015
## Overview and scope
2116

contrib/cirrus/build_release.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
source $(dirname $0)/lib.sh
4+
5+
req_env_var TEST_REMOTE_CLIENT OS_RELEASE_ID GOSRC
6+
7+
cd $GOSRC
8+
9+
if [[ "$TEST_REMOTE_CLIENT" == "true" ]] && [[ -z "$CROSS_PLATFORM" ]]
10+
then
11+
CROSS_PLATFORM=linux
12+
fi
13+
14+
if [[ -n "$CROSS_PLATFORM" ]]
15+
then
16+
echo "Compiling podman-remote release archive for ${CROSS_PLATFORM}"
17+
case "$CROSS_PLATFORM" in
18+
linux) ;&
19+
windows) ;&
20+
darwin)
21+
make podman-remote-${CROSS_PLATFORM}-release
22+
;;
23+
*)
24+
die 1 "Unknown/unsupported cross-compile platform '$CROSS_PLATFORM'"
25+
;;
26+
esac
27+
else
28+
echo "Compiling release archive for $OS_RELEASE_ID"
29+
make podman-release
30+
fi

0 commit comments

Comments
 (0)