scoverage / sbt-coveralls

sbt-plugin to upload sbt-scoverage reports to coveralls
https://github.com/scoverage
Other
104 stars 50 forks source link

[error] Uploading to https://coveralls.io failed: Provided service_job_id but not service_name #288

Closed skennedy closed 1 month ago

skennedy commented 10 months ago

Thanks for this plugin - it's been working a great for my team until recently...

Upgraded to the latest and greatest, which I was using to upload coverage from a CircleCI pipeline - and it started failing with this error:

[info] sbt-coveralls: Generating reports for 81 files ...
[info] sbt-coveralls: Adding file reports to the coveralls file (coveralls.json) ...
[info] sbt-coveralls: Uploading the coveralls file (coveralls.json) ...
[error] 
[error] Uploading to https://coveralls.io failed: Provided service_job_id but not service_name.
[error] 
[error]          
[success] Total time: 0 s, completed Nov 2, 2023, 2:48:44 PM

(side note: didn't notice for a while, because the SBT build ends up succeeding :thinking: )

Looks like #274 was the culprit, the code no longer populates service_name if your coverallsAuth is a CoverallsRepoToken:

https://github.com/scoverage/sbt-coveralls/commit/292581b8cebc6c3d3de12570e25c4e94d87b17ad#diff-27c4f1e540de6ed41915777359d6f779f9dc76eae56a77517dc46534512e4310

My configuration was:

  coverallsService := sys.env.get("CI").map { _ =>
    new CIService {
      val name = "circleci"
      val jobId = sys.env.get("CIRCLE_BUILD_NUM")
      val pullRequest = sys.env.get("CI_PULL_REQUEST").flatMap(_.split("/").lastOption)
      val currentBranch = sys.env.get("CIRCLE_BRANCH")
    }
  }

This seems to be a workaround for now:

  coverallsService := sys.env.get("CI").map { _ =>
    new CIService {
      val name = "circleci"
      val jobId = sys.env.get("CIRCLE_BUILD_NUM")
      val pullRequest = sys.env.get("CI_PULL_REQUEST").flatMap(_.split("/").lastOption)
      val currentBranch = sys.env.get("CIRCLE_BRANCH")

      override def coverallsAuth(userRepoToken: Option[String]): Option[CoverallsAuth] =
        userRepoToken match {
          case Some(token) => Some(CIServiceToken(token))
          case None        => super.coverallsAuth(userRepoToken)
        }
    }
  }

I would love to contribute a fix but I don't understand the reasoning behind the different types of that ADT - maybe @ruippeixotog could advise?

Thanks again to everyone who built the plugin

rolandtritsch commented 10 months ago

Hi @skennedy. Will try to take a look at this later today.

mwz commented 2 months ago

Hi @rolandtritsch I'm facing the same issue - Is there any chance this could be looked into?

rolandtritsch commented 2 months ago

Hi @mwz. Sorry for the radio silence and lack of progress here. Live got in the way. Will try to take a look at this on/over the weekend.

rolandtritsch commented 1 month ago

Hi @mwz @skennedy. This should be fixed now - https://github.com/scoverage/sbt-coveralls/releases/tag/v1.3.13

mwz commented 1 month ago

Thank you @rolandtritsch - that fixed the issue for me 👍🏻