iScsc / blog.iscsc.fr

GNU General Public License v3.0
0 stars 7 forks source link

Make `docker compose` returns the container's exit code in build workflow #29

Closed ctmbl closed 4 months ago

ctmbl commented 4 months ago

Fix #22

ctmbl commented 4 months ago

We can see in https://github.com/iScsc/blog.iscsc.fr/actions/runs/7991824421/job/21823913120

Network blogiscscfr_default  Creating
 Network blogiscscfr_default  Created
 Container blogiscscfr-builder-1  Creating
 Container blogiscscfr-builder-1  Created
Attaching to builder-1
builder-1  | Error: add site dependencies: create deps: create PathSpec: Failed to create baseURL from "https://iscsc.fr/ --buildFuture":: parse "https://iscsc.fr/ --buildFuture": invalid character " " in host name
builder-1  | Total in 1 ms
builder-1 exited with code 255
0

with workflow:

      - name: 🛠️ Build with HUGO
        run: |
          docker compose up builder
          echo $?

that the problem is that docker doesn't return an error...

ctmbl commented 4 months ago

with 01cc762..050be13:

-          docker compose up builder
+          docker compose up builder --exit-code-from builder
+          echo $?

We finally get:

Network blogiscscfr_default  Creating
 Network blogiscscfr_default  Created
 Container blogiscscfr-builder-1  Creating
 Container blogiscscfr-builder-1  Created
Attaching to builder-1
builder-1  | Total in 1 ms
builder-1  | Error: add site dependencies: create deps: create PathSpec: Failed to create baseURL from "https://iscsc.fr/ --buildFuture":: parse "https://iscsc.fr/ --buildFuture": invalid character " " in host name
Aborting on container exit...
builder-1 exited with code 255
 Container blogiscscfr-builder-1  Stopping
 Container blogiscscfr-builder-1  Stopped
Error: Process completed with exit code 255.

see https://github.com/iScsc/blog.iscsc.fr/actions/runs/7991998934/job/21824513884 which is what's expected! (note that we never see the echo $? proof that workflow fails before)