Closed yonner closed 1 year ago
Thanks Jason for the feedback, I'll check it out next week.
@yonner actually, passing --allow-unauthenticated
works for me, this is my config below. Mind sharing yours so I can reproduce the issue? I am not positive that specifying --allow-unauthenticated
will help to resolve the issue for you.
push: &push
step:
name: GCF Deploy
image: python:3.6.7
script:
- pipe: docker://artemrys/google-cloud-functions-deploy:latest
variables:
KEY_FILE: $KEY_FILE
PROJECT: $PROJECT
FUNCTION_NAME: 'hello_world'
ENTRY_POINT: 'hello_world'
RUNTIME: 'python37'
EXTRA_ARGS: '--allow-unauthenticated'
services:
- docker
pipelines:
branches:
master:
- <<: *push
@artemrys Thanks for the response, my script is pretty much the same as yours : -
- pipe: docker://artemrys/google-cloud-functions-deploy:latest
variables:
KEY_FILE: $KEY_FILE
PROJECT: $PROJECT
FUNCTION_NAME: 'v1'
ENTRY_POINT: 'v1'
RUNTIME: 'nodejs14'
EXTRA_ARGS: '--region=europe-west1 --env-vars-file env.yaml --allow-unauthenticated'
INFO: Starting deployment GCP Cloud Function...
gcloud functions deploy v1 --project=my-project --runtime=nodejs14 --entry-point=v1 --source . --trigger-http --region=europe-west1 --env-vars-file env.yaml --allow-unauthenticated --verbosity=warning
Created .gcloudignore file. See gcloud topic gcloudignore
for details.
Deploying function (may take a while - up to 2 minutes)...
WARNING: Setting IAM policy failed, try "gcloud alpha functions add-iam-policy-binding v1 --region=europe-west1 --member=allUsers --role=roles/cloudfunctions.invoker"
..............................................................................................................................done.
@yonner I was able to reproduce the issue, my service account had "Owner" permissions for testing purposes, I changed it to "Editor" and reproduced the issue. Also, I found an article in Google's troubleshooting section here, please check it out, I think it should resolve your issue.
Also, I updated the underlying Google Cloud SDK image to the latest image and pushed a new image (0.3.0) to Dockerhub, so please be aware if you are using :latest
tag.
@artemrys I managed to set up my deployment service accounts so that the --allow-unauthenticated works. Thanks for the help, i will close this issue.
For some reason passing the "--allow-unauthenticated" in the EXTRA_ARGS doesnt work and gives the error : -
WARNING: Setting IAM policy failed, try "gcloud alpha functions add-iam-policy-binding v1 --region=europe-west1 --member=allUsers --role=roles/cloudfunctions.invoker"
Would it be possible to add another variable in the pipe : -
"ALLOW_UNAUTHENTICATED" : 'true'
Which defaults to 'false' which calls the above gcloud alpha function, or some how parses the "--allow-unauthenticated" and does the same?
Thank you
Jason