I have a problem that I really can't find a solution I have a cloud function in GCP that I create with the command.
gcloud functions deploy function --gen2 --runtime=java11 --region=southamerica-east1 --source=. --entry-point=br.com.div.divfunction.listeners.PubsubFunctionListener --memory=512MB --trigger-http
the build of this function is done in a gcp cloud build workerpool, but recently the function needs to access the aws codeartifact to download some dependencies.
<repositories> <repository> <id>releases</id> <name>aws</name> <url>https://div-domain-repositories-xxxxxxxxxx.d.codeartifact.us-east-1.amazonaws.com/mvn/div_releases/</url> </repository>
it is returning me the error Could not transfer artifact br.com.div:log-task-model:pom:0.2.0 from/to releases (https://div-domain-repositories-xxxxxxxxxx.d.codeartifact.us-east-1.amazonaws. com/mvn/div_releases/): status code: 403, reason phrase: Forbidden (403) -> [Help 1]"
Because I need to configure access to the artificat code with aws cli in the worker, is there any way to access this worker or his image to do this configuration?
Thanks...
Maybe you can use custom cloud build script, or any ci/CD you like to create docker container with all dependencies included, and deploy it on cloud run, instead of "fighting" with cloud function. Both can scale to zero, and both can be configured to only let single request into container (which was default for cloud functions gen1).
Another possibility is to mirror required packages to google artifact registry, it might be simpler to authenticate into such mirror - just give builder service account read permission).