Skip to content

Commit

Permalink
Add image building/pushing back to Travis (#835)
Browse files Browse the repository at this point in the history
Got authorization to re-add credentials for image pushing to
Travis via their recommended approach outlined here:
https://docs.travis-ci.com/user/encrypting-files/

Fixes #808

Signed-off-by: John Schnake <jschnake@vmware.com>
  • Loading branch information
johnSchnake committed Aug 14, 2019
1 parent 4c07889 commit 83e39f2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -11,7 +11,7 @@ build/
examples/dev.yaml

# Unencrypted credentials
heptio-images-ee4b0474b93e.json
heptio-images-c14f11347d8b.json

# Dynamic Dockerfiles
Dockerfile-amd64
Expand Down
51 changes: 22 additions & 29 deletions .travis.yml
@@ -1,40 +1,33 @@
sudo: required
language: go
go:
- "1.12"

- '1.12'
services:
- docker

- docker
install: true

script:
- VERBOSE=true make test int
- ./travis-ci.sh

script:
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$TRAVIS_PULL_REQUEST, BRANCH=$BRANCH"
- VERBOSE=true make test int
- ./travis-ci.sh
before_install:
# Download and install Kind
- curl -L https://github.com/kubernetes-sigs/kind/releases/download/v0.4.0/kind-linux-amd64 --output kind && chmod +x kind
- ./kind create cluster --config kind-config.yaml
- export KUBECONFIG="$(./kind get kubeconfig-path --name="kind")"
- curl -L https://github.com/golang/dep/releases/download/v0.5.3/dep-linux-amd64 --output dep && chmod +x dep

- curl -L https://github.com/kubernetes-sigs/kind/releases/download/v0.4.0/kind-linux-amd64
--output kind && chmod +x kind
- ./kind create cluster --config kind-config.yaml
- export KUBECONFIG="$(./kind get kubeconfig-path --name="kind")"
- curl -L https://github.com/golang/dep/releases/download/v0.5.3/dep-linux-amd64 --output
dep && chmod +x dep
before_deploy:
# Install gcloud cli here so it gets cached
- if [ ! -d ${HOME}/google-cloud-sdk ]; then
curl https://sdk.cloud.google.com | bash /dev/stdin --disable-prompts;
fi

- if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash
/dev/stdin --disable-prompts; fi
deploy:
- provider: script
skip_cleanup: true
script: ./travis-deploy.sh
on:
repo: heptio/sonobuoy
all_branches: true

- provider: script
skip_cleanup: true
script: ./travis-deploy.sh
on:
repo: heptio/sonobuoy
all_branches: true
env:
secure: AsGb+4LLxBE9fo8eJMfuwUK3QTt61TC+HDP+GbzRaYPB27usaSouAvqeLJI2jxDU/oNaDlNarb3A43gZIqbZe+0uT8jdrqnv5pGmX4CooNm52zF4QEQrFpERvfFAdbUKkZ11NLXav3S0iLVb8/iWopF0/yvt7h0ohBzNX/tMs7vYeZ5KbKUF8v7Uwg3VmjIHsvfSmtaEvWPi3302O/lo5J1tB6TH8b/bAXWweU8GKmQnQKES/+tUern+zOT0S47/fyRbvG6KbLdttol9k7KbzWZxG2iHcC65ogmdHD2azZmLyL8s5khDkA2rO4ovnOqse2kxmxn7da7y8k93vWaN1y98RpXw4H6brsH15BzoGoYBaMLg/Kn/JbTkSxPkPr/+6WGJ6lFeGgvArkwCXVyRPpecSH55+kvKmD8wxGnXaQp086cNKBiZYgN4C+T/8XXO011CxgjzLCsyyqr2KGI7c1VXvdiDt+fjVUeE/ftbHFdHH8Oc809U+6sa+6UWFxDcg3fsyIDKqUAh+cOYdjL+8+OpNWiV8p7/Yu+QntbfMuRmkyQz9boYZU58uzFGe0B87nu0Y9O6nIKJWu07nPiPP11CU3iv2aYDfg2y1wvyvk5rWSgnBnD82nHf7ip2/bykbsajK2fcX1sIA/3c7NzWtKauxnfTXLxxqBRbZFkOuoE=

after_success:
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash)
Binary file added heptio-images-c14f11347d8b.json.enc
Binary file not shown.
Binary file removed heptio-images-ee4b0474b93e.json.enc
Binary file not shown.
14 changes: 13 additions & 1 deletion travis-deploy.sh
Expand Up @@ -12,8 +12,15 @@ function goreleaser() {
curl -sL https://git.io/goreleaser | bash
}

if [ ! -z "$TRAVIS_TAG" ]; then
function gcr_push() {
openssl aes-256-cbc -K $encrypted_222a2009ef6d_key -iv $encrypted_222a2009ef6d_iv -in heptio-images-c14f11347d8b.json.enc -out heptio-images-c14f11347d8b.json -d
gcloud auth activate-service-account --key-file heptio-images-c14f11347d8b.json
# https://github.com/travis-ci/travis-ci/issues/9905
unset GIT_HTTP_USER_AGENT
IMAGE_BRANCH="$BRANCH" DOCKER="gcloud docker -- " make container push
}

if [ ! -z "$TRAVIS_TAG" ]; then
if [ "$(./sonobuoy version --short)" != "$TRAVIS_TAG" ]; then
echo "sonobuoy version does not match tagged version!" >&2
echo "sonobuoy short version is $(./sonobuoy version --short)" >&2
Expand All @@ -23,4 +30,9 @@ if [ ! -z "$TRAVIS_TAG" ]; then
fi

goreleaser --skip-validate
gcr_push
fi

if [ "$BRANCH" == "master" ]; then
gcr_push
fi

0 comments on commit 83e39f2

Please sign in to comment.