GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
14.93k stars 1.62k forks source link

No push access to specified image repository - Azure Container Registry #5601

Closed dgoldssfo closed 3 years ago

dgoldssfo commented 3 years ago

skaffold pushes to ACR

I get this error: No push access to specified image repository. Note that I do not get this failure on skaffold 1.20.0.

Information

# For creating your own custom skaffold profiles we recommend making a copy of this
# file to skaffold-dev.yaml (which is in .gitignore).
# You can "mix and match" diferent services together by creating skaffold profiles
# and by creating a new kustomize profile in kustomize/overlay/
# The default below for skaffold dev is to deploy all services in one shot:
# Note: Upgrade to skaffold/v2alpha3 for skaffold 1.4
apiVersion: skaffold/v1
kind: Config

## Common YAML anchors
## The yaml anchors are used to make it easier to compose skaffold profiles.
## You should not need to edit this section
.YamlAnchors:

  artifactDefinitions:
    - &AM
      image: am
      context: docker/7.0/am
    - &AMSTER
      image: amster
      context: docker/7.0/amster
    - &IDM
      image: idm
      context: docker/7.0/idm
    - &DS-CTS_BASE
      image: ds-cts
      context: docker/7.0/ds
    - &DS-CTS
      <<: *DS-CTS_BASE
      docker:
        dockerfile: cts/Dockerfile
    - &DS-IDREPO_BASE
      image: ds-idrepo
      context: docker/7.0/ds/
    - &DS-IDREPO
      <<: *DS-IDREPO_BASE
      docker:
        dockerfile: idrepo/Dockerfile
    - &DS-PROXY_BASE
      image: ds-proxy
      context: docker/7.0/ds
    - &DS-PROXY
      <<: *DS-PROXY_BASE
      docker:
        dockerfile: proxy/Dockerfile
    - &LDIF-IMPORTER
      image: ldif-importer
      context: docker/7.0/ldif-importer
    - &IG
      image: ig
      context: docker/7.0/ig
    - &AM_CONFIG_UPGRADER
      image: am-config-upgrader
      context: docker/7.0/am-config-upgrader

  commonArtifactSets:
    default-artifacts: &default-artifacts
    - *AM
    - *AMSTER
    - *IDM
    - *DS-CTS
    - *DS-IDREPO
    - *DS-PROXY
    - *IG
    - *LDIF-IMPORTER

## End YAML Anchors

#---------------------
# Skaffold profiles
#---------------------

# Default profile
build: &default-build
  artifacts: *default-artifacts
  tagPolicy:
    sha256: {}
deploy: &default-deploy
  statusCheckDeadlineSeconds: 600
  kustomize:
    path: ./kustomize/overlay/7.0/all

# default.iam.forgeops.com
profiles:
- name: forgeops
  build: *default-build
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/forgeops

# Images tagged as environment variable in a dockerd or dockerd like environment
- name: docker-image-tag
  build:
    tagPolicy:
      envTemplate:
        template: "{{.IMAGE_TAG}}"
    artifacts: *default-artifacts
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/all

# CDM s/m/l profiles. (For cdm-mini, use default profile.)
- name: small
  build: *default-build
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/small
- name: medium
  build: *default-build
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/medium
- name: large
  build: *default-build
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/large
- name: dev
  build: *default-build
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/dev

# Platform deployment without default UI projects. UI to be installed separately, for development
- name: no-ui
  build: *default-build
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/noui

# Sample profiles to launch / test just a specific product
- name: ig-only
  build:
    artifacts:
    - *IG
    tagPolicy:
      sha256: {}
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/ig-only

- name: am-only
  build:
    artifacts:
    - *AM
    - *AMSTER
    - *DS-CTS
    - *DS-IDREPO
    - *LDIF-IMPORTER
    tagPolicy:
      gitCommit:
        variant: AbbrevCommitSha
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/am-only

- name: idm-only
  build:
    artifacts:
    - *IDM
    - *DS-IDREPO
    tagPolicy:
      sha256: {}
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/idm-only

