CircleCI-Public / gcp-gcr-orb

Orb for interacting with Google Container Registry from within a CircleCI build job
https://circleci.com/orbs/registry/orb/circleci/gcp-gcr
MIT License
13 stars 31 forks source link

Not working with standard Artifact Registry repositories #81

Closed petehouston closed 1 week ago

petehouston commented 8 months ago

Orb version: 0.16.2

version: 2.1

orbs:
  gke: circleci/gcp-gke@1.0.3
  helm: circleci/helm@1.2.0
  gcp-gcr: circleci/gcp-gcr@0.16.2

jobs:
  build_and_push:
    executor: gcp-gcr/default
    steps:
      - checkout
      - run: cp -a ~/project/docker/${CIRCLE_BRANCH}/config.json ~/project/config.json
      - gcp-gcr/gcr-auth:
          registry-url: us-east4-docker.pkg.dev
      - gcp-gcr/build-image:
          image: my-custom-service
          tag: ${CIRCLE_BRANCH}-${CIRCLE_SHA1}
          no_output_timeout: 10m
          registry-url: us-east4-docker.pkg.dev
          dockerfile: Dockerfile.${CIRCLE_BRANCH}
      - gcp-gcr/push-image:
          image: my-custom-service
          registry-url: us-east4-docker.pkg.dev
          tag: ${CIRCLE_BRANCH}-${CIRCLE_SHA1}

What happened:

Error occurred during push:

+ docker push us-east4-docker.pkg.dev/*******************/my-custom-service:dev-bbe295b623056bfd0ac73a13a2a10e84a6638775
The push refers to repository [us-east4-docker.pkg.dev/*******************/my-custom-service]
24c1323c3697: Retrying in 1 second 
92ea868f867f: Retrying in 1 second 
6aaf570d7fc8: Retrying in 1 second 
cb19e85a901d: Retrying in 1 second 
a8b4b33f7690: Retrying in 1 second 
7cd8738126ff: Waiting 
cb591dd771d8: Waiting 
488ed91819d9: Waiting 
7e98a34e8d5d: Waiting 
59c677849659: Waiting 
b485c6cd33a6: Waiting 
6aa872026017: Waiting 
43ba18a5eaf8: Waiting 
ff61a9b258e5: Waiting 
name invalid: Missing image name. Pushes should be of the form docker push HOST-NAME/PROJECT-ID/REPOSITORY/IMAGE

Expected behavior:

It should push to Artifact Registry repo

Additional Information:

It's like we need a field to indicate if the build is for legacy Container Registry or standard Artifact Registry repository. Something like:

      - gcp-gcr/push-image:
          image: my-custom-service
          repository-url: my-project-repo
          registry-url: us-east4-docker.pkg.dev
          tag: ${CIRCLE_BRANCH}-${CIRCLE_SHA1}

if repository-url is empty, it is a GCR push; otherwise, it is a push to Artifact Registry repo:

docker push us-east4-docker.pkg.dev/PROJECT_ID/{repository-url}/{image}
david-montano-circleci commented 1 week ago

The latest version of this orb is compatible with both GCR and Artifact repository. The way the url to push the image to is defined here. You will need to specify the push-image following parameters:

petehouston commented 1 week ago

thanks @david-montano-circleci