Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
Merge f219d2e into 2d099de
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ authored Nov 23, 2019
2 parents 2d099de + f219d2e commit ac1ac38
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
14 changes: 5 additions & 9 deletions Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@
FROM analogj/libgit2-xgo
MAINTAINER Jason Kulatunga <[email protected]>

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 \
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cmd/capsulecd/capsulecd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions example.capsule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ scm_disable_cleanup: false
engine_git_author_email: '[email protected]'
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
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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", "[email protected]")

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
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ac1ac38

Please sign in to comment.