aws / aws-codebuild-docker-images

Official AWS CodeBuild repository for managed Docker images http://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref.html
Other
1.11k stars 971 forks source link

aws/codebuild/standard:5.0 Build fails when file names have non english characters #715

Open chnacib opened 4 months ago

chnacib commented 4 months ago

Describe the bug Build fails when file names have non english characters. I tried to follow this doc and set the following commands in my buildspec.yml, but the error persists.

pre_build:
  commands:
    - export LC_ALL="en_US.UTF-8"
    - locale-gen en_US en_US.UTF-8
    - dpkg-reconfigure locales

To Reproduce Steps to reproduce the behavior:

  1. set aws/codebuild/standard:5.0 as image
  2. install maven packages with "ç"

Expected behavior Following the doc, it was supposed to work

Logs

[ERROR] /codebuild/output/src3914630389/src/x/target/generated/x/x/x/Servi?os.java:[20,8] class Servi?os is public, should be declared in a file named Servi?os.java

Platform (please complete the following information):

When using amazonlinux2 and the following commands:

pre_build:
  commands:
    - export LC_ALL="en_US.utf8"

It works, but not in ubuntu

csk14 commented 1 month ago

Facing similar issue, a local docker image which is using base image as "public.ecr.aws/codebuild/amazonlinux2-x86_64-standard:5.0" and local docker file has android tools 34, gradle v8.7, cordova v12.0.0.

Couple of referenced SDKs have chinese characters, so updated buildspec.yaml as suggested in AWS doc which did not fix codebuild warning and build failure.

buildspec.yaml update:

pre_build:
  commands:
    - export LC_ALL="en_US.utf8"
    - export LANG="en_US.utf8"

warning:

Running command export LC_ALL="en_US.UTF-8"
/codebuild/output/tmp/script.sh: line 4: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

build failure:

Welcome to Gradle 8.7!
Here are the highlights of this release:
 - Compiling and testing with Java 22
 - Cacheable Groovy script compilation
 - New methods in lazy collection properties
For more details see https://docs.gradle.org/8.7/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :app
strippedNativeLibsDir is deprecated and no longer used. Please remove it from your build configuration.
> Task :app:preBuild UP-TO-DATE
> Task :app:preReleaseBuild UP-TO-DATE
> Task :app:generateReleaseResValues
> Task :app:injectCrashlyticsMappingFileIdRelease
> Task :app:processReleaseGoogleServices
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preReleaseBuild UP-TO-DATE
> Task :CordovaLib:generateReleaseResValues
> Task :CordovaLib:generateReleaseResources
> Task :CordovaLib:packageReleaseResources
> Task :app:mapReleaseSourceSetPaths
> Task :app:mapReleaseSourceSetPaths FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mapReleaseSourceSetPaths'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Failed to transform sdkcamera-1.6.4.aar (com.arashivision.sdk:sdkcamera:1.6.4) to match attributes {artifactType=android-res, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: /root/.gradle/caches/modules-2/files-2.1/com.arashivision.sdk/sdkcamera/1.6.4/d712fab092a7f0ffb7fcd840fc2c11bb4718dbd0/sdkcamera-1.6.4.aar.
         > Failed to transform '/root/.gradle/caches/modules-2/files-2.1/com.arashivision.sdk/sdkcamera/1.6.4/d712fab092a7f0ffb7fcd840fc2c11bb4718dbd0/sdkcamera-1.6.4.aar' using Jetifier. Reason: InvalidPathException, message: Malformed input or input contains unmappable characters: com/arashivision/sdkcamera/camera/InstaCameraManager$?????.class. (Run with --stacktrace for more details.)
           Suggestions:
            - Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
            - If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
   > Failed to transform sdkmedia-1.6.4.aar (com.arashivision.sdk:sdkmedia:1.6.4) to match attributes {artifactType=android-res, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: /root/.gradle/caches/modules-2/files-2.1/com.arashivision.sdk/sdkmedia/1.6.4/ee771414a1a6db80cc67d747764d2a05b0894556/sdkmedia-1.6.4.aar.
         > Failed to transform '/root/.gradle/caches/modules-2/files-2.1/com.arashivision.sdk/sdkmedia/1.6.4/ee771414a1a6db80cc67d747764d2a05b0894556/sdkmedia-1.6.4.aar' using Jetifier. Reason: InvalidPathException, message: Malformed input or input contains unmappable characters: O8?oO8?88/O8?oO8?88/O8?oO8?88/O8?oO8?88/O8?oO8?88$O8?oO8?88.class. (Run with --stacktrace for more details.)
           Suggestions:
            - Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
            - If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
   > Failed to transform basemedia-1.6.4.aar (com.arashivision.sdk:basemedia:1.6.4) to match attributes {artifactType=android-res, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: /root/.gradle/caches/modules-2/files-2.1/com.arashivision.sdk/basemedia/1.6.4/1fc90098317613d43f9ea24a70cd38790ebbd6a3/basemedia-1.6.4.aar.
         > Failed to transform '/root/.gradle/caches/modules-2/files-2.1/com.arashivision.sdk/basemedia/1.6.4/1fc90098317613d43f9ea24a70cd38790ebbd6a3/basemedia-1.6.4.aar' using Jetifier. Reason: InvalidPathException, message: Malformed input or input contains unmappable characters: IL1Iii/IL1Iii/IL1Iii/IL1Iii/I1I/IL??l/IL1Iii.class. (Run with --stacktrace for more details.)
           Suggestions:
            - Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
            - If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).

fyi, I have printed locale before and after updating the LC_ALL & LANG

locale before:

LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

locale after

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8