Fix expiry time for Git SHA tagged Docker images

オープン
#67 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
docker, github-actions
領域
ci-cd, devops

調査の方向性

.github/workflows/build-image.yaml から始め、次に Dockerfile の label と Makefile の QUAY_IMAGE_EXPIRY 設定を調べます。workflow の tag と有効期限の扱いを Quay のイメージ有効期限に関するドキュメントと比較し、main、latest、release の tag は決して期限切れにならず、Git SHA tag は 3 週間後に期限切れになることを確認します。その際、branch-tag の動作は変更しません。

索引モデルが issue の本文から書いたものです。

説明

triage/accepted

Summary

Docker images tagged with Git SHA are not expiring as expected on Quay.io. Currently, SHA-tagged images are set to never expire, leading to storage accumulation.

Current Behavior

Looking at quay.io/kuadrant/developer-portal-controller, images with Git SHA tags (e.g., b2ab687...) do not have an expiry time set.

Expected Behavior

Images should automatically expire based on their tags:

  • Images with main tag: Never expire
  • Images with latest tag: Never expire
  • Release tag images (e.g., v0.4.0, v1.2.3-alpha.1): Never expire
  • Git SHA tagged images: Expire after 3 weeks
  • Branch tagged images (non-main branches): Expire after 3 weeks ✅ (already working correctly)

Root Cause

The issue is in .github/workflows/build-image.yaml. When a push to the main branch occurs:

  1. The metadata action generates multiple tags for a single build: main, latest, and the Git SHA
  2. The expiry logic evaluates to expiry=never because github.ref_name == "main"
  3. The Docker build uses a single QUAY_IMAGE_EXPIRY value for all tags via the LABEL quay.expires-after directive
  4. Result: All tags including the Git SHA inherit quay.expires-after=never

This is a Docker/Quay limitation - you cannot set different expiry times for different tags in the same image build because the label is set at the image layer level, not per-tag.

Possible Solutions

Option 1: Separate Builds for Different Expiry Requirements

Split the image building into separate jobs with different QUAY_IMAGE_EXPIRY build args:

  • Job 1: Build and tag with main and latest (expiry = never)
  • Job 2: Build and tag with Git SHA (expiry = 3w)
Option 2: Use Quay API to Set Tag Expiry Post-Build

After the image is built and pushed, use the Quay API to programmatically set expiration time for the Git SHA tag only.

Additional Context

主要言語
Go
スター
3
フォーク
15
平均マージ
1日 21時間
マージ済み PR(30日)
4

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Kuadrant/developer-portal-controller のほかの issue

Kuadrant/developer-portal-controller の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。