From 3a22094484f2131b47aa06465102fc25aa084186 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 11 Feb 2014 15:44:39 -0700 Subject: [PATCH] added code to ignore S3 builds when no access key or secret provided --- .drone.yml | 5 +++++ pkg/plugin/publish/s3.go | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/.drone.yml b/.drone.yml index e8bda6991..bccff9514 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,5 +1,10 @@ image: go1.2 +env: + - GOROOT=/usr/local/go + - GOPATH=/var/cache/drone + - PATH=$GOPATH/bin:$GOPATH/bin:$PATH script: + - sudo apt-get -y install libsqlite3-dev sqlite3 mercurial bzr 1> /dev/null 2> /dev/null - make deps - make - make test diff --git a/pkg/plugin/publish/s3.go b/pkg/plugin/publish/s3.go index 029b0b5fc..079be15c0 100644 --- a/pkg/plugin/publish/s3.go +++ b/pkg/plugin/publish/s3.go @@ -51,6 +51,14 @@ type S3 struct { } func (s *S3) Write(f *buildfile.Buildfile) { + + // skip if AWS key or SECRET are empty. A good example for this would + // be forks building a project. S3 might be configured in the source + // repo, but not in the fork + if len(s.Key) == 0 || len(s.Secret) == 0 { + return + } + // install the AWS cli using PIP f.WriteCmdSilent("[ -f /usr/bin/sudo ] || pip install awscli 1> /dev/null 2> /dev/null") f.WriteCmdSilent("[ -f /usr/bin/sudo ] && sudo pip install awscli 1> /dev/null 2> /dev/null")