- name: ds-only
  build:
    artifacts:
    - *DS-CTS
    - *DS-IDREPO
    tagPolicy:
      sha256: {}
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/ds-only

# Deploy only ds and secrets.
- name: persistence
  build:
    artifacts:
    - *DS-CTS
    - *DS-IDREPO
    - *LDIF-IMPORTER
    tagPolicy:
      gitCommit:
        variant: AbbrevCommitSha
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/persistence

# deploy only AM/IDM - for iterative testing
- name: am-idm-only
  build:
    artifacts:
    - *AM
    - *IDM
    - *AMSTER
    tagPolicy:
      gitCommit:
        variant: AbbrevCommitSha
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/am-idm-only

- name: amster-export
  build:
    artifacts:
    - *AMSTER
    tagPolicy:
      gitCommit:
        variant: AbbrevCommitSha
  deploy:
    kustomize:
      path: ./kustomize/overlay/7.0/amster-export

- name: amster-import
  build:
    artifacts:
    - *AMSTER
    tagPolicy:
      gitCommit:
        variant: AbbrevCommitSha
  deploy:
    kustomize:
      path: ./kustomize/base/amster

- name: config-upgrader
  build:
    artifacts:
      - *AM_CONFIG_UPGRADER
    tagPolicy:
      gitCommit:
        variant: AbbrevCommitSha
  deploy:
    kustomize:
      path: ./kustomize/base/am-config-upgrader

- name: fr-config-exporter
  build:
    artifacts:
      - *AM_CONFIG_UPGRADER
    tagPolicy:
      gitCommit:
        variant: AbbrevCommitSha
  deploy:
    kustomize:
      path: ./kustomize/dev/fr-config-exporter

Steps to reproduce the behavior

  1. az login
  2. az acr login --name registry-name
  3. skaffold config set default-repo my-container-registry.azurecr.io/cdm -k my-context
  4. skaffold run --profile small
  5. Reinstall Skaffold 1.20.0
  6. /path/to/skaffold-1.20.0/skaffold run --profile small - works, is able to write to my ACR registry.
nkubala commented 3 years ago

@dgoldssfo thanks for the issue. i'm wondering if this is related to a change we made to the default-repo handling in v1.21.0. would you be able to provide logs from skaffold run --profile small -v debug on v1.21.0?

also, if it isn't too much trouble, would you be able to try putting your default repo (my-container-registry.azurecr.io/cdm) directly into your images in your skaffold.yaml and see if you're still seeing the issue?

dgoldssfo commented 3 years ago

Here's the log skaffold.log

dgoldssfo commented 3 years ago

By "putting your default repo (my-container-registry.azurecr.io/cdm) directly into your images in your skaffold.yaml" I assume you mean prepending the image repo with "my-container-registry.azurecr.io/cdm/", correct?

I tried that, and it worked around the problem.

Sounds like you have a handle on this, thanks.

dgoldssfo commented 3 years ago

@tejal29 Is there a fix for this problem? The default-repo should not need to be in skaffold.yaml.

tejal29 commented 3 years ago

@dgoldssfo Apologies, did not mean to close the issue. I am assuming -d flag worked for you? I feel we have a regression in evaluating profiles sometime along v1.21.0 or even before. Another related issue #5176 here.

dgoldssfo commented 3 years ago

I didn't try -d; just tried the workarounds suggested by nkubala several comments above this one.

tejal29 commented 3 years ago

-d is the command line option for specifying default repo. That said, the underlying bug of profile needs to be solved.

dgoldssfo commented 3 years ago

I assume this is related to https://github.com/GoogleContainerTools/skaffold/pull/5635?

Three people where I work have all hit this one now.

tejal29 commented 3 years ago

Sorry for the regression. We are working on fixing this issue in the next release. Please use v1.19.0 till then.

MarlonGamez commented 3 years ago

hey @dgoldssfo , I believe the underlying issue here is https://github.com/GoogleContainerTools/skaffold/issues/5588, which was fixed in v1.22.0. I'm going to close this issue for now, however please let me know if it's still around