Gary Turner
Gary Turner

Reputation: 367

Failed to run /bin/build: for Python, an entrypoint must be manually set, either with "GOOGLE_ENTRYPOINT" env var or by creating a "Procfile" file"

I'm trying to automate a CloudDeploy pipeline by following the instructions here:

https://davelms.medium.com/automate-gke-deployments-using-cloud-build-and-cloud-deploy-2c15909ddf22

Things seemed to be working until I got to the last steps of adding in the commit hashes and Cloud Deploy trigger. I'm getting the following error when the trigger runs:

Failed to run /bin/build: for Python, an entrypoint must be manually set, either with "GOOGLE_ENTRYPOINT" env var or by creating a "Procfile" file"

However, I definitely have a Procfile in the base directory where my clouddeploy.yaml and cloudbuild.yaml files are stored with the following content:

web: gunicorn --bind :8080 main:app

Is there something else I need to do to get it to reference that?

For reference, here is my cloudbuild.yaml file:

steps:
- name: 'gcr.io/k8s-skaffold/pack'
  entrypoint: 'pack'
  args: ['build', '--builder=gcr.io/buildpacks/builder', '--publish', 'us-east1-docker.pkg.dev/fakeproject/my-docker-repo/app3:$SHORT_SHA']
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
  entrypoint: 'bash'
  args:
  - '-c'
  - > 
    gcloud deploy releases create release-$BUILD_ID
    --delivery-pipeline=app3
    --region=us-east1
    --source=./
    --images=app3=us-east1-docker.pkg.dev/fakeproject/my-docker-repo/app3:$SHORT_SHA
options:
  logging: CLOUD_LOGGING_ONLY

Here is my clouddeploy.yaml:

---
apiVersion: deploy.cloud.google.com/v1beta1
kind: DeliveryPipeline
metadata:
  name: app3
description: App3 Deployment Pipeline 
serialPipeline:
  stages:
  - targetId: demo-gke
---
apiVersion: deploy.cloud.google.com/v1beta1
kind: Target
metadata:
  name: demo-gke
description: Demo Environment
gke:
  cluster: projects/fakeproject/locations/us-east1/clusters/demo-gke
executionConfigs:
- usages:
  - DEPLOY
  workerPool: "projects/fakeproject/locations/us-east1/workerPools/cloud-build-pool"
- usages:
  - RENDER
  - VERIFY

Here is my main.py:

from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
    return "Hello from app3"
# run the app.
if __name__ == "__main__":
    app.run()

requirements.txt and skaffold.yaml are identical to the article.

Thanks!

Upvotes: 0

Views: 981

Answers (1)

Kranthiveer Dontineni
Kranthiveer Dontineni

Reputation: 1533

Hi Gary tuner while you are using a trigger you should define a function in your code which will call the remaining functions in your code and this will serve as an entry point which you will be providing while configuring the trigger. I’m providing an example code block below go through it for your reference

def gcp_cfn_entry(request):


return ‘OK’

Upvotes: 0

Related Questions