I'm authoring some custom targets but I can't seem to find if and how the build artifacts are made available to them, https://cloud.google.com/deploy/docs/custom-targets lacks any details about the artifacts.
If I pass the artifacts like: gcloud deploy releases create foo --images image1=path/to/image1:v1@sha256:45db24 I'd like to have the list of images to use in my custom target.
If the artifacts are passed like gcloud deploy releases create foo --build-artifacts=artifacts.json then I need to assume that the file was included in the input tarball and assume the filename within it too.
Is this not supported for a reason? It seems like a vital piece for custom targets.
Solved! Go to Solution.
Hello, currently if you want to get the build artifacts that were provided when you created the Release in the context of a custom target then you will need to retrieve them from the Release itself, see `buildArtifacts` in the Release overview. You can determine the name of the Release in order to Get it by using the environment variables documented in https://cloud.google.com/deploy/docs/custom-targets. The release name is projects/{projectID}/locations/{location}/deliveryPipelines/{pipelineID}/releases/{releaseID}.
I know this isn't the best solution and we're going to take this as feedback. Thank you!
Hello, currently if you want to get the build artifacts that were provided when you created the Release in the context of a custom target then you will need to retrieve them from the Release itself, see `buildArtifacts` in the Release overview. You can determine the name of the Release in order to Get it by using the environment variables documented in https://cloud.google.com/deploy/docs/custom-targets. The release name is projects/{projectID}/locations/{location}/deliveryPipelines/{pipelineID}/releases/{releaseID}.
I know this isn't the best solution and we're going to take this as feedback. Thank you!
Thanks for the response! Being passed this information via the env vars would definitely make custom target authors life easier 🙂
I'll update my code to call the API as recommended in the meantime.
The other pertinent change would be to grant my execution service account the clouddeploy.releases.get permission (e.g. via clouddeploy.viewer role).