flyctl icon indicating copy to clipboard operation
flyctl copied to clipboard

Local image deploy fails in Github Actions starting with v0.3.7/v0.3.8

Open mikestopcontinues opened this issue 1 year ago • 1 comments

Please only report specific issues with flyctl behavior. Anything like a support request for your application should go to https://community.fly.io. More people watch that space and can help you faster!

Describe the bug

Starting about three weeks ago (presumably with v0.3.7/v0.3.8), flyctl stopped properly deploying locally-built images in Github Actions. Also, it failed silently, so I wasn't alerted to the issue.

I'm certain the container exists with the correct name because I launch it for testing before trying to deploy it to fly.

Previously, the output looked like this...

Good output
==> Verifying app config
Validating apps/myappname/fly.toml
✓ Configuration is valid
--> Verified app config
==> Building image
Searching for image '***-myappname' locally...
image found: sha2[56](https://github.com/browsercat/core/actions/runs/10428003589/job/28883596761#step:15:57):192a58e004d12f32ab00f458566a5813bc81e268e7dec442e5ebbedc085c4d89
==> Pushing image to fly
The push refers to repository [registry.fly.io/***-myappname]
46b42d78f272: Preparing
b07025ce846a: Preparing
3bd4370f06cb: Preparing
...etc...

But now I consistently get this error...

Bad output
==> Verifying app config
--> Verified app config
Validating apps/myappname/fly.toml
✓ Configuration is valid
==> Building image
Searching for image '***-myappname' remotely...
==> Building image
Searching for image '***-myappname' remotely...
Error: failed to fetch an image or build from source: Could not find image "docker.io/library/***-myappname:latest"

Nothing has changed about my CI/CD pipeline, node dependencies, etc.

Here are the relevant yaml/bash:
      - name: Build Container
        id: build
        if: ${{steps.skip.outputs.skip == 0}}
        uses: docker/build-push-action@v6
        with:
          context: ./
          file: ${{env.DOCKERFILE}}
          tags: ${{steps.vars.outputs.APP}}
          platforms: linux/amd64
          cache-from: type=gha,scope=${{steps.vars.outputs.CACHE_KEY}}
          cache-to: type=gha,scope=${{steps.vars.outputs.CACHE_KEY}},mode=max
          builder: ${{steps.buildx.outputs.name}}
          load: true
          build-args: |
            # ...

      - name: Test Container
        if: ${{steps.skip.outputs.skip == 0}}
        env:
          APP: ${{steps.vars.outputs.APP}}
        run: |
          set -x
          cd apps/myappname
          docker run \
            --detach \
            --name $APP \
            --publish 3100:3000 \
            # --env ... \
            $APP
          NODE_ENV=production pnpm turbo run ready
          NODE_ENV=production pnpm run spec:vitest \
            && pnpm run spec:playwright --project $LOCAL_BROWSER_TYPES \
            || { dockerlogs --tail 1000 $APP; exit 1; }
          docker stop $APP

      - name: Set up Fly.io
        if: ${{steps.skip.outputs.skip == 0}}
        uses: superfly/flyctl-actions/setup-flyctl@master

      - name: Deploy Fly.io App
        if: ${{steps.skip.outputs.skip == 0}}
        env:
          APP: ${{steps.vars.outputs.APP}}
        run: |
          cd apps/myappname
          ./scripts/deploy.sh
#!/bin/bash

cd ../../

# Create app in correct org
flyctl apps create $APP --org $FLY_ORG || true

# Update secrets
flyctl secrets set \
  --stage \
  --app $APP \
  # ...
flyctl secrets list --app $APP

# Deploy the app
flyctl deploy \
  --app $APP \
  --config $CONFIG \
  --image $APP \
  --vm-size $MACHINE_SIZE \
  --vm-memory $MACHINE_MEMORY \
  # --env ... \
  --no-public-ips \
  --auto-confirm

I suspect it's not the setup-flyctl action, because that hasn't changed since August.

mikestopcontinues avatar Oct 13 '24 17:10 mikestopcontinues

Hey, I was able to get it working using --local-only. However, the docs for --(local|remote)-only discuss building not referencing. I still get the sense it wasn't your intention to change the default behavior, so I think this still qualifies as a bug.

I'd also like to call your attention again to the silent fails. They are occurring with other cases of failed fly deploy. For example, even after I got deploy to work, the following output did not send an error code:

✔ [464/521] Cleared lease for 48ed64eb716348
✔ [145/521] Cleared lease for 48ed669b777778
✔ [458/521] Cleared lease for 683d527a575208
Error: failed to get current app state: failed to list VMs: context deadline exceeded (Request ID: 01JA86018YEWFR365ZT4YGD4X2-sjc) (Trace ID: 23b1abeee78c2fa92b2274c032d01e43)

mikestopcontinues avatar Oct 15 '24 13:10 mikestopcontinues