ruffsl

joined 2 years ago
MODERATOR OF
 

Just a short elevator pitch that was posted today in that 100 seconds format. Maybe useful in introducing others.

 

I had to go full Rube Goldberg to clean up old image tags from closed PRs, while still leaving deletion of untagged image to the ECR repo's own lifecycle policy. Never go full Rube Goldberg:

name: ECR Retention Policy

on:
  pull_request:
    types:
      - closed
  workflow_call:
  workflow_dispatch:

jobs:
  clean-unused-ecr:
    name: Delete unused container images
    runs-on: runs-on,runner=2cpu-linux-x64,run-id=${{ github.run_id }},image=ecr_login_image
    steps:
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          aws-region: ${{ env.RUNS_ON_AWS_REGION }}
      - name: AWS ECR Login
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v2
      - name: AWS ECR Info
        shell: bash
        run: |
          echo "ECR_REGISTRY=${{ steps.login-ecr.outputs.registry }}" >> $GITHUB_ENV
          echo "ECR_REPO=$(basename ${{ github.repository }})" >> $GITHUB_ENV
      - name: Docker meta
        id: docker_meta
        uses: docker/metadata-action@v5
        with:
          images: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPO }}
          flavor: suffix=-
          tags: type=raw,value=${{ github.head_ref || github.ref_name }}
      # NOTE: This is convoluted because AWS ECR has no simple way to untag image without deletion
      # given we want to leave deletion of untagged image to the ECR repo's own lifecycle policy
      # https://stackoverflow.com/questions/70065254/remove-ecr-image-tag-despite-imagereferencedbymanifestlist-error
      # https://github.com/aws/containers-roadmap/issues/1567
      - name: AWS ECR Cleanup
        shell: bash
        run: |
          REPO_EXISTS=$(aws ecr describe-repositories --repository-names $ECR_REPO 2>&1 || true)
          if echo "${REPO_EXISTS}" | grep -q 'RepositoryNotFoundException'; then
            echo "Repository not found, skipping cleanup."
            exit 0
          fi
          IMAGE_TAGS=$(aws ecr list-images --repository-name $ECR_REPO --query 'imageIds[*].imageTag' --output text)

          docker pull busybox
          docker tag busybox $ECR_REGISTRY/$ECR_REPO:_
          docker push $ECR_REGISTRY/$ECR_REPO:_

          TEMP_IMAGE=$(
            aws ecr batch-get-image \
                --repository-name $ECR_REPO \
                --image-ids imageTag=_ )
          TEMP_MANIFEST=$(echo $TEMP_IMAGE | jq -r '.images[].imageManifest')
          TEMP_DIGEST=$(echo $TEMP_IMAGE | jq -r '.images[].imageId.imageDigest')

          TAG_PREFIX=$(echo ${{ fromJSON(steps.docker_meta.outputs.json).tags[0] }} | cut -d: -f2)
          for TAG in $IMAGE_TAGS
          do
            if [[ $TAG == $TAG_PREFIX* ]]; then
              docker tag busybox $ECR_REGISTRY/$ECR_REPO:$TAG
              docker push $ECR_REGISTRY/$ECR_REPO:$TAG
              echo "Untaged image $TAG"
            fi
          done

          # Delete the temporary image by digest
          aws ecr batch-delete-image \
            --repository-name $ECR_REPO \
            --image-ids imageDigest=$TEMP_DIGEST
 

cross-posted from: https://programming.dev/post/12247721

🔥 🚢 overviews the recent supply chain attack on XZ library.

 

April fool's!

[–] ruffsl@programming.dev 2 points 2 years ago (1 children)

I'm not sure why, but GitHub's search engine, Blackbird, seems to be returning some erroneous results for this query:

Any chance you could narrow down your search to a list of repose that use the library that pulls in tnt_select() function, then clone and manually grep just those, or is it's use too common to index by?

Real funny that even narrowing down GitHub search to just the same repo doesn't help the query results:

[–] ruffsl@programming.dev 1 points 2 years ago* (last edited 2 years ago) (1 children)

Ah, I've got a old android phone that could be perfect for this. Thanks for the heads up about Macro Deck!

By the way, does Macro Deck utilize multi touch support? That could enable the use of modifier keys to expand the button functionality, without having the add so many dedicated buttons. For example, the video makes use of modifier for individually switching the keyboard and mouse without changing the video, in case using a multi screen KVM setup.

[–] ruffsl@programming.dev 2 points 2 years ago

That was really cool and got me inspired! Thanks for cross posting.

[–] ruffsl@programming.dev 1 points 2 years ago (1 children)

Is this like multi window support, or just floating panels within the VS code window's canvas?

For dual screen setups, sometimes I end up opening two instances of VS code for the same workspace, which seems a bit overkill.

[–] ruffsl@programming.dev 3 points 2 years ago (1 children)

I think you need two spaces before a line break, or double carriage returns, before starting a bullet list. That's the original markdown spec anyways. Other markdown flavors, like what GitHub uses are a little more forgiving with that but are then non standard.

[–] ruffsl@programming.dev 11 points 2 years ago

Pain... This too painful to be posted as just a meme...

[–] ruffsl@programming.dev 8 points 2 years ago (1 children)

Perhaps, is there an engineering meme community I could cross post this to?

[–] ruffsl@programming.dev 3 points 2 years ago

It looks like another project outlined in the Bevy blogs that is also listed in steam (planned for release 2024) is Tiny Glade:

[–] ruffsl@programming.dev 8 points 2 years ago (2 children)

Does anyone have a favorite commercial game know to be developed using Bevy? Available on steam, Google Play, etc.

I know Bevy has a web site of indexing games from hackathons and what not, but I was more interested in seeing any commercially published titles.

[–] ruffsl@programming.dev 7 points 2 years ago* (last edited 2 years ago) (1 children)

Any details on your setup?

  1. Do you use any ventilation to circulate the heated air through home?
  • E.g. do you place them in the basement and rely on raising connection l convention of heat, or dispersed around your living spaces?
  1. What scale of computing hardware do you host?
  • Retired server racks into a home lab?
  1. What grade of insulation is your home, the scale of the household?
  • built for what kind of winter climate zone in your geography?

Thanks!

[–] ruffsl@programming.dev 4 points 2 years ago (1 children)

How did you delimit the leaf pattern so evenly around the circumference of the brim of the bowl? Did you use a rotary indexer and a wood burning jig?

view more: ‹ prev next ›