Azure / cli

Automate your GitHub workflows using Azure CLI scripts
MIT License
124 stars 52 forks source link

invalid reference format: repository name must be lowercase #83

Closed ezYakaEagle442 closed 1 year ago

ezYakaEagle442 commented 1 year ago

running azure/CLI fails with "invalid reference format: repository name must be lowercase"

https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/blob/main/.github/workflows/deploy-iac.yml#L77

env:
  AZ_CLI_VERSION: 2.40.0

    - name: Deploy Azure Key Vault
      uses: azure/CLI@v1.0.6 # https://github.com/marketplace/actions/azure-cli-action
      with:
        azcliversion: ${{ env.AZ_CLI_VERSION }}
        inlineScript: |

          # leave this fake dummy accessPoliciesObject as anyway SET_KV_ACCESS_POLICIES is set to FALSE at this stage
          accessPoliciesObject='{}'

          az deployment group create --name aca-petclinic-kv -f ../../iac/bicep/modules/kv/kv.bicep -g ${{ env.RG_KV }} \
            -p appName=${{ env.APP_NAME }} \
            -p kvName=${{ env.KV_NAME }} \
            -p location=${{ env.LOCATION }} \
            -p setKVAccessPolicies=${{ env.SET_KV_ACCESS_POLICIES }} \
            -p accessPoliciesObject=$accessPoliciesObject \
            -p secretsObject=${{ secrets.SECRET_OBJECT }} \
            -p secretExpiryDate=${{ env.SECRET_EXPIRY_DATE }}

see https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3141520108/jobs/5104050174

##[group***Run azure/CLI@v1.0.6
with:
  azcliversion: [2](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3141520108/jobs/5104050174#step:4:2).40.0
  inlineScript: 
# leave this fake dummy accessPoliciesObject as anyway SET_KV_ACCESS_POLICIES is set to FALSE at this stage
accessPoliciesObject='***'

az deployment group create --name aca-petclinic-kv -f ../../iac/bicep/modules/kv/kv.bicep -g rg-iac-kv777 \
  -p appName=petcliaca \
  -p kvName=kv-petcliaca442 \
  -p location=westeurope \
  -p setKVAccessPolicies=false \
  -p accessPoliciesObject=$accessPoliciesObject \
  -p secretsObject=*** \
  -p secretExpiryDate=1672444800

env:
  APP_NAME: petcliaca
  LOCATION: westeurope
  RG_KV: rg-iac-kv777
  RG_APP: rg-iac-aca-petclinic-mic-srv
  ACA_ENV_NAME: aca-env-pub
  DEPLOY_TO_VNET: false
  KV_NAME: kv-petcliaca442
  SET_KV_ACCESS_POLICIES: false
  AZURE_CONTAINER_REGISTRY: acrpetcliaca
  REPOSITORY: petclinic
  GHA_SETTINGS_CFG_REGISTRY_URL: acrpetcliaca.azurecr.io
  GHA_SETTINGS_CFG_REPO_URL: https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv
  GHA_SETTINGS_CFG_CRD_CLIENT_ID: 
  GHA_SETTINGS_CFG_CRD_CLIENT_SECRET: 
  GHA_REVISION_NAME: poc-aca-101
  SECRET_OBJECT: ***
  SECRET_EXPIRY_DATE: 1672444800
  credentials: ***
  AZURE_TENANT_ID: ***
  AZURE_SUBSCRIPTION_ID: ***
  DEPLOYMENT_VERSION: 2.6.6
  AZ_CLI_VERSION: 2.40.0
  JAVA_VERSION: 11
  LOCAL_IP: 104.210.40.215
  AZURE_HTTP_USER_AGENT: 
  AZUREPS_HOST_ENVIRONMENT: 
##[endgroup***
Starting script execution via docker image mcr.microsoft.com/azure-cli:2.40.0
##[error***Error: docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.

cleaning up container...
##[warning***Error: No such container: MICROSOFT_AZURE_CLI_1664[3](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3141520108/jobs/5104050174#step:4:3)[4](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3141520108/jobs/5104050174#step:4:4)9199491_CONTAINER

(node:1[5](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3141520108/jobs/5104050174#step:4:5)[6](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3141520108/jobs/5104050174#step:4:6)5) UnhandledPromiseRejectionWarning: Error: docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.

    at /home/runner/work/_actions/azure/CLI/v1.0.6/dist/index.js:1:23964
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/azure/CLI/v1.0.6/dist/index.js:1:20436)
    at processTicksAndRejections (internal/process/task_queues.js:9[7](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3141520108/jobs/5104050174#step:4:7):5)
(node:1565) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1565) [DEP001[8](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3141520108/jobs/5104050174#step:4:8)*** DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ezYakaEagle442 commented 1 year ago

is it because the container name in the UPPERCASE ?

What about https://github.com/Azure/cli/blob/master/src/main.ts#L73 where the volume settings -v is set without quotes "" whereas it should be wrapped by "" as suggested at https://stackoverflow.com/questions/48522615/docker-error-invalid-reference-format-repository-name-must-be-lowercase

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 7 days with no activity.

github-actions[bot] commented 1 year ago

This issue is idle because it has been open for 14 days with no activity.

t-dedah commented 1 year ago

Hi @ezYakaEagle442 The container name is not the issue as we can have any name for the container. I also don't think volume should cause such issues as the possibility of them having a space seems negligible unless in some custom environment where env variables are set incorrectly. To be double sure about the volume, I have a created a new build with double quotes around the volume which can be accessed by changing the @v1 to @t-dedah/test-volumne-with-double-quotes. The updated block

- name: Azure CLI script
  uses: azure/CLI@t-dedah/test-volumne-with-double-quotes
  with:
    azcliversion: 2.40.0
    inlineScript: |
      az account show
      az storage -h

Meanwhile we will try to replicate the issue.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 7 days with no activity.

github-actions[bot] commented 1 year ago

This issue is idle because it has been open for 14 days with no activity.

t-dedah commented 1 year ago

Closing this issue for now. Please reopen if you have more followup questions.