I have created a http-triggered Cloud Function via the GUI, which uses source code from a repository of mine. If the source code changes, I can fairly easily re-deploy(update) the Cloud Function manually via the UI by clicking on Edit -> Code -> Deploy.
I would like to set up a CI/CD pipeline, using Cloud Build, with a trigger on the repo, so that when the source code changes (on master branch), the Cloud Function is re-deployed. In order to do this, I need to figure out how to re-deploy the Cloud Function via the CLI. Reading the cloud functions deploy docs, it says "create or update a Google Cloud Function". However, how much I try, I don't manage to update my existing Cloud Function, only create new ones.
I've tried updating it like specified in this SO answer, by running;
gcloud functions deploy <MY-FUNCTION-NAME> --source=https://source.developers.google.com/projects/<MY-PROJECT>/repos/<MY-REPO>/paths/<FOLDER-PATH>
which gives the error One of arguments [--trigger-topic, --trigger-bucket, --trigger-http, --trigger-event] is required: You must specify a trigger when deploying a new function. Notice the ... when deploying a new function.
Any ideas of how I can re-deploy (update) my existing one, and then (automatically), also use the latest source code?
gcloud functions listto list all existing cloud functions in the current project.gcloud functions list, the cloud function which I'm interested in is listed there. Also, when I check my current project, and rungcloud config list --format 'value(core.project)' 2>/dev/nullI am in the correct project.when deploying a new functiondoes not matter, it's just a generic message. You may need to specify the trigger for the function. A lot of things can change from now to a response from 2020--trigger-httpand--runtime=python38, gcloud deploys a completely new Cloud Function, with the same name, in the same project. Not the update/redeploy I'm expecting unfortunately...