Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

AWS CodeBuild - Could not retrieve the current commit uuid #55

Closed
onema opened this issue Aug 4, 2018 · 3 comments
Closed

AWS CodeBuild - Could not retrieve the current commit uuid #55

onema opened this issue Aug 4, 2018 · 3 comments

Comments

@onema
Copy link

onema commented Aug 4, 2018

Are you looking for help?

Yes

Scala Version (2.10.x / etc)

Scala version 2.12.5
SBT Version 1.1.1

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Alpine 3.7

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

Oracle 1.8.0_151

Library Dependencies

Expected Behavior

Build step should not fail when running sbt codacyCoverage

Actual Behavior

sbt codacyCoverage throws the following exception when running in AWS CodeBuild

java.lang.RuntimeException: could not retrieve the current commit uuid�

It seems that none of the EnvVars supported by the tool are available in CodeBuild.

See Environment Variables in Build Environments

A possible workaround is to assign the available variable CODEBUILD_SOURCE_VERSION to CI_COMMIT

export CI_COMMIT="${CODEBUILD_SOURCE_VERSION}"

Reproducible Test Case

sample buildspec:

version: 0.2
phases:
  build:
    commands:
      - echo Build started on `date`
      - sbt compile

      - echo Testing Core on `date`
      - sbt clean coverage test

      - echo Generating coverage report
      - sbt coverageReport
      - sbt coverageAggregate

      - echo Submit coverage report to Codacy
      - echo "${CODACY_PROJECT_TOKEN}"
      - echo "${CODEBUILD_SOURCE_VERSION}"
      - echo "CI Commit ${CI_COMMIT}"

      # Current Workaround 
      #- export CI_COMMIT="${CODEBUILD_SOURCE_VERSION}"
      - sbt codacyCoverage

Output

[Container] 2018/08/04 21:10:45 Running command echo Submit coverage report to Codacy
Submit coverage report to Codacy

[Container] 2018/08/04 21:10:45 Running command echo "${CODACY_PROJECT_TOKEN}"
abcd1234...

[Container] 2018/08/04 21:10:45 Running command echo "${CODEBUILD_SOURCE_VERSION}"
816.....

[Container] 2018/08/04 21:10:45 Running command echo "CI Commit ${CI_COMMIT}"
CI Commit 

[Container] 2018/08/04 21:10:45 Running command sbt codacyCoverage
Loading settings from plugins.sbt ...�
Loading project definition from /codebuild/output/src894567465/src/github.com/onema/JsonExtensions/project�
Loading settings from build.sbt ...�
Set current project to json-extensions (in build file:/codebuild/output/src894567465/src/github.com/onema/JsonExtensions/)�
java.lang.RuntimeException: could not retrieve the current commit uuid�
	at scala.sys.package$.error(package.scala:27)�
	at com.codacy.CodacyCoveragePlugin$.com$codacy$CodacyCoveragePlugin$$codacyCoverageCommand(CodacyCoveragePlugin.scala:90)�
	at com.codacy.CodacyCoveragePlugin$AutoImport$.$anonfun$baseSettings$1(CodacyCoveragePlugin.scala:34)�
	at com.codacy.CodacyCoveragePlugin$AutoImport$.$anonfun$baseSettings$1$adapted(CodacyCoveragePlugin.scala:31)�
	at scala.Function1.$anonfun$compose$1(Function1.scala:44)�
	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)�
	at sbt.std.Transform$$anon$4.work(System.scala:66)�
	at sbt.Execute.$anonfun$submit$2(Execute.scala:262)�
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)�
	at sbt.Execute.work(Execute.scala:271)�
	at sbt.Execute.$anonfun$submit$1(Execute.scala:262)�
	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)�
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)�
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)�
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)�
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)�
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)�
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)�
	at java.lang.Thread.run(Thread.java:748)�
(�codacyCoverage�) could not retrieve the current commit uuid�
Total time: 0 s, completed Aug 4, 2018 9:10:51 PM�

[Container] 2018/08/04 21:10:51 Command did not exit successfully sbt codacyCoverage exit status 1
[Container] 2018/08/04 21:10:51 Phase complete: BUILD Success: false
[Container] 2018/08/04 21:10:51 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: sbt codacyCoverage. Reason: exit status 1
[Container] 2018/08/04 21:10:51 Entering phase POST_BUILD
[Container] 2018/08/04 21:10:51 Running command echo Build completed on `date`
Build completed on Sat Aug 4 21:10:51 UTC 2018
@rtfpessoa
Copy link
Contributor

rtfpessoa commented Aug 6, 2018

Fixed in #56

@rtfpessoa
Copy link
Contributor

Released as version 1.3.15.

@onema
Copy link
Author

onema commented Aug 7, 2018

Thank you for the quick response 🙏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants