Github action-scp updated for 2021

2021 Had Different Ideas

Welcome to 2021, I decided to post about my plans to blog a bit more in 2021, but the internet gods had conspired against me and made my Github Action action-scp fail. So I started into fixing it. If you see this blog post, it is indeed fixed.

What happened?

No clue, but something on the Github side of things changed in a way that I was starting to fail host key verification, even though it specifically uses StrictHostKeyChecking=no. What to do? Play around.

I tried things like passing a known hosts file, still wasn’t working. I tried changing where the identity file is written, nope. Permissions? Nope. Turns out I was using

scp  "${ARGUMENTS}" "${SOURCE}" "${USERNAME}@${SERVER}":"${DESTINATION}"

That’s it! I was using double quotes around all my parameters. Drop those and things start working again.

Then Docker…

So apparently someone at Docker decided to make the docker/build-push-action do new things. I gotta say, it looks neat, but it is overkill, and not super documented well. The docs make you think you MUST use Buildx and Qemu, that isn’t the case. If you are using version 1, and want to simply drop over, look at this below:

My original:

- name: Build and Push to Docker Hub
        uses: docker/build-push-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_TOKEN }}
          repository: utahcon/scp
          tag_with_ref: true
          tag_with_sha: true
          dockerfile: Containerfile
          tags: latest

The new usage:

      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_TOKEN }}

      - name: Build and Push to Docker Hub
        uses: docker/build-push-action@v2
        with:
          context: .
          file: ./Containerfile
          platforms: linux/amd64
          push: true
          tags: utahcon/scp:latest

Hopefully seeing this will save you some time somewhere. Here’s hoping.