標準リポジトリを作成する

このページでは、Artifact Registry の標準リポジトリを作成する方法について説明します。

標準リポジトリは、限定公開アーティファクト用のリポジトリです。アーティファクトは、標準リポジトリにアップロードし、標準リポジトリから直接ダウンロードします。

一部のアーティファクト形式では、次のリポジトリ モードもご利用いただけます。

  • リモート リポジトリは、外部ソースからのアーティファクト(Docker Hub、Maven Central、PyPI など)を保存します。
  • 仮想リポジトリは、アップストリームの標準リポジトリまたはリモート リポジトリにあるアーティファクトをダウンロード、インストール、デプロイするための単一のアクセス ポイントとして機能します。

各リポジトリには、一種類のサポートされている形式のアーティファクトを含めることができます。

始める前に

  1. Artifact Registry を有効にします。これには Artifact Registry API の有効化と、Google Cloud CLI のインストールが含まれます。
  2. (省略可)gcloud コマンドのデフォルトを構成します。
  3. リポジトリのコンテンツを暗号化するために顧客管理の暗号鍵(CMEK)が必要な場合は、リポジトリで Cloud KMS の鍵を作成して有効化します。

必要なロール

リポジトリの作成に必要な権限を取得するには、管理者に Google Cloud プロジェクトに対する Artifact Registry リポジトリ管理者roles/artifactregistry.repoAdmin)IAM ロールの付与を依頼してください。ロールの付与の詳細については、アクセス権の管理をご覧ください。

必要な権限は、カスタムロールや他の事前定義ロールから取得することもできます。

標準リポジトリを作成する

リポジトリを作成する際は、次の設定を構成する必要があります。この設定は、リポジトリの作成後に変更できません。

  • アーティファクトの形式。
  • リポジトリ モード(選択した形式で複数のモードが使用可能な場合)。
  • リポジトリのロケーション
  • Google が管理する鍵または顧客管理の暗号鍵による暗号化。Artifact Registry は、デフォルトで Google が管理する暗号鍵を使用します。

Artifact Registry では組織のポリシーの制約が適用され、CMEK でリソースを暗号化するか、CMEK の保護に使用できる Cloud KMS 鍵を制限する必要があります。

Google Cloud コンソールを使用してリポジトリを作成する

  1. Google Cloud コンソールで [リポジトリ] ページを開きます。

    [リポジトリ] ページを開く

  2. [リポジトリを作成] をクリックします。

  3. リポジトリ名を指定します。プロジェクト内のリポジトリの場所ごとに、リポジトリ名は一意であることが必要です。

  4. リポジトリの形式を選択します。

  5. 複数のリポジトリ モードが使用可能な場合は、[Standard] を選択します。

  6. Maven のみ: バージョン ポリシーを構成します。

    1. バージョン ポリシーを選択する。

      • None - バージョン ポリシーなしリリース パッケージとスナップショット パッケージの両方を保存します。
      • リリース - リリース パッケージのみを保存します。
      • スナップショット - スナップショット パッケージのみを保存します。
    2. スナップショット リポジトリが、リポジトリ内の既存のバージョンを上書きするような一意でないスナップショットを受け入れる場合は、[スナップショットの上書きを許可する] を選択します。

  7. [ロケーション タイプ] でリポジトリのロケーションを選択します。

    1. ロケーション タイプには、[リージョン] または [マルチリージョン] を選択します。ロケーションのリストは、選択した内容に応じて変わります。

    2. [リージョン] リストまたは [マルチリージョン] リストでロケーションを選択します。

    ロケーション タイプとサポートされているロケーションについては、リポジトリのロケーションをご覧ください。

  8. リポジトリの説明を追加します。説明は、リポジトリの目的とリポジトリに含まれるアーティファクトの種類の識別に役立ちます。

    リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  9. リポジトリの整理に ラベル を使用する場合は、ラベルの追加をクリックし、ラベルの Key-Value ペアを入力します。リポジトリを作成した後にラベルを追加、編集、削除できます。

  10. [暗号化] セクションで、リポジトリの暗号化方式を選択します。

    • Google が管理する鍵 - Google が管理する暗号鍵を使用してリポジトリのコンテンツを暗号化します。
    • 顧客管理の暗号鍵 - Cloud Key Management Service で管理する鍵を使用してリポジトリのコンテンツを暗号化します。鍵の設定手順については、リポジトリの CMEK の設定をご覧ください。

    • Docker リポジトリの場合、不変のイメージタグ設定(プレビュー)は、常に同じイメージ ダイジェストを指すイメージタグを使用するようにリポジトリを構成します。Artifact Registry 管理者ロールを持つユーザーは、リポジトリの作成後にこの設定を変更できます。

      • デフォルトでは、この設定は無効になっています。イメージタグは変更可能です。つまり、タグが指すイメージ ダイジェストは変更される可能性があります。
      • この設定を有効にすると、イメージタグは不変になります。タグは常に同じイメージ ダイジェストを指す必要があります。可変イメージタグと不変イメージタグの詳細については、コンテナ イメージのバージョンをご覧ください。
  11. クリーンアップ ポリシーを使用して未使用のアーティファクトを削除する場合は、[クリーンアップ ポリシー] セクションで次の操作を行います。

    1. ポリシーを適用する前に [ドライラン] を選択してテストします。
    2. [ポリシーを追加] をクリックして、リポジトリに保持ポリシーまたは削除ポリシーを追加します。
    3. [名前] フィールドでクリーンアップ ポリシーにわかりやすい名前を付けます。
    4. [ポリシータイプ] セクションで、次のいずれかを選択します。

      • 条件付き削除: 定義した条件に基づいてアーティファクトを削除します。
      • 条件付き保持: 定義した条件に基づいてアーティファクトを保持します。
      • 最新のバージョンを保持: パッケージごとに一定数の最新バージョンを保持します。

      クリーンアップ ポリシーの詳細については、クリーンアップ ポリシーの設定をご覧ください。

  12. [作成] をクリックします。

