microsoft / containerregistry

Microsoft Artifact Registry description and related FAQ
398 stars 89 forks source link

mvnw permission issue in tutorial: Build and deploy your app to Azure Container Apps #160

Closed thesse1 closed 5 months ago

thesse1 commented 7 months ago

Please provide us with the following information:

This issue is a: (mark with an x)

Issue description

Running the tutorial: Build and deploy your app to Azure Container Apps for Java with cloud build, the "Build the container with ACR" step returns an error message:

/bin/sh: line 1: ./mvnw: Permission denied

Steps to reproduce

  1. Run the preceding steps of the tutorial.
  2. For the "Build the container with ACR" step, run the following command: az acr build --resource-group $RESOURCE_GROUP --registry $ACR_NAME --image $API_NAME .

Expected behavior [What you expected to happen.]

As per the tutorial, it should create a container image in the ACR.

Actual behavior [What actually happened.]

Error message:

thes@SAG-6YQ9SG3:/mnt/c/Git/code-to-cloud$ az acr build --resource-group $RESOURCE_GROUP --registry $ACR_NAME --image $API_NAME .
Packing source code into tar to upload...
Excluding '.git' based on default ignore rules
Excluding '.gitignore' based on default ignore rules
Uploading archived source code from 'C:\Users\THES\AppData\Local\Temp\build_archive_6fb14102ac08470cbfaeaf6899ef2dfa.tar.gz'...
D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\cryptography/hazmat/backends/openssl/backend.py:27: UserWarning: You are using cryptography on a 32-bit Python on a 64-bit Windows Operating System. Cryptography will be significantly faster if you switch to using a 64-bit Python.
Sending context (69.652 KiB) to registry: acaalbumsthesse1...
Queued a build with ID: cb2
Waiting for an agent...
2024/03/18 08:41:02 Downloading source code...
2024/03/18 08:41:03 Finished downloading source code
2024/03/18 08:41:03 Using acb_vol_ba1e076d-783e-4d1c-8a0b-adaed4506df5 as the home volume
2024/03/18 08:41:03 Setting up Docker configuration...
2024/03/18 08:41:04 Successfully set up Docker configuration
2024/03/18 08:41:04 Logging in to registry: acaalbumsthesse1.azurecr.io
2024/03/18 08:41:04 Successfully logged into acaalbumsthesse1.azurecr.io
2024/03/18 08:41:04 Executing step ID: build. Timeout(sec): 28800, Working directory: '', Network: ''
2024/03/18 08:41:04 Scanning for dependencies...
2024/03/18 08:41:05 Successfully scanned dependencies
2024/03/18 08:41:05 Launching container with name: build
Sending build context to Docker daemon  133.6kB
Step 1/13 : FROM mcr.microsoft.com/openjdk/jdk:21-mariner AS build
21-mariner: Pulling from openjdk/jdk
0455e3c62813: Pulling fs layer
dec38aea8163: Pulling fs layer
96e42a458ed4: Pulling fs layer
dec38aea8163: Verifying Checksum
dec38aea8163: Download complete
0455e3c62813: Verifying Checksum
0455e3c62813: Download complete
96e42a458ed4: Verifying Checksum
96e42a458ed4: Download complete
0455e3c62813: Pull complete
dec38aea8163: Pull complete
96e42a458ed4: Pull complete
Digest: sha256:1c7fff8147b1229d6aaec82fbb83bb0da458ee7c5c55bafca4d0caf62b6583ce
Status: Downloaded newer image for mcr.microsoft.com/openjdk/jdk:21-mariner
 ---> dc036ee5555b
Step 2/13 : ENV JAR_FILE=containerapps-albumapi-java-0.0.1-SNAPSHOT.jar
 ---> Running in 8d9c483ce310
Removing intermediate container 8d9c483ce310
 ---> a1727f7382e4
Step 3/13 : WORKDIR /app
 ---> Running in a173cdbe30bb
Removing intermediate container a173cdbe30bb
 ---> f1aa7f68bac6
Step 4/13 : COPY mvnw* /app/
 ---> 134ece7b236d
Step 5/13 : COPY .mvn /app/.mvn
 ---> 9d26351ccb44
Step 6/13 : COPY pom.xml /app
 ---> 7377fbfc6dc1
Step 7/13 : COPY ./src /app/src
 ---> b3cf2e2a5b29
Step 8/13 : RUN ls -la /app
 ---> Running in c63b3f854723
total 40
drwxr-xr-x 1 root root  4096 Mar 18 08:41 .
drwxr-xr-x 1 root root  4096 Mar 18 08:41 ..
drwxr-xr-x 3 root root  4096 Mar 18 08:41 .mvn
-rw-rw-rw- 1 root root 11598 Mar 18 08:02 mvnw
-rwxrwxrwx 1 root root  7797 Mar 18 08:02 mvnw.cmd
-rw-rw-rw- 1 root root  1316 Mar 18 08:02 pom.xml
drwxr-xr-x 4 root root  4096 Mar 18 08:41 src
Removing intermediate container c63b3f854723
 ---> f85e64f53d0d
Step 9/13 : RUN ./mvnw dependency:go-offline -B -Dproduction package
 ---> Running in 0c68d049565a
/bin/sh: line 1: ./mvnw: Permission denied
The command '/bin/sh -c ./mvnw dependency:go-offline -B -Dproduction package' returned a non-zero code: 126
2024/03/18 08:41:20 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 126

Run ID: cb2 failed after 19s. Error: failed during run, err: exit status 1
Run failed

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

Ex. Did this issue occur in the CLI or the Portal? CLI

thesse1 commented 7 months ago

Already reported as https://github.com/microsoft/azure-container-apps/issues/1120, but it rather seems to be an ACR issue.

AndreHamilton-MSFT commented 5 months ago

@thesse1 this repository is for Microsoft Artifact Registry(mcr.microsoft.com) issues. For acr related issues you can file issues at https://github.com/Azure/acr/issues. Feel free to reopen this issue if you feel otherwise