simonw / datasette-publish-fly

Datasette plugin for publishing data using Fly
Apache License 2.0
20 stars 7 forks source link

Return code not non-zero on errors #20

Closed dev-zero closed 1 year ago

dev-zero commented 2 years ago

I have the following in my GHA configuration:

name: Fly Deploy
on: [push]
env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
  deploy:
      name: Deploy app
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v3
        - uses: actions/setup-python@v4
          with:
            python-version: '3.10'
            cache: 'pip'
        - run: pip install -r requirements.txt
        - run: yaml-to-sqlite wfms.db wfms wfms.yaml
        - uses: superfly/flyctl-actions/setup-flyctl@master
        - run: datasette publish fly wfms.db --app workflows --metadata metadata.json --plugins-dir=plugins/ --static assets:static-files/

which failed in the last step with this:


Run datasette publish fly wfms.db --app workflows --metadata metadata.json --plugins-dir=plugins/ --static assets:static-files/
  datasette publish fly wfms.db --app workflows --metadata metadata.json --plugins-dir=plugins/ --static assets:static-files/
  shell: /usr/bin/bash -e {0}
  env:
    FLY_API_TOKEN: ***
    pythonLocation: /opt/hostedtoolcache/Python/3.10.5/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.5/x64/lib/pkgconfig
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.5/x64/lib
==> Verifying app config
--> Verified app config
==> Building image
Waiting for remote builder fly-builder-black-cloud-1435...
Error failed to fetch an image or build from source: error connecting to docker: failed building options: lookup dfw2.gateway.6pn.dev on 127.0.0.53:53: server misbehaving

but GHA did not fail the job, which usually happens when a job returns a non-zero return/error code.

simonw commented 1 year ago

Other commands do this correctly:

https://github.com/simonw/datasette-publish-fly/blob/90b064c88d40936d33e63f548976030b4a331ac1/datasette_publish_fly/__init__.py#L132-L147

But I left that code off the final call to flyctl deploy:

https://github.com/simonw/datasette-publish-fly/blob/90b064c88d40936d33e63f548976030b4a331ac1/datasette_publish_fly/__init__.py#L355-L367

simonw commented 1 year ago

To test this I ran this command which should fail to deploy because the database uses SpatiaLite and I forgot to add --spatialite:

datasette publish fly ../datasette/tests/spatialite.db --app timezones-api-error

And checking the exit code:

% echo $?
1