We have startup script that will create monitoring alerts using Google APIs.
For this we created a postman collection where we have bundled all these calls and then we wish to run a shell script where we will use service account json file and call the postman collection
export GOOGLE_APPLICATION_CREDENTIALS=/home/abc/sac-5f63.json
export TOKEN=$(gcloud auth application-default print-access-token)
echo $TOKEN
echo "Running postman collection start"
newman run /home/abc/API.postman_collection.json
We created a docker file for this task with required dependencies and gcloud sdk as base image.
Now, We also want to give provision to execute this one time job in Google Cloud to users. For this we are considering options such as Cloud Run, Cloud Function, App Engine. But, all these services expose an endpoint and then it has to be called and the the service will perform the action.
Our requirement is a one time activity so we don't want to keep a service running all the time. Also, this is not a node js, java, go application that these services support.
It is more like a one time job task, that should get trigger do it's job and then stop.
Does google cloud support such a use case. Basic hello world docker is an example of this kind of requirement that we have - https://hub.docker.com/_/hello-world
We tried cloud run but it expects a portNo to be present with out which it fails
Deployment failed
ERROR: (gcloud.run.deploy) Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.
Please share some thoughts.
thanks, Aakash