Google Cloud Artifact Registry Goes Limitless with Generic Format Support
We have been using Google Cloud Artifact Registry as a hub since a long time for storing and maintaining container images and language packages integrated with CI/CD pipelines.
Tightly integrated with Identity and Access Management(IAM), vulnerabilities identification with Artifact Analysis, policy enforcement with Binary Authorization, the registry is a suitable product for storing the artifacts in both single and multi-region within Google Cloud premise with required encryption protocol and cleanup policy management.
The registry had support for standard packages and artifacts like: docker image, go modules, helm charts, java, nodejs, python libraries, apt, RPM packages.
Now, the artifact storage is limitless with support for generic storage. Means, any type of artifacts can be stored and shared which could range from simple yml file to bash script to txt file to compressed zip file.
The Generic format support is under preview for now but I really find is much interesting when we have to share organization specific version controlled artifacts rather than through Cloud Storage(GCS).
Creating and Uploading Generic Artifacts
Let’s dive in by creating a repository and upload few artifacts. The repository can be created from web console as well but we are using gcloud
cli here by selecting us-central1
region and format as generic
gcloud artifacts repositories create my-generic-repo \
--repository-format=generic \
--location=us-central1 \
--description="Generic repository"
Creating a simple yml file with random content which we want to share across other GCP products.
echo "MY_KEY: MY_VALUE" > hello.yml
And upload the file to above repository under package name yml-script
and version 1.0.0
gcloud artifacts generic upload \
--location=us-central1 \
--source=hello.yml \
--package=yml-script \
--version=1.0.0 \
--repository=my-generic-repo
If we have new version of the file, this could easily be uploaded with upgraded version value(2.0.0) and likewise:
gcloud artifacts generic upload \
--location=us-central1 \
--source=hello.yml \
--package=yml-script \
--version=2.0.0 \
--repository=my-generic-repo
As another example, we can keep bash script under same repository but with different package name too:
gcloud artifacts generic upload \
--location=us-central1 \
--source=script.sh \
--package=bash-script \
--version=1.0.0 \
--repository=my-generic-repo
And here we got two packages
Retrieving Generic Artifacts
We might need to retrieve the uploaded artifacts in Google Cloud Build or any other platforms during CI/CD process.
gcloud artifacts generic download \
--location=us-central1 \
--name=hello.yml \
--package=yml-script \
--version=1.0.0 \
--destination=./ \
--repository=my-generic-repo
This simple gcloud
script will download version 1.0.0
of the yml-script
package under my-generic-repo
repository. Simple as that!
The generic artifact support will eliminate friction to use different tools for storing and sharing non-standard artifacts, configuration files, compressed files, binaries, media files in build and deployment tools. As we can enforce encryption with either GCP managed or customer managed keys, this could even be used for storing secure content during build process.
That’s it for this post. If you are interested on getting my interesting updates, connect with me on Linkedin, Twitter.