deploy-cloudrun icon indicating copy to clipboard operation
deploy-cloudrun copied to clipboard

metadata don't works when input job yaml

Open templarfelix opened this issue 1 year ago • 3 comments

TL;DR

I have metadata for job, but the actions only allow knative yaml.

apiVersion: run.googleapis.com/v1
kind: Job
metadata:
  name: job
  labels:
    run.googleapis.com/satisfiesPzs: 'true'
    cloud.googleapis.com/location: southamerica-east1
spec:
  template:
    metadata:
      annotations:
        run.googleapis.com/execution-environment: gen2
    spec:
      parallelism: 1
      taskCount: 1
      template:
        spec:
          containers:
            - image: us-docker.pkg.dev/xxx/docker/job:latest
              imagePullPolicy: Always
              resources:
                limits:
                  cpu: 1000m
                  memory: 512Mi
          maxRetries: 0
          timeoutSeconds: '3600'

Expected behavior

Accept yaml of job and knative.

Observed behavior

google-github-actions/deploy-cloudrun failed with: failed to execute gcloud command gcloud run services replace ./scripts/job/Service.dev.yaml --format json --region southamerica-east1: ERROR: (gcloud.run.services.replace) Failed to parse value(s) in protobuf [Service]: Service.spec.template.spec.parallelism,taskCount,template

Action YAML

- 
        name: Deploy Cloud Run Application with Metadata
        id: deploy
        uses: 'google-github-actions/deploy-cloudrun@v2'
        with:
          region: '${{ inputs.app_region }}'
          metadata: '${{ inputs.cloud_run_metadata }}'

Log output

No response

Additional information

No response

templarfelix avatar Apr 24 '24 14:04 templarfelix

Hi @templarfelix - this GitHub Action runs gcloud under the hood, and that error is coming from gcloud. Are you trying to define a Cloud Run job instead of a service?

sethvargo avatar Apr 24 '24 19:04 sethvargo

@sethvargo Yes, I put a JSON of the job definition;

The fix is, check the content of metadata and change the command from "cloud run services replace ./scripts/job/Service.dev.yaml --format json --region southamerica-east1" to "cloud run jobs replace ./scripts/job/Service.dev.yaml --format json --region southamerica-east1"

templarfelix avatar Apr 30 '24 13:04 templarfelix

I think this makes sense - we currently only support metadata for service definitions.

sethvargo avatar Apr 30 '24 23:04 sethvargo