Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
fix: idempotent publishes
Browse files Browse the repository at this point in the history
So we can rebuild in the face of temporary failure
  • Loading branch information
nickatsegment committed Apr 18, 2019
1 parent e21c49b commit 4e1230e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
28 changes: 25 additions & 3 deletions Makefile.release
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@

include Makefile

# use bash so we can use set -o pipefail
SHELL := /bin/bash

# set --pre-release if not tagged or tree is dirty or there's a `-` in the tag
ifneq (,$(findstring -,$(VERSION)))
GITHUB_RELEASE_FLAGS := "--pre-release"
PACKAGECLOUD_NAME_SUFFIX := "-prerelease"
endif

# TODO: use this consistently; 99% of the time, we don't want a v
VERSION_NO_V := $(patsubst v%,%,$(VERSION))

PACKAGECLOUD_DEB_DISTROS := \
debian/stretch \
ubuntu/trusty \
Expand Down Expand Up @@ -41,7 +47,12 @@ github-release:
--repo aws-okta \
$(GITHUB_RELEASE_FLAGS) \
--tag $(VERSION) \
--name $(VERSION)
--name $(VERSION) || \
github-release info \
--security-token $$GH_LOGIN \
--user segmentio \
--repo aws-okta \
--tag $(VERSION)

publish-github-darwin-bin: dist/aws-okta-$(VERSION)-darwin-amd64 | github-release
github-release upload \
Expand All @@ -50,6 +61,7 @@ publish-github-darwin-bin: dist/aws-okta-$(VERSION)-darwin-amd64 | github-releas
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta-$(VERSION)-darwin-amd64 \
--replace \
--file $<

publish-github-linux-bin: dist/aws-okta-$(VERSION)-linux-amd64 | github-release
Expand All @@ -59,6 +71,7 @@ publish-github-linux-bin: dist/aws-okta-$(VERSION)-linux-amd64 | github-release
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta-$(VERSION)-linux-amd64 \
--replace \
--file $<

publish-github-deb: dist/aws-okta_$(VERSION)_amd64.deb | github-release
Expand All @@ -68,6 +81,7 @@ publish-github-deb: dist/aws-okta_$(VERSION)_amd64.deb | github-release
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta_$(VERSION)_amd64.deb \
--replace \
--file $<

publish-github-rpm: dist/aws-okta_$(VERSION)_amd64.rpm | github-release
Expand All @@ -77,6 +91,7 @@ publish-github-rpm: dist/aws-okta_$(VERSION)_amd64.rpm | github-release
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta_$(VERSION)_amd64.rpm \
--replace \
--file $<

publish-github-sha256sums: dist/aws-okta-$(VERSION).sha256sums | github-release
Expand All @@ -86,6 +101,7 @@ publish-github-sha256sums: dist/aws-okta-$(VERSION).sha256sums | github-release
--repo aws-okta \
--tag $(VERSION) \
--name aws-okta-$(VERSION).sha256sums \
--replace \
--file dist/aws-okta-$(VERSION).sha256sums

packagecloud.conf.json:
Expand All @@ -95,13 +111,19 @@ packagecloud.conf.json:
# so we attempt to filter that out

publish-packagecloud-deb: dist/aws-okta_$(VERSION)_amd64.deb packagecloud.conf.json
@for v in $(PACKAGECLOUD_DEB_DISTROS); do \
@set -o pipefail; \
for v in $(PACKAGECLOUD_DEB_DISTROS); do \
(package_cloud yank --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v aws-okta_$(VERSION_NO_V)_amd64.deb || true) | \
grep -v 'with token:' || true ; \
package_cloud push --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v $< | \
grep -v 'with token:' ; \
done

publish-packagecloud-rpm: dist/aws-okta_$(VERSION)_amd64.rpm packagecloud.conf.json
@for v in $(PACKAGECLOUD_RPM_DISTROS); do \
@set -o pipefail; \
for v in $(PACKAGECLOUD_RPM_DISTROS); do \
(package_cloud yank --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v aws-okta-$(subst -,_,$(VERSION_NO_V))-1.x86_64.rpm || true) | \
grep -v 'with token:' || true ; \
package_cloud push --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v $< | \
grep -v 'with token:' ; \
done
Expand Down
2 changes: 1 addition & 1 deletion vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
"revisionTime": "2016-04-24T05:23:52Z"
},
{
"checksumSHA1": "DYv6Q1+VfnUVxMwvk5IshAClLvw=",
"checksumSHA1": "x/C9sWJ33glBGKgGvb8VvUQvR8s=",
"path": "github.com/sirupsen/logrus",
"revision": "5e5dc898656f695e2a086b8e12559febbfc01562",
"revisionTime": "2017-05-15T10:45:16Z"
Expand Down

0 comments on commit 4e1230e

Please sign in to comment.