Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menyimpan format lain di Artifact Registry
Pelajari cara menyiapkan repositori format generik Artifact Registry dan mengupload file YAML.
Sebelum memulai
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
Dalam panduan memulai ini, Anda akan menggunakan Cloud Shell untuk menjalankan perintah gcloud.
Membuat repositori generik
Untuk membuat repositori format generik bernama quickstart-generic-repo di
lokasi us-central1 dengan deskripsi Generic repository, jalankan
perintah berikut:
Untuk memverifikasi bahwa repositori Anda telah dibuat, jalankan perintah berikut:
gcloudartifactsrepositorieslist
Untuk menyederhanakan perintah gcloud, jalankan perintah berikut untuk menetapkan repositori
default ke quickstart-generic-repo dan lokasi default ke
us-central1.
Untuk menyetel repositori default ke quickstart-generic-repo, jalankan
perintah berikut:
Ganti DESTINATION dengan direktori di sistem file lokal tempat Anda ingin menyimpan hasil download. Folder tujuan harus sudah ada atau perintah akan gagal.
Pembersihan
Agar tidak dikenai biaya pada akun Google Cloud Anda untuk resource yang digunakan dalam tutorial ini, hapus project yang berisi resource tersebut, atau simpan project dan hapus repositori.
Menghapus project
In the Google Cloud console, go to the Manage resources page.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[[["\u003cp\u003eArtifact Registry allows you to store and manage generic format files, demonstrated here with a YAML file.\u003c/p\u003e\n"],["\u003cp\u003eYou can create a generic repository in Artifact Registry using the \u003ccode\u003egcloud\u003c/code\u003e command-line tool, specifying its name, format, location, and description.\u003c/p\u003e\n"],["\u003cp\u003eUploading a file to the repository involves using the \u003ccode\u003egcloud artifacts generic upload\u003c/code\u003e command, where you must indicate the source file, package name, and version.\u003c/p\u003e\n"],["\u003cp\u003eVerifying the artifact's presence in the repository can be done using the \u003ccode\u003egcloud artifacts files list\u003c/code\u003e command, and downloading can be done with the \u003ccode\u003egcloud artifacts generic download\u003c/code\u003e command, specifying the package, version, and destination.\u003c/p\u003e\n"],["\u003cp\u003eTo avoid charges, users can either delete the entire project or delete the created repository using \u003ccode\u003egcloud artifacts repositories delete\u003c/code\u003e along with clearing the default repository and location settings if applicable.\u003c/p\u003e\n"]]],[],null,["# Quickstart: Store other formats in Artifact Registry\n\nStore other formats in Artifact Registry\n========================================\n\nLearn how to set up an Artifact Registry generic format repository\nand upload a YAML file.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Artifact Registry API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=artifactregistry.googleapis.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Artifact Registry API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=artifactregistry.googleapis.com)\n\n\u003cbr /\u003e\n\nLaunch Cloud Shell\n------------------\n\n- In the Google Cloud console, activate Cloud Shell.\n\n [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n\n\n At the bottom of the Google Cloud console, a\n [Cloud Shell](/shell/docs/how-cloud-shell-works)\n session starts and displays a command-line prompt. Cloud Shell is a shell environment\n with the Google Cloud CLI\n already installed and with values already set for\n your current project. It can take a few seconds for the session to initialize.\n- In this quickstart, you will use Cloud Shell to run `gcloud` commands.\n\nCreate a generic repository\n---------------------------\n\n 1. To create a generic format repository named `quickstart-generic-repo` in\n the location `us-central1` with the description `Generic repository`, run the\n following command:\n\n gcloud artifacts repositories create quickstart-generic-repo \\\n --repository-format=generic \\\n --location=us-central1 \\\n --description=\"Generic repository\"\n\n 2. To verify that your repository was created, run the following command:\n\n gcloud artifacts repositories list\n\n 3. To simplify `gcloud` commands, run the following commands to set the default\n repository to `quickstart-generic-repo` and the default location to\n `us-central1`.\n\n 1. To set the default repository to `quickstart-generic-repo`, run the\n following command:\n\n gcloud config set artifacts/repository quickstart-generic-repo\n\n 2. To set the default location to `us-central1`, run the following command:\n\n gcloud config set artifacts/location us-central1\n\n After the values are set, you don't need to specify them in `gcloud`\n commands that require a repository or a location.\n\nUpload an artifact to the repository\n------------------------------------\n\n 1. In your home directory, create a file to upload to your repository:\n\n echo \"hello world\" \u003e hello.yaml\n\n 2. To upload the file as an artifact to the repository, run the following\n command:\n\n gcloud artifacts generic upload \\\n --source=hello.yaml \\\n --package=my-package \\\n --version=1.0.0\n\n Where:\n - `hello.yaml` is the path of the file to upload.\n - `my-package` is the package to upload.\n - `1.0.0` is the version of the artifact. You can't overwrite an existing version in the repository.\n\nView artifacts in the repository\n--------------------------------\n\n- To verify that your artifact was added to the repository, you can list all artifacts by running the following command: \n\n gcloud artifacts files list\n\n- The response includes the file details in the format \u003cvar translate=\"no\"\u003ePACKAGE\u003c/var\u003e`:`\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e`:`\u003cvar translate=\"no\"\u003eFILE_NAME\u003c/var\u003e.\n- In the following example, `hello.yaml` is the \u003cvar translate=\"no\"\u003eFILE_NAME\u003c/var\u003e: \n\n FILE: my-package:1.0.0:hello.yaml\n CREATE_TIME: 2023-03-09T20:55:07\n UPDATE_TIME: 2023-03-09T20:55:07\n SIZE (MB): 0.000\n OWNER: projects/my-project/locations/us-central1/repositories/quickstart-generic-repo/packages/my-package/versions/1.0.0\n\nDownload a generic artifact\n---------------------------\n\n- To download a generic artifact from your repository, run the following command: \n\n gcloud artifacts generic download \\\n --name=hello.yaml \\\n --package=my-package \\\n --version=1.0.0 \\\n --destination=\u003cvar translate=\"no\"\u003eDESTINATION\u003c/var\u003e\n\n- Where:\n - `hello.yaml` is the name of the file to download.\n - `my-package` is the package to download.\n - `1.0.0` is the version of the artifact.\n- Replace \u003cvar translate=\"no\"\u003eDESTINATION\u003c/var\u003e with the directory in your local file system where you want to save the download. The destination folder must already exist or the command will fail.\n\nClean up\n--------\n\nTo avoid incurring charges to your Google Cloud account for the resources\nused in this tutorial, either delete the project that contains the resources,\nor keep the project and delete the repository.\n\n### Delete the project\n\n| **Caution** : Deleting a project has the following effects:\n|\n| - **Everything in the project is deleted.** If you used an existing project for the tasks in this document, when you delete it, you also delete any other work you've done in the project.\n| - **Custom project IDs are lost.** When you created this project, you might have created a custom project ID that you want to use in the future. To preserve the URLs that use the project ID, such as an `appspot.com` URL, delete selected resources inside the project instead of deleting the whole project.\n|\n|\n| If you plan to explore multiple architectures, tutorials, or quickstarts, reusing projects\n| can help you avoid exceeding project quota limits.\n1. In the Google Cloud console, go to the **Manage resources** page.\n\n [Go to Manage resources](https://console.cloud.google.com/iam-admin/projects)\n2. In the project list, select the project that you want to delete, and then click **Delete**.\n3. In the dialog, type the project ID, and then click **Shut down** to delete the project.\n\n\u003cbr /\u003e\n\n### Delete the repository\n\nBefore you remove a repository, ensure that any packages that you want to keep\nare available in another location.\n\n1. To delete the `quickstart-generic-repo` repository, run the following\n command:\n\n gcloud artifacts repositories delete quickstart-generic-repo\n\n2. If you want to remove the default repository and location settings that\n you configured for the active `gcloud` configuration, run the following\n commands:\n\n gcloud config unset artifacts/repository\n gcloud config unset artifacts/location\n\nWhat's next\n-----------\n\n- [Learn more about generic artifacts](/artifact-registry/docs/generic)"]]