mendix / docker-mendix-buildpack

Build and Run Mendix in Docker
https://www.mendix.com
Apache License 2.0
87 stars 114 forks source link

Space in ${MPR_FILENAME} will break mxbuild for the build.py script #204

Open eist76 opened 1 month ago

eist76 commented 1 month ago

Hi,

i was testing and troubleshooting build failures with latest Docker Buildpack version v5.1.0 where a build.py script needs to be executed before actually building the final docker images: ./build.py --source <path-to-source> --destination <destination-dir> build-mda-dir

for me this was failing with this error message: `docker start --attach --interactive da3588d8aa3ee1c126330f09601887b979acc4f65343fed92506514d34bf0f7a Detected Java 11


| \/ | | \ () | | | | \ / | | |) | | | | | | |\/| \ \/ / <| | | | | |/ ` | | | | |> <| |) | || | | | (| | || |//__/ \,|||\,_|

v9.6.10.40529

ERROR: Build options are not specified. Usage: mxbuild [OPTIONS]+ FILENAME Build Mendix Deployment Packages (.mda files) using the command-line. The specified FILENAME is assumed to be a Mendix App Package (.mpr) file that is located inside a app directory.

Options: -h, --help show this message and exit. --serve indicates if MxBuild should be executing in service mode. --host=ADDRESS the listening ADDRESS (ip/hostname) used while serving. Default ADDRESS is localhost. --port=PORT the TCP PORT number used while serving. Default PORT number is 6543. --java-home=DIRECTORY the Java home DIRECTORY that is used for running Ant. --java-exe-path=FILENAME the Java executable FILENAME that is used for running Ant. --target=VALUE the target of this build: 'package' or 'deploy'. the default is 'package'. --check-java-dependencies internal option to check Java dependencies with the 'jdeps' tool as part of the 'package' build. -o, --output=FILENAME the FILENAME of the MDA file to create (only for target 'package'). the default is 'out.mda' in the current directory. --model-version=VERSION the model VERSION that is embedded in the deployment package. --model-description=DESCRIPTION the model DESCRIPTION that is embedded in the deployment package. --project-name=NAME the project NAME that is registered in the Mendix Runtime. --loose-version-check use less strict version check, i.e., allow conversion from earlier versions. --write-errors=FILENAME write all errors, warnings and deprecations in the project to FILENAME, in JSON format. the file is only written if the project has errors. --java-debug-info generate all debugging information when compiling Java code (local variables, source files and line numbers). By default, only source files and line numbers are included.`

after some debugging i figured out that my MPR_FILENAME has multiple spaces in it like 'Partner Asset Management.mpr' which broke the build script or better the mxbuild/build script. it was trying to execute: mono /opt/mendix/modeler/mxbuild.exe --target=package --java-home=/etc/alternatives/java_sdk_11 --java-exe-path=/etc/alternatives/java_sdk_11/bin/java --model-version=unversioned --output=/workdir/output.mda /workdir/project/Partner Asset Management.mpr and failed because it couldn't find the file apparently.

changing line 36 in mxbuild/build from: --output=/workdir/output.mda /workdir/project/${MPR_FILENAME} to --output=/workdir/output.mda /workdir/project/"${MPR_FILENAME}" resolved the issue for me.

not sure if i had done anything wrong with executing the build.py script to indicate whitespaces in my MPR filename. i did execute ./build.py --source trunk --destination build_out build-mda-dir and in the trunk directory it MPR file was listed like this: ➜ ll trunk total 194M -rw-r--r-- 1 xxx xxx 71M Sep 6 11:44 'Partner Asset Management.mpr' drwxr-xr-x 14 xxx xxx 4.0K Sep 6 11:43 javascriptsource drwxr-xr-x 23 xxx xxx 4.0K Sep 6 11:44 javasource drwxr-xr-x 6 xxx xxx 4.0K Sep 6 11:44 resources drwxr-xr-x 4 xxx xxx 4.0K Sep 6 11:44 theme drwxr-xr-x 3 xxx xxx 4.0K Sep 6 11:44 theme-cache drwxr-xr-x 18 xxx xxx 4.0K Sep 6 11:44 themesource drwxr-xr-x 2 xxx xxx 36K Sep 6 11:44 userlib drwxr-xr-x 2 xxx xxx 4.0K Sep 6 11:44 widgets

can you please review and update the following: changing line 36 in mxbuild/build from: --output=/workdir/output.mda /workdir/project/${MPR_FILENAME} to --output=/workdir/output.mda /workdir/project/"${MPR_FILENAME}"

zlogic commented 1 month ago

Hi @eist76, thank you for the detailed feedback! Our team will include a fix in the next patch version of the Buildpack.