97
96

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
-66

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

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

26
13
submitted 3 months ago* (last edited 3 months ago) by ruffsl@programming.dev to c/programmer_humor@programming.dev

April fool's!

21
submitted 3 months ago* (last edited 3 months ago) by ruffsl@programming.dev to c/nix@programming.dev

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

April fool's!

10
206
36
submitted 3 months ago by ruffsl@programming.dev to c/nix@programming.dev

Wow! Didn't know it'd be that simple.

14

Note: video sponsored by Docker

404
submitted 4 months ago by ruffsl@programming.dev to c/linux@lemmy.ml

For three years there has been a bug report around 4K@120Hz being unavailable via HDMI 2.1 on the AMD Linux driver.

The wait continues...

33
[-] ruffsl@programming.dev 10 points 7 months ago

I was thinking of cross posting this to a Fortran community, but it looks like we don't yet have one.

[-] ruffsl@programming.dev 13 points 9 months ago

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

[-] ruffsl@programming.dev 8 points 9 months ago

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

[-] ruffsl@programming.dev 9 points 9 months ago

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 9 points 9 months ago

Private Eye - essential for staying online 24/7

What was that device, an early cellular modem or 802.11 wireless bridge? The thing ontop of the briefcase looks like a head visor with an antenna. Google search keywords are just noise.

[-] ruffsl@programming.dev 18 points 9 months ago

Do we have a community for computer architectures or computer science on this instance or anywhere else?

[-] ruffsl@programming.dev 7 points 11 months ago
[-] ruffsl@programming.dev 21 points 11 months ago

Pro tip: If you check the conical URL (youtube.com) first, the Lemmy web UI will help catch reposts before they are accidentally submitted.

https://programming.dev/post/1466264

I switched from using the short (e.g youtube.be) or external URL mirrors for that same reason, and just let the bots comment with privacy mirrors for those who prefer. Using the conical URL, aside from cross post detection, also ensures the thumbnail image and preview text get cached consistently.

[-] ruffsl@programming.dev 15 points 11 months ago

Can you imagine the eye strain one would get programming on a translucent screen every day? One where your always having to keep your eyes focused on semi transparent text and graphical interfaces in the foreground, and not the distracting and ever changing background, continuously shifting in parallax as you adjust your head and viewing angle. Not having my display buttressed up against a wall, or having to deal with glare and screen reflections, or even low contrast monitors in general are all things I find infuriating already.

But I guess the Sci-Fi future of ergonomics is holograms. *You must have your migraines, and you must enjoy them.

[-] ruffsl@programming.dev 17 points 11 months ago

Could go the other way though. Ask them nicely if they'd be willing to free up their heap of inventory, and if they return you a cart overflow, you know you've stumbled upon the ultimate zero day coupon.

[-] ruffsl@programming.dev 10 points 1 year ago

For anybody wondering what the Mastodon security issue is - CVE-2023-36460, you can send a toot which makes a webshell on instances that process said toot. #CVE202336460 #TootRoot

view more: next ›

ruffsl

joined 1 year ago
MODERATOR OF