Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
skennedy opened this issue Nov 2, 2023 · 1 comment

Comments

@skennedy
Copy link

skennedy commented Nov 2, 2023

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 🤔 )

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

292581b#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
Copy link
Member

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

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

No branches or pull requests

2 participants