Skip to content

Commit 83e39f2

Browse files
authored
Add image building/pushing back to Travis (#835)
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 <[email protected]>
1 parent 4c07889 commit 83e39f2

5 files changed

+36
-31
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build/
1111
examples/dev.yaml
1212

1313
# Unencrypted credentials
14-
heptio-images-ee4b0474b93e.json
14+
heptio-images-c14f11347d8b.json
1515

1616
# Dynamic Dockerfiles
1717
Dockerfile-amd64

.travis.yml

+22-29
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,33 @@
11
sudo: required
22
language: go
33
go:
4-
- "1.12"
5-
4+
- '1.12'
65
services:
7-
- docker
8-
6+
- docker
97
install: true
10-
11-
script:
12-
- VERBOSE=true make test int
13-
- ./travis-ci.sh
14-
8+
script:
9+
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
10+
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$TRAVIS_PULL_REQUEST, BRANCH=$BRANCH"
11+
- VERBOSE=true make test int
12+
- ./travis-ci.sh
1513
before_install:
16-
# Download and install Kind
17-
- curl -L https://github.com/kubernetes-sigs/kind/releases/download/v0.4.0/kind-linux-amd64 --output kind && chmod +x kind
18-
- ./kind create cluster --config kind-config.yaml
19-
- export KUBECONFIG="$(./kind get kubeconfig-path --name="kind")"
20-
- curl -L https://github.com/golang/dep/releases/download/v0.5.3/dep-linux-amd64 --output dep && chmod +x dep
21-
14+
- curl -L https://github.com/kubernetes-sigs/kind/releases/download/v0.4.0/kind-linux-amd64
15+
--output kind && chmod +x kind
16+
- ./kind create cluster --config kind-config.yaml
17+
- export KUBECONFIG="$(./kind get kubeconfig-path --name="kind")"
18+
- curl -L https://github.com/golang/dep/releases/download/v0.5.3/dep-linux-amd64 --output
19+
dep && chmod +x dep
2220
before_deploy:
23-
# Install gcloud cli here so it gets cached
24-
- if [ ! -d ${HOME}/google-cloud-sdk ]; then
25-
curl https://sdk.cloud.google.com | bash /dev/stdin --disable-prompts;
26-
fi
27-
21+
- if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash
22+
/dev/stdin --disable-prompts; fi
2823
deploy:
29-
- provider: script
30-
skip_cleanup: true
31-
script: ./travis-deploy.sh
32-
on:
33-
repo: heptio/sonobuoy
34-
all_branches: true
35-
24+
- provider: script
25+
skip_cleanup: true
26+
script: ./travis-deploy.sh
27+
on:
28+
repo: heptio/sonobuoy
29+
all_branches: true
3630
env:
3731
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=
38-
3932
after_success:
40-
- bash <(curl -s https://codecov.io/bash)
33+
- bash <(curl -s https://codecov.io/bash)

heptio-images-c14f11347d8b.json.enc

2.28 KB
Binary file not shown.

heptio-images-ee4b0474b93e.json.enc

-2.28 KB
Binary file not shown.

travis-deploy.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ function goreleaser() {
1212
curl -sL https://git.io/goreleaser | bash
1313
}
1414

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

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

2532
goreleaser --skip-validate
33+
gcr_push
2634
fi
35+
36+
if [ "$BRANCH" == "master" ]; then
37+
gcr_push
38+
fi

0 commit comments

Comments
 (0)