Circle.yml allowed syntax inconsistent with documentation

circle.yml

#1

It looks like the documented syntax for the dependencies section is inconsistent with what is actually allowed.
That fails to validate when building our project:

# circle.yaml file

machine:
  timezone:
    Asia/Jerusalem

dependencies:
  cache_directories:
  -  "~/.go_directories/src"
  pre:
  - sudo add-apt-repository ppa:masterminds/glide -y && sudo apt-get update
    sudo apt-get install glide -y
  override:
  - glide install
      pwd:
        auth
  - glide update
      pwd:
        auth
  - CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w -X main.Version=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match) -X main.BuildDate=$(date -u '+%Y-%m-%d_%I:%M:%S%p')" -a -installsuffix nocgo -o main .
      pwd:
        auth

checkout:
  pre:
  - cp circle/.gitconfig ~/.gitconfig

The error can be seen by clicking on that link on the error text.
Using pwd is allowed by the documentation.


#2

Hi,

Is this a direct copy of your circle.yml file? If so, it looks like many lines are missing the proper indents. As this is a YAML file, everything in the subsections needs to be indented by 2 spaces. For example, in dependencies under pre and under override, the commands should have an additional 2 spaces of indent.

Let’s get that corrected and see if you’re still running into any errors?


#3

That is a direct copy. I intended all the arrays with two empty spaces, but the error is still the same.
That is the new file.

# circle.yaml file

machine:
  timezone:
    Asia/Jerusalem

dependencies:
  cache_directories:
    - "~/.go_directories/src"
  pre:
    - sudo add-apt-repository ppa:masterminds/glide -y && sudo apt-get update
      sudo apt-get install glide -y
  override:
    - glide install
        pwd:
          auth
    - glide update
        pwd:
          auth
    - CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w -X main.Version=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match) -X main.BuildDate=$(date -u '+%Y-%m-%d_%I:%M:%S%p')" -a -installsuffix nocgo -o main .
        pwd:
          auth

checkout:
  pre:
    - cp circle/.gitconfig ~/.gitconfig


#4

I had to hunt down one of mine, but I believe the issue is you need to add a colon at the end of the line before the pwd, something the docs don’t emphasize. Here’s an example.

# Build litecoin
- sudo python setup.py install && cp build/*/ltc_scrypt.so ../:
    pwd: litecoin_scrypt

Does that work?

Ref: Cd command ignored in test section


#5

That seems to work. The document validates now. I think the documentation needs to put an empthasis on the fact, that a colon is needed. Thank you, drazisil.


#6

Glad that fixed it. I’ll file a change request :slight_smile:


#7

I marked @drazisil answer as the solution here. Thanks to him, Docs have been updated as well to add a note on having that colon there. :slight_smile:

Thank you as well to @Thermus for bringing this issue up and helping us improve Docs because of it.


#8