ruffsl

joined 1 year ago
[–] [email protected] 4 points 4 months ago (1 children)

Tagging an image is simply associating a string value to an image pushed to a container registry, as a human readable identifier. Unlike an image ID or image digest sha, an image tag is only loosely associated, and can be remapped later to another image in the same registry repo, e.g latest. Untagging is simply removing the tag from the registry, but not necessarily the associated image itself.

 

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
[–] [email protected] 3 points 5 months ago

I fell for it. It took me a minute into the game time to figure what was up and double check today's date.

13
submitted 5 months ago* (last edited 5 months ago) by [email protected] to c/[email protected]
 

April fool's!

 

I feel like there was a missed opportunity to use some of the spare computing power on the desk to add some helpful navigational autonomy. Like using a backward facing web camera for lane assist, obstacle avoidance, route following, etc. Could leverage something open source like Autoware.org to get most of the way there.

Source video by Joel Creates:
https://youtu.be/mDndd_EzkgA

[–] [email protected] 9 points 1 year ago (2 children)

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.

 

So, a recent skit about agile development from Striped Giraffe reminded me of this silly parody that my CSE PhD colleagues did back at UCSD in 2016 for the holidays. The solo in the middle hits hard, so check the subtitles for the lyrics if you can't catch the jokes as they fly by so fast.

Related:

 

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

Now, I know this isn't quite a meme, given the bad UI here is being used to troll scammers, but this video relates to a popular post here from two months ago, and I thought folks would find this just as humorous in watching others struggle with the same password checker as we all did before:

 

Now, I know this isn't quite a meme, given the bad UI here is being used to troll scammers, but this video relates to a popular post here from two months ago, and I thought folks would find this just as humorous in watching others struggle with the same password checker as we all did before:

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Image Transcription: Meme


A photo of an opened semi-trailer unloading a cargo van, with the cargo van rear door open revealing an even smaller blue smart car inside, with each vehicle captioned as "macOS", "Linux VM" and "Docker" respectively in decreasing font size. Onlookers in the foreground of the photo gawk as a worker opens each vehicle door, revealing a scene like that of russian dolls.


*I'm a human volunteer content transcriber and you could be too! *

[–] [email protected] 1 points 1 year ago

I suspect this comment was posted to spell out the meme for those unfamiliar, but I wanted to thank you for transcribing it into text for those that also may be blind or visually impaired. With the loss of r/TranscribersOfReddit , I salute your contribution! Please keep at it!

https://www.theverge.com/2023/6/23/23771396/reddit-subreddit-community-transcribers-accessibility

view more: next ›