aws-cloudformation / cloudformation-cli

The CloudFormation Provider Development Toolkit allows you to author your own resource providers and modules that can be used by CloudFormation.
Apache License 2.0
318 stars 161 forks source link

Code is building locally, but CodeBuild is failing #895

Closed shaurysh closed 2 years ago

shaurysh commented 2 years ago

Pull Request: https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-nimblestudio/pull/30 Maven commands like compile, package, verify succeed on my CloudDesktop, but the CodeBuild keeps failing. Log from CodeBuild - Please let me know if you need the IsenLink to this:

[INFO] --- exec-maven-plugin:1.6.0:exec (generate) @ aws-nimblestudio-studio-handler ---
--
=== Unhandled exception ===
Please report this issue to the team.
Issue tracker: github.com/aws-cloudformation/cloudformation-cli/issues
Please include the log file 'rpdk.log'
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:804)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:751)
at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:313)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for aws-nimblestudio-cloudformation 1.0:
[INFO]
[INFO] aws-nimblestudio-cloudformation .................... SUCCESS [  7.482 s]
[INFO] aws-nimblestudio-common ............................ SUCCESS [  3.686 s]
[INFO] aws-nimblestudio-studio-handler .................... FAILURE [  3.468 s]
[INFO] aws-nimblestudio-studiocomponent-handler ........... SKIPPED
[INFO] aws-nimblestudio-launchprofile-handler ............. SKIPPED
[INFO] aws-nimblestudio-streamingimage-handler ............ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.649 s
[INFO] Finished at: 2022-07-28T15:58:08Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (generate) on project aws-nimblestudio-studio-handler: Command execution failed. Process exited with an error: 127 (Exit value: 127) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :aws-nimblestudio-studio-handler
Build failed!
 
[Container] 2022/07/28 15:58:08 Command did not exit successfully if [ "$(ls -A $CODEBUILD_SRC_DIR)" ]; then
cd $CODEBUILD_SRC_DIR
mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --no-transfer-progress
if [ "$?" -ne 0 ] ; then
echo "Build failed!"
exit 1
fi
else
echo "$CODEBUILD_SRC_DIR is empty"
fi
exit status 1
[Container] 2022/07/28 15:58:08 Running command cat "$CODEBUILD_SRC_DIR/aws-nimblestudio-launchprofile/rpdk.log"
cat: /codebuild/output/src287672709/src/github.com/aws-cloudformation/aws-cloudformation-resource-providers-nimblestudio/aws-nimblestudio-launchprofile/rpdk.log: No such file or directory
 
[Container] 2022/07/28 15:58:08 Command did not exit successfully cat "$CODEBUILD_SRC_DIR/aws-nimblestudio-launchprofile/rpdk.log" exit status 1
[Container] 2022/07/28 15:58:08 Phase complete: BUILD State: FAILED
[Container] 2022/07/28 15:58:08 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: cat "$CODEBUILD_SRC_DIR/aws-nimblestudio-launchprofile/rpdk.log". Reason: exit status 1
[Container] 2022/07/28 15:58:08 Entering phase POST_BUILD
[Container] 2022/07/28 15:58:08 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2022/07/28 15:58:08 Phase context status code:  Message:

Already referred to these old issues: Link1 and Link2.

We already have these commands in our buildspec.yaml file:

-  pip install pyyaml --upgrade
-  pip install --upgrade 'six==1.16.0'
-  pip install --upgrade pre-commit cloudformation-cli-java-plugin

These (^) were the suggestions in the old tickets I found. I see that previously it has been suggested to use version 1.15.0 of six, however, we have seen CodeBuild builds succeeding 7 months ago with the 1.16.0 version of six. Please let us know if you feel downgrading it to 1.15.0 will fix the issue.

shaurysh commented 2 years ago

Updating buildspec.yml with these lines fixed the issue.