issue with docker/build-push-action@v2, fly registry and caching

.

It was working fine until i deleted the apps via the website. i tried removed the “cache-from” and associated code. tried upgrading buildx to use latest version, but to no avail, please help!

this is my yml file:

on:
  pull_request:
    types: [opened, reopened, synchronize, closed] 
    # this should not deploy the app when the pr is closed

env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
  FLY_REGION: iad
  DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
  DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

jobs:
  # containerd:
  #   runs-on: ubuntu-latest
  #   steps:
  #     -
  #       name: Checkout
  #       uses: actions/checkout@v2
  #     -
  #       name: Set up QEMU
  #       uses: docker/setup-qemu-action@v1
  #     -
  #       name: Set up Docker Buildx
  #       uses: docker/setup-buildx-action@v1
  #       with:
  #         buildkitd-flags: --debug
  #     -
  #       name: Set up containerd
  #       uses: crazy-max/ghaction-setup-containerd@v1
  #     -
  #       name: Build Docker image
  #       uses: docker/build-push-action@v2
  #       with:
  #         context: .
  #         platforms: linux/amd64,linux/arm64
  #         tags: docker.io/user/app:latest
  #         outputs: type=oci,dest=/tmp/image.tar
  #     -
  #       name: Import image in containerd
  #       run: |
  #         sudo ctr i import --base-name docker.io/user/app --digests --all-platforms /tmp/image.tar
  #     -
  #       name: Push image with containerd
  #       run: |
  #         sudo ctr --debug i push --user "${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}" docker.io/user/app:latest
  
  build:
    name: 🐳 Build staging
    runs-on: ubuntu-latest
    steps:
      - name: 🛑 Cancel Previous Runs
        uses: styfle/cancel-workflow-action@0.9.1

      - name: ⬇️ Checkout repo
        uses: actions/checkout@v3
      
      - name: What
        run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV

      - name: 👀 Read app name
        uses: SebRollen/toml-action@v1.0.0
        id: app_name
        with:
          file: "fly.toml"
          field: "app"

      - name: log app name
        run: echo "The selected app name is ${{ steps.app_name.outputs.value }}"

      - name: 🐳 Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      # Setup cache  
            
      - name: 🔑 Fly Registry Auth
        uses: docker/login-action@v1
        with:
          registry: registry.fly.io
          username: x
          password: ${{ secrets.FLY_API_TOKEN }}

      - name: 🐳 Docker build
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          tags: registry.fly.io/${{ steps.app_name.outputs.value }}:${{ env.BRANCH }}-${{ github.sha }}
          build-args: |
            COMMIT_SHA=${{ github.sha }}
          cache-from: type=local,src=/tmp/.buildx-cache
          cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

      # This ugly bit is necessary if you don't want your cache to grow forever
      # till it hits GitHub's limit of 5GB.
      # Temp fix
      # https://github.com/docker/build-push-action/issues/252
      # https://github.com/moby/buildkit/issues/1896
      - name: 🚚 Move cache
        run: |
          rm -rf /tmp/.buildx-cache
          mv /tmp/.buildx-cache-new /tmp/.buildx-cache
  deploy:
    name: 🚀 Deploy staging
    runs-on: ubuntu-latest

    # Only run one deployment at a time per PR.
    concurrency:
      group: pr-${{ github.event.number }}

    # Create a GitHub deployment environment per staging app so it shows up
    # in the pull request UI.
    environment:
      name: pr-${{ github.event.number }}
      url: ${{ steps.deploy.outputs.url }}

    steps:
      - name: 🛑 Cancel Previous Runs
        uses: styfle/cancel-workflow-action@0.9.1

      - name: ⬇️ Checkout repo
        uses: actions/checkout@v2

      - name: 👀 Read app name
        uses: SebRollen/toml-action@v1.0.0
        id: app_name
        with:
          file: "fly.toml"
          field: "app"

      - name: 👀 Read app org
        uses: SebRollen/toml-action@v1.0.0
        id: app_org
        with:
          file: "fly.toml"
          field: "FLY_ORG"

      - name: 🚀 Deploy PR Branches
        if: ${{ github.ref != 'refs/heads/main' }}
        id: deploy_pr
        uses: superfly/fly-pr-review-apps@1.0.0
        # uses: superfly/flyctl-actions@1.3
        with:
          org: "open-study-college"
          name: pr-${{ github.event.number }}-${{ steps.app_name.outputs.value }}
          args: "deploy --app ${{ steps.app_name.outputs.value }}-staging --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ env.BRANCH }}-${{ github.sha }}"
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}```

Further info, when I try to manually deploy, I get the following error message

Hello, each app has an associated repository registry.fly.io/<app_name> to which flyctl pushes the image you build with flyctl deploy. You are getting this app repository not found because the repository was removed when you deleted the app.

dear Rugwiro,

thank you for the response, how can i fix this for manual deployment.

furthermore, with regards to the GitHub actions, i created an app for each PR and was testing the workflow, is it possible there is a docker manifest remaining for each of the old repos that points to the cache? (sorry, I’m still pretty new to docker)

Kind regards
Alym

the fly.registry is private so i cant see what is remaining in there, is there any way to delete all details associated with the applications , so i can start over?

Hey running flyctl launch fixed all of my problemns, thank you for the help, awesome community!