Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing up CI scripts to publish correctly #963

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
enabled: true
steps:
- checkout
- run:
name: "Build Sonobuoy to ensure version"
command: make build_sonobuoy && sudo mv ./sonobuoy /usr/local/bin
- run: ./scripts/ci/publish.sh

build_and_test:
Expand Down
15 changes: 10 additions & 5 deletions scripts/ci/publish.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash

# Don't fail silently when a step doesn't succeed
set -e
set -ex

if [ -z "$CIRCLECI" ]; then
echo "this script is intended to be run only on travis" >&2
echo "this script is intended to be run only on CircleCI" >&2
exit 1
fi
SONOBUOY_CLI="${SONOBUOY_CLI:-sonobuoy}"

function goreleaser() {
curl -sL https://git.io/goreleaser | bash
Expand All @@ -18,18 +19,22 @@ function image_push() {
}

if [ ! -z "$CIRCLE_TAG" ]; then
if [ "$(./sonobuoy version --short)" != "$CIRCLE_TAG" ]; then
if [ "$($SONOBUOY_CLI version --short)" != "$CIRCLE_TAG" ]; then
echo "sonobuoy version does not match tagged version!" >&2
echo "sonobuoy short version is $(./sonobuoy version --short)" >&2
echo "sonobuoy short version is $($SONOBUOY_CLI version --short)" >&2
echo "tag is $CIRCLE_TAG" >&2
echo "sonobuoy full version info is $(./sonobuoy version)" >&2
echo "sonobuoy full version info is $($SONOBUOY_CLI version)" >&2
exit 1
fi

goreleaser --skip-validate
image_push
else
echo "CIRCLE_TAG not set, not running goreleaser"
fi

if [ "$CIRCLE_BRANCH" == "master" ]; then
image_push
else
echo "CIRCLE_BRANCH not master, not pushing images"
fi