diff --git a/Dockerfile.build b/Dockerfile.build index 73586fb..ef5acd5 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -14,17 +14,14 @@ FROM analogj/libgit2-xgo MAINTAINER Jason Kulatunga -ARG go_version=1.13.4 -ARG engine_type="golang" - - WORKDIR /go/src/github.com/analogj/capsulecd ENV PATH="/go/src/github.com/analogj/capsulecd:/go/bin:${PATH}" \ SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt # Install build tooling. -RUN echo "go version: $go_version" \ +RUN echo "go version: \ + && go version \ && apt-get update \ && apt-get install -y gcc git build-essential binutils curl apt-transport-https ca-certificates pkg-config --no-install-recommends \ && rm -rf /usr/share/doc && rm -rf /usr/share/man \ @@ -36,13 +33,12 @@ ENV PATH="/go/bin:/usr/local/go/bin:${PATH}" \ GOPATH="/go:${GOPATH}" \ SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt -# install go and dep -RUN which go || (curl -fsSL "https://storage.googleapis.com/golang/go${go_version}.linux-amd64.tar.gz" | tar -xzC /usr/local) \ +# ensure go is configured correctly +RUN which go \ && mkdir -p /go/bin \ && mkdir -p /go/src \ && go get -u gopkg.in/alecthomas/gometalinter.v2 \ - && gometalinter.v2 --install \ - && curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + && gometalinter.v2 --install COPY ./ci/capsulecd.sh /scripts/capsulecd.sh COPY ./ci/development.sh /scripts/development.sh diff --git a/cmd/capsulecd/capsulecd.go b/cmd/capsulecd/capsulecd.go index 4dd6a24..dd7f0fe 100644 --- a/cmd/capsulecd/capsulecd.go +++ b/cmd/capsulecd/capsulecd.go @@ -61,7 +61,7 @@ func main() { configuration.Set("package_type", c.String("package_type")) //config.Set("dry_run", c.String("dry_run")) - //load configuration file. + //override system configuration file (default: ~/capsule.yaml) if c.String("config_file") != "" { absConfigPath, err := filepath.Abs(c.String("config_file")) if err != nil { @@ -119,7 +119,7 @@ func main() { &cli.StringFlag{ Name: "config_file", - Usage: "Specifies the location of the config file", + Usage: "Specifies the location of the system config file", }, }, }, diff --git a/example.capsule.yml b/example.capsule.yml index 8be396f..8158247 100644 --- a/example.capsule.yml +++ b/example.capsule.yml @@ -106,6 +106,9 @@ scm_disable_cleanup: false engine_git_author_email: 'capsulecd@users.noreply.github.com' engine_git_author_name: 'CapsuleCD' +# Specifies the path to the repo config file, relative to the project root +engine_repo_config_path: 'capsule.yml' + ############################################################################### # # Engine Custom Configuration diff --git a/pkg/config/config.go b/pkg/config/config.go index 0c9ebeb..4f9129f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -40,10 +40,11 @@ func (c *configuration) Init() error { c.SetDefault("scm_notify_source", "CapsuleCD") c.SetDefault("scm_notify_target_url", "https://github.com/AnalogJ/capsulecd") - c.SetDefault("engine_git_author_name", "CapsuleCD") c.SetDefault("engine_git_author_email", "CapsuleCD@users.noreply.github.com") + c.SetDefault("engine_repo_config_path", "capsule.yml") + //set the default system config file search path. //if you want to load a non-standard location system config file (~/capsule.yml), use ReadConfig //if you want to load a repo specific config file, use ReadConfig diff --git a/pkg/pipeline.go b/pkg/pipeline.go index f1ca4b2..5b9aaea 100644 --- a/pkg/pipeline.go +++ b/pkg/pipeline.go @@ -217,7 +217,7 @@ func (p *Pipeline) ScmCheckoutPushPayloadStep(payload *scm.Payload) error { func (p *Pipeline) ParseRepoConfig() error { log.Println("parse_repo_config") // update the config with repo config file options - repoConfig := path.Join(p.Data.GitLocalPath, "capsule.yml") + repoConfig := path.Join(p.Data.GitLocalPath, p.Config.GetString("engine_repo_config_path")) if utils.FileExists(repoConfig) { if err := p.Config.ReadConfig(repoConfig); err != nil { return errors.New("An error occured while parsing repository capsule.yml file")