Artifact Registry でリポジトリが作成され、リポジトリのリストに追加されます。

リポジトリを作成した後は:

Google Cloud CLI を使用してリポジトリを作成する

次のコマンドを実行して新しいリポジトリを作成します。

Apt

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=apt \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --async
  

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

Docker

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=docker \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --immutable-tags \
      --async

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --immutable-tags は、常に同じイメージ ダイジェストを指すタグを使用するようにリポジトリを構成するオプションのフラグです。

    デフォルトでは、--immutable-tags フラグが渡されていない場合、タグを別のイメージ ダイジェストに移動できます。不変イメージタグと変更可能なイメージタグの詳細については、コンテナ イメージのバージョンをご覧ください。

  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

汎用

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=generic \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --async
  

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

Go

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=go \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --async
  

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

Kubeflow Pipelines

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=kfp \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --async
  

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

Maven

デフォルトでは、Maven リポジトリには、パッケージのスナップショットとリリース バージョンの両方が保存されます。バージョン ポリシーを指定して、スナップショットまたはリリース リポジトリを作成できます。

スナップショットとリリースを保存するリポジトリを作成するには、次のコマンドを実行します。

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=maven \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --async
  

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

    スナップショットとリリース バージョンを別々のリポジトリに保存するには、コマンドでバージョン ポリシーを指定します。

    gcloud artifacts repositories create REPOSITORY \
        --repository-format=maven \
        [--location=LOCATION] \
        [--description="DESCRIPTION"] \
        [--kms-key=KMS-KEY] \
        [--version-policy=VERSION-POLICY] \
        [--allow-snapshot-overwrites] \
        [--async] \
    

    次のフラグは、Maven リポジトリ専用です。

    --version-policy=VERSION-POLICY
    リポジトリに保存するパッケージのタイプを指定します。VERSION-POLICY は、次の値に設定できます。
    • None - バージョン ポリシーなしリリース パッケージとスナップショット パッケージの両方を保存します。コマンドに --version-policy フラグを付けない場合、これがデフォルトとなります。
    • Release - リリース パッケージのみを保存します。
    • Snapshot - スナップショット パッケージのみを保存します。
    --allow-snapshot-overwrites
    スナップショット リポジトリのみの場合。このフラグを指定すると、リポジトリ内の既存のバージョンを上書きするような一意でないスナップショットを公開できます。

npm

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=npm \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --async
  

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

Python

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=python \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --async
  

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

