I created a spec.yaml file with the line source_dir: src in it. I created my app and pushed it with doctl apps create --spec spec.yaml - all good so far.

After a few minutes the build failed, saying it couldn’t find a file that exists in the repo I pointed the spec to, but not within the src folder. Ok this makes sense: source_dir should just be the whole folder in my case, rather than src.

I tried to repair this by:

  • removing the source_dir line the yaml file
  • Setting it to source_dir: ./ and then source_dir: /

Every change correctly restarted the build when I pushed it to my repo, so:

github:
      branch: main
      deploy_on_push: true

In the spec was working well.

Problem

On every rebuild, the $SOURCE_DIR = src remained, and indeed I’d see Using build context /workspace/src in the logs, and get the error again.

Expected

I expected one of my attempts to correctly set $SOURCE_DIR to give a build context of just /workspace.

Best Guess

Perhaps the github setup is correctly causing DO to listen to my repo, but not to update the spec itself.

Or there’s just some bad caching happening, and even my attempts to set source_dir in the spec didn’t work because they were invalid

Workaround

I deleted the app, removed the line from the spec and relaunched it. That worked.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Update:

I think it’s because this isn’t how you can update your spec. You have to do it with e.g. doctl apps update or some other method; it won’t update based on the target repo.

Submit an Answer