1

I am trying to create a simple CI/CD pipeline. After the client makes git push, it will start a trigger with the below cloudbuilder.yaml:

# steps:
# - name: 'docker/compose:1.28.2'
#   args: ['up', '-d']
# - name: "docker/compose:1.28.2"
#   args: ["build"]
# images: ['gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose']
# - name: 'gcr.io/cloud-builders/docker'
#   id: 'backend'
#   args: ['build','-t', 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:latest','.']
# - name: 'gcr.io/cloud-builders/docker'
#   args: ['push', 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:latest']

# steps:
# - name: 'docker/compose:1.28.2'
#   args: ['up', '-d']
# - name: "docker/compose:1.28.2"
#   args: ["build"]
# images:
# - 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose'

# In this directory, run the following command to build this builder.
# $ gcloud builds submit . --config=cloudbuild.yaml
substitutions:
  _DOCKER_COMPOSE_VERSION: 1.28.2
steps:
- name: 'docker/compose:1.28.2'
  args:
  - 'build'
  - '--build-arg'
  - 'DOCKER_COMPOSE_VERSION=${_DOCKER_COMPOSE_VERSION}'
  - '-t'
  - 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:latest'
  - '-t'
  - 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:${_DOCKER_COMPOSE_VERSION}'
  - '.'
- name: 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose'
  args: ['version']

images:
- 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:latest'
- 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:${_DOCKER_COMPOSE_VERSION}'
tags: ['cloud-builders-community']

It returns the error below: it cannot create images in the repository. How can I solve this issue?

ERROR: failed to pull because we ran out of retries.
ERROR
ERROR: build step 1 "gcr.io/internal-invoicing-solution/cloudbuild-demo-dockercompose" failed: error pulling build step 1 "gcr.io/internal-invoicing-solution/cloudbuild-demo-dockercompose": generic::unknown: retry budget exhausted (10 attempts): step exited with non-zero status: 1
```


Farid Shumbar
  • 1,360
  • 3
  • 10
Penguen
  • 16,836
  • 42
  • 130
  • 205
  • 1
    Did you try following one of the [GCP-provided quickstarts](https://cloud.google.com/docs/ci-cd) for building a CI/CD pipeline? Does the error reproduce while using these samples? – Farid Shumbar Oct 29 '21 at 13:27
  • Sorry for my late answer : yes below code is problem. – Penguen Oct 31 '21 at 16:23

1 Answers1

3

Before pulling your image in the 2nd step, you need to push it. When you declare the images at the end of your yaml definition, the image are pushed automatically at the end on the pipeline. Here you need it in the middle.


EDIT 1

I just added a docker push step, copy and paste from your comments. Does it work?

substitutions:
  _DOCKER_COMPOSE_VERSION: 1.28.2
steps:
- name: 'docker/compose:1.28.2'
  args:
  - 'build'
  - '--build-arg'
  - 'DOCKER_COMPOSE_VERSION=${_DOCKER_COMPOSE_VERSION}'
  - '-t'
  - 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:latest'
  - '-t'
  - 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:${_DOCKER_COMPOSE_VERSION}'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args: ['push', 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:latest']
- name: 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose'
  args: ['version']

images:
- 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:latest'
- 'gcr.io/$PROJECT_ID/cloudbuild-demo-dockercompose:${_DOCKER_COMPOSE_VERSION}'
tags: ['cloud-builders-community']

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76