Yum

  gcloud artifacts repositories create REPOSITORY \
      --repository-format=yum \
      --location=LOCATION \
      --description="DESCRIPTION" \
      --kms-key=KMS-KEY \
      --async
  

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 プロジェクト内のリポジトリのロケーションごとに、リポジトリ名は一意でなければなりません。
  • LOCATION: リポジトリの、リージョンまたはマルチリージョンロケーションデフォルトを設定すると、このフラグを省略できます。サポートされているロケーションの一覧を表示するには、次のコマンドを実行します。

    gcloud artifacts locations list
    
  • DESCRIPTION: リポジトリの説明。リポジトリの説明は暗号化されないため、センシティブ データは含めないでください。

  • KMS-KEY: リポジトリ コンテンツの暗号化に顧客管理の暗号鍵を使用している場合、Cloud KMS 暗号鍵のフルパス。パスの形式は次のとおりです。

    projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEY-RING/cryptoKeys/KEY
    

    次のように置き換えます。

    • KMS-PROJECT: 鍵が保存されているプロジェクト
    • KMS-LOCATION: 鍵のロケーション。
    • KEY-RING: キーリングの名前。
    • KEY: 鍵の名前
  • --async は処理中のオペレーションの完了を待たずに、直ちにコマンドを終了します。

Artifact Registry がリポジトリを作成します。次のコマンドを実行してリポジトリの説明を表示します。

gcloud artifacts repositories describe REPOSITORY \
    --location=LOCATION

リポジトリを作成した後は:

Terraform を使用してリポジトリを作成する

google_artifact_registry_repository リソースを使用して、リポジトリを作成します。 terraform-provider-google のバージョン 5.0.0 以降が必要です。

Google Cloud で Terraform を初めて使用する場合は、HashiCorp ウェブサイトの Google Cloud スタートガイド ページをご覧ください。

次の例では、プロバイダと、Terraform リソース名が my-repo のリポジトリを定義します。

Apt

```hcl provider "google" { project = "PROJECT-ID" }

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "apt"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

Docker

```hcl provider "google" { project = "PROJECT-ID" }

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "docker"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

汎用

```hcl
provider "google" {
    project = "PROJECT-ID"
}

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "generic"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

Go

```hcl provider "google" { project = "PROJECT-ID" }

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "go"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

Kubeflow Pipelines

```hcl provider "google" { project = "PROJECT-ID" }

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "kfp"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

Maven

バージョン ポリシーを指定しない場合は、Artifact Registry によってデフォルトでパッケージのスナップショットとリリース バージョンの両方を保存する Maven リポジトリが作成されます。

```hcl
provider "google" {
    project = "PROJECT-ID"
}

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "maven"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

スナップショットとリリース バージョンを別々のリポジトリに保存するには、maven_config ブロックを使用してリポジトリのバージョン ポリシーを指定します。このブロックは、次の設定をサポートします。

  • version_policy は、次のいずれかの値を使用してバージョン ポリシーを設定します。
    • VERSION_POLICY_UNSPECIFIED: スナップショットとリリース パッケージを保存します。これはデフォルトの設定です。
    • RELEASE: リリース パッケージのみを保存します。
    • SNAPSHOT: スナップショット パッケージのみを保存します。
  • allow_snapshot_overwrites は、SNAPSHOT バージョン ポリシーで、リポジトリ内の既存のバージョンを上書きする一意でないスナップショットを受け入れるようにリポジトリを構成します。

    次の例では、リリース バージョン ポリシーを持つ Maven リポジトリを定義しています。

    provider "google" {
      project = "my-project"
    }
    
    resource "google_artifact_registry_repository" "my-repo" {
      provider = google-beta
    
      location = "us-central1"
      repository_id = "my-repo"
      description = "Maven repository"
      format = "MAVEN"
      maven_config {
        version_policy = "RELEASE"
      }
    }
    

npm

```hcl provider "google" { project = "PROJECT-ID" }

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "npm"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

Python

```hcl provider "google" { project = "PROJECT-ID" }

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "python"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

Yum

```hcl provider "google" { project = "PROJECT-ID" }

resource "google_artifact_registry_repository" "my-repo" {
  location = "LOCATION"
  repository_id = "REPOSITORY"
  description = "DESCRIPTION"
  format = "yum"
  kms_key_name = "KEY"
  cleanup_policy_dry_run = DRY_RUN_STATUS
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "DELETE"
    condition {
      tag_state    = "TAG_STATE"
      tag_prefixes = ["TAG_PREFIX", "TAG_PREFIX_N"]
      older_than   = "TIME_SINCE_UPLOAD"
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    condition {
      tag_state             = "TAG_STATE"
      tag_prefixes          = ["TAG_PREFIX", "TAG_PREFIX_N"]
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
    }
  }
  cleanup_policies {
    id     = "POLICY_NAME"
    action = "KEEP"
    most_recent_versions {
      package_name_prefixes = ["PKG_PREFIX", "PKG_PREFIX_N"]
      keep_count            = KEEP_COUNT
    }
  }
}
```

次のように置き換えます。

  * `PROJECT-ID` is the Google Cloud project ID.
  * `LOCATION` is the repository location.
  * `REPOSITORY` is the repository name.
  * `DESCRIPTION` is the optional description for the repository.
    Do not include sensitive data, since repository descriptions are
    not encrypted.
  * `KEY `is the name of the Cloud Key Management Service key, if you are using
    [customer-managed encryption keys][cmek] (CMEK) for encryption. Omit
    this argument to use the default setting, Google-managed encryption
    keys.
  * `DRY_RUN_STATUS` determines if cleanup policies delete
    artifacts, or only log which artifacts would be deleted if setting
    cleanup policies on the repository. Omit if you don't want to add
    cleanup policies to the repository.
      * `true`: sets the policies to run in dry run mode. No artifacts are
        deleted in dry run mode.
      * `false`: applies the cleanup policies. Artifacts are deleted or
        kept depending on the policies.

    For more information on cleanup policies, see
    [Configure cleanup policies](/artifact-registry/docs/repositories/cleanup-policy).
  * `POLICY_NAME` is the name of the cleanup policy.
  * `TAG_STATE` is the tag state to apply the policy to. Values
    are `tagged`, `untagged`, and `any`. `any` applies to both tagged and
    untagged artifacts. If a repository has immutable tags enabled, tagged
    artifacts can't be deleted.
  * `TAG_PREFIX`, `TAG_PREFIX_N` are tag prefixes to
    apply the policy to.
  * `PKG_PREFIX`, `PKG_PREFIX_N` are package prefixes
    to apply the policy to.
  * `TIME_SINCE_UPLOAD` is the time since an artifact version
    was uploaded to the repository, specified as a duration. You can specify
    durations of seconds, minutes, hours, or days by appending `s`, `m`, `h`,
    or `d` respectively.
  * `KEEP_COUNT` is the number of versions of an artifact to
    keep in your repository.

Artifact Registry がリポジトリを作成します。次のコマンドを実行してリポジトリの説明を表示します。

gcloud artifacts repositories describe REPOSITORY \
    --location=LOCATION

リポジトリを作成した後は:

リポジトリの説明を編集する

リポジトリの説明は、Google Cloud コンソールか gcloud CLI から変更できます。

Console

  1. Google Cloud コンソールで [リポジトリ] ページを開きます。

    [リポジトリ] ページを開く

  2. リポジトリ リストでリポジトリを選択し、[リポジトリを編集] をクリックします。

  3. リポジトリの説明を編集し、[保存] をクリックします。

gcloud

リポジトリの説明を更新するには次のコマンドを実行します。

gcloud artifacts repositories update REPOSITORY \
    --project=PROJECT \
    --location=LOCATION \
    --description="DESCRIPTION"

次のように置き換えます。

  • REPOSITORY: リポジトリの名前 デフォルト リポジトリを構成した場合は、このフラグを省略してデフォルトを使用できます。
  • PROJECT: Google Cloud プロジェクト ID。 このフラグを省略すると、現在のプロジェクトまたはデフォルトのプロジェクトが使用されます。
  • LOCATION:リージョンまたはマルチリージョン ロケーション。このフラグを使用して、特定のロケーションのリポジトリを表示します。デフォルト ロケーションを構成している場合は、このフラグを省略してデフォルトを使用できます。
  • DESCRIPTION: リポジトリの説明。

次のステップ