ArjenSchwarz / wercker-step-hugo-build

Wercker Step for building Hugo sites
45 stars 19 forks source link

"No source directory found" #42

Closed zetxek closed 7 years ago

zetxek commented 7 years ago

I've come across an error while running step:

Error: Error building site: No source directory found, expecting to find it at /pipeline/source/content

I've only found a reference to the issue at the hugo forum (https://discourse.gohugo.io/t/automated-hugo-deployments-anywhere-using-wercker/539), but I cannot figure out what's causing it. Locally, the project works.

Build log: build.log

Project source: https://bitbucket.org/zetxek/adrianmoreno.info/

Any idea?

ArjenSchwarz commented 7 years ago

@zetxek that's weird. It seems to indicate there's no code there, which doesn't make any sense. Can you try doing an ls statement on the directory? More specifically, please add the following to your build steps (in between your echo statement and the arjen/wercker-build).

- script:
        name: debug
        code: |
          echo "Current path:"
          ls
          echo "Hardcoded path:"
          ls /pipeline/source/content
          echo "source dir: ${WERCKER_SOURCE_DIR}"
          ls ${WERCKER_SOURCE_DIR}

I'd love to see the output of this, to see if there's anything wrong with the config at any point. Otherwise I'll probably clone your repo and do some debugging myself to see if I can find the underlying issue.

zetxek commented 7 years ago

Sure thing! As last time in the forum you didn't get more debug info, I thought it'd be nice to share as much as possible :-)

I've added also the current path:

    - script:
        name: debug
        code: |
          echo "Current path:"
          pwd
          echo "Current path content:"
          ls
          echo "Hardcoded path:"
          ls /pipeline/source/content
          echo "source dir: ${WERCKER_SOURCE_DIR}"
          ls ${WERCKER_SOURCE_DIR}

I got this:

export WERCKER_STEP_ROOT="/pipeline/script-b14ab860-a784-4f29-8435-eed2f71ffaa2"
export WERCKER_STEP_ID="script-b14ab860-a784-4f29-8435-eed2f71ffaa2"
export WERCKER_STEP_OWNER="wercker"
export WERCKER_STEP_NAME="script"
export WERCKER_REPORT_NUMBERS_FILE="/report/script-b14ab860-a784-4f29-8435-eed2f71ffaa2/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/script-b14ab860-a784-4f29-8435-eed2f71ffaa2/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/script-b14ab860-a784-4f29-8435-eed2f71ffaa2/artifacts"
source "/pipeline/script-b14ab860-a784-4f29-8435-eed2f71ffaa2/run.sh" < /dev/null
Current path:
/pipeline/source
Current path content:
archetypes
config.yml
i18n
layouts
static
themes
wercker.yml
Hardcoded path:
ls: cannot access '/pipeline/source/content': No such file or directory

And well, that's the raw content of the repo: https://bitbucket.org/zetxek/adrianmoreno.info/src

My repo only uses a multilingual index. Shall I create a placeholder to check?

zetxek commented 7 years ago

Actually, that was it. I've uploaded a placeholder file to the content directory, to just have it present in the repo, and it has worked (https://bitbucket.org/zetxek/adrianmoreno.info/commits/d9034531016671559d620377a59c66f1b9ce38ab).

build.log

ArjenSchwarz commented 7 years ago

Interesting. When it runs on your local machine, is the content directory present already or does it work there without it being present? If the latter I'll add something to automatically create the directory if it doesn't exist.

zetxek commented 7 years ago

I've reproduced it. When creating the site, in the machine, the folder was present since the beginning. When I checked out the project in another computer - as the folder was empty, it had not been committed to git, and it failed.

TL;DR: your idea seems pretty legit, a sanity check to verify that /content exists wouldn't hurt :-)

ArjenSchwarz commented 7 years ago

@zetxek I've pushed a fix for this that will ensure the content directory is present, which is now available in the latest version. Thanks for reporting and helping figure out the issue!