Yesterday, I was trying to restructure some Github CI/CD, because the actions from Google were throwing warnings about deprecated usages.
One of the steps is the (build and) deployment of a GCP function. The repository of the function to be deployed was structured like this:
my_proj
|- .github
|- src
|- my_proj
|- __init__.py
|- main.py
|- requirements.txt
...
,with the requirements.txt holding
boto3==1.16.54
The important bit here is the requirements.txt, that holds some dependencies, that I need to ship as well.
Before, I had to build the package uploaded to GCP myself, but with the "deploy-cloud-functions " action this seemed to be obsolete now. I set up the actions in Github according to documentation:
steps:
- name: Login to GCP
uses: google-github-actions/auth@v0
with:
credentials_json: ...
- name: Deploy GCP Function image
uses: google-github-actions/deploy-cloud-functions@v0
with:
name: my_function_name
runtime: python37
project_id: ...
source_dir: ./src/my_proj
env_vars:
...
Now, the deployment worked. However, when inspecting the function now in GCP or downloading it, none of the dependencies were contained there and the logs upon triggering the function similarly showed a function crash due to missing dependencies.
I also tried to move the requirements.txt file to the project root, but apparently to no avail. I was not very lucky in finding extensive documentation about the work with GCP functions from within Github beyond the above linked Google-owned action repository.
Can anyone spot my error here?
While deploying to Cloud Functions usinggithub actions all the dependencies also get uploaded. But, as already mentioned by Danyel Cabello , you won't be able to see the dependencies in the source tab of the Cloud Functions in Google Cloud Console.
To see the build logs you can search for resource.type=“build”
in the Cloud Logging of Google Cloud Console.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.