通过Cloud Source Repositories部署GCF失败:无法获取源码求助
Problem Statement
I successfully deployed a GCP Function using this command prior to December 4th, but when I ran it on December 27th, it failed outright:
gcloud beta functions deploy pipeline-helper --set-env-vars PROPFILE_BUCKET=${my_bucket},PROPFILE_PATH=${some_property} --source https://source.developers.google.com/projects/{PROJECT}/repos/{REPO}/fixed-aliases/1.0.1/paths/ --entry-point onFlagFileCreation --runtime nodejs6 --trigger-resource ${my_bucket} --trigger-event google.storage.object.finalize --region europe-west1 --memory 1G --timeout 300s
The deployment works flawlessly when using a GCS bucket or local directory as the --source target, but consistently fails when pointing to a Cloud Source Repository (CSR) URL.
Error Output (With Debug Flag Enabled)
Deploying function (may take a while - up to 2 minutes)... ..failed.
DEBUG: (gcloud.beta.functions.deploy) OperationError: code=13, message=Failed to retrieve function source code
[Full Traceback omitted]
ERROR: (gcloud.beta.functions.deploy) OperationError: code=13, message=Failed to retrieve function source code
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Troubleshooting Steps I've Tried
- Tested with the minimal valid CSR URL as specified in official docs:
https://source.developers.google.com/projects/PROJECT/repos/REPO— same error persisted - Cloned the official Google Cloud Functions - Hello World sample into my CSR and attempted deployment with an equivalent command — still failed
- Verified deployment works perfectly when using a GCS bucket (with a zip package) or local repository as the source
Service Account Permissions
The service account xxx-compute@developer.gserviceaccount.com used for deployment has the following roles:
- Stackdriver Debugger Agent
- Cloud Functions Developer
- Cloud Functions Service Agent
- Editor
- Service Account User
- Source Repository Writer
- Cloud Source Repositories Service Agent
- Storage Object Creator
- Storage Object Viewer
I'm stuck on this issue and would really appreciate any guidance or solutions from the community.
内容的提问来源于stack exchange,提问作者Brahim A.

