0

In the GCP cloud build yaml file, can we use the steps repeatedly by passing the same arguments again but with different file names. Ex:

- name: 'gcr.io/cloud-builders/gke-deploy'
  args:
    - run
    - '--filename=kubernetes-job'
    - '--image=asia-south1-docker.pkg.dev/product-staging-apps/test-stg-repo/staging-app:$SHORT_SHA'
    - '--location=asia-south1'
    - '--cluster=stg-gke-cluster'
  id: 'job'
- name: 'gcr.io/cloud-builders/gke-deploy'
  args:
    - run
    - '--filename=kubernetes-app'
    - '--image=asia-south1-docker.pkg.dev/product-staging-apps/test-stg-repo/staging-app:$SHORT_SHA'
    - '--location=asia-south1'
    - '--cluster=stg-gke-cluster'
  waitFor: ['job']

I have tried by setting the above and first deployment succeeded and second deployment throwing an error as-

 Error: failed to prepare deployment: failed to save suggested configuration files to "output/suggested": output directory "output/suggested" exists and is not empty
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
Naveen
  • 9
  • 1

1 Answers1

-1

This is what i have been using, you can consider it as work around might be help.

Cloudbuild.yaml

- id: 'build test core image'
  name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA', '.']
- id: 'push test core image'
  name: 'gcr.io/cloud-builders/docker'
  args: ['push', 'gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA']
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102