cloudformation-cli icon indicating copy to clipboard operation
cloudformation-cli copied to clipboard

Codebuild failed: incompatible dependency versions

Open tijianaws opened this issue 3 years ago • 2 comments

I was able to build locally. But when submit PR into the repo the Codebuild check failed and the build failed as well.

I have tried to use the fix from Issue by adding the pip install --upgrade 'six==1.15.0' into the buildspec.yml but still failed. There are still some incompatible error in the build

ERROR: aws-sam-cli 0.48.0 has requirement aws-sam-translator==1.22.0, but you'll have aws-sam-translator 1.36.0 which is incompatible.
ERROR: aws-sam-cli 0.48.0 has requirement docker~=4.0, but you'll have docker 5.0.0 which is incompatible.
ERROR: cfn-lint 0.50.0 has requirement pyyaml>=5.4; python_version != "3.4" and python_version != "3.5", but you'll have pyyaml 5.1.2 which is incompatible.

Here is the CodeBuild log CodeBuild IsenLog

Here is snapshot for the error

34 23

tijianaws avatar Jun 11 '21 23:06 tijianaws

We are facing the exact same error. We were able to build locally but CodeBuild build for PR failed even after doing the fix from Issue by adding the pip install --upgrade 'six==1.15.0' into the buildspec.yml.

CodeBuild log link

ERROR: aws-sam-cli 0.48.0 has requirement aws-sam-translator==1.22.0, but you'll have aws-sam-translator 1.36.0 which is incompatible.
--
181 | ERROR: aws-sam-cli 0.48.0 has requirement docker~=4.0, but you'll have docker 5.0.0 which is incompatible.
182 | ERROR: cfn-lint 0.51.0 has requirement pyyaml>=5.4; python_version != "3.4" and python_version != "3.5", but you'll have pyyaml 5.1.2 which is incompatible.
=== Unhandled exception ===
--
247 | Please report this issue to the team.
248 | Issue tracker: github.com/aws-cloudformation/cloudformation-cli/issues
249 | Please include the log file 'rpdk.log'
250 | [ERROR] Command execution failed.
251 | org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
252 | at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
253 | at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
254 | at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:804)
255 | at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:751)
256 | at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:313)
257 | at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
258 | at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
259 | at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
260 | at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
261 | at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
262 | at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
263 | at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
264 | at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
265 | at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
266 | at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
267 | at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
268 | at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
269 | at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
270 | at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
271 | at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
272 | at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
273 | at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
274 | at java.lang.reflect.Method.invoke (Method.java:498)
275 | at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
276 | at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
277 | at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
278 | at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
279 | [INFO] ------------------------------------------------------------------------
280 | [INFO] BUILD FAILURE


dsayali-git avatar Jun 18 '21 00:06 dsayali-git

Issues coming from CodeBuild docker images pre-installing incompatible dependencies:

  AWSCloudFormationResourceProviderCIProject:
    Type: AWS::CodeBuild::Project
    Properties:
      Environment:
        Image: aws/codebuild/standard:2.0

https://github.com/aws/aws-codebuild-docker-images/blob/2a8b4675dbaa7686db74ee901b85b7324d3ffcb9/unsupported_images/ubuntu/standard/2.0/Dockerfile#L245-L247


Option 1 (preferred): Migrate to Github actions


Option 2: Mitigate each incompatible dependency version explicitly like so:

https://github.com/aws-cloudformation/cloudformation-cli/issues/745#issuecomment-829791043 https://github.com/aws-cloudformation/cfn-python-lint/pull/1992 pip3 install pyyaml --upgrade

PatMyron avatar Jun 21 '21 20:06 PatMyron