Is CIRCLE_COMPARE_URL still a thing?

Hi there,

I came here after reading the documentation on CIRCLE_COMPARE_URL and then realizing it is left empty on all builds in my case.

I see a bunch of closed threads here without an official response from CircleCI staff. It would be nice to 1) if this is a bug, get it fixed or at least have a clear statement on the priority and ETA 2) or deprecate it from the documentation 3) or update the documentation on what requirements need to be fulfilled to not have this variable empty.


Hi @salomvary,

I’m an engineer on the Pipelines team here at CircleCI. The environment variable CIRCLE_COMPARE_URL is available in v2 of our config schema, but not in v2.1. We are aware that this is a problem for some folks, and we’re working to provide an upgrade path.

For v2.1 we are introducing something we call pipeline values. You use these like job parameters, but they’re more like constants for your pipeline. The first set of pipeline values we are introducing contains all the values you need to define your own CIRCLE_COMPARE_URL. These are available to use in production right now, but the public documentation hasn’t caught up yet.

      CIRCLE_COMPARE_URL: << pipeline.project.git_url >>/compare/<< pipeline.git.base_revision >>..<<pipeline.git.revision>>

The full set of pipeline values available today are:

  • - a globally unique id representing the pipeline
  • pipeline.number - a project unique integer id for the pipeline
  • pipeline.project.git_url - e.g.
  • pipeline.project.type - e.g. “github”
  • pipeline.git.tag - the tag triggering the pipeline (if any)
  • pipeline.git.branch - the branch triggering the pipeline (if any)
  • pipeline.git.revision - the current git revision
  • pipeline.git.base_revision - the previous git revision (if this is a PR)

We’ll work hard to get better documentation for this out soon, I promise. In the meantime I’ve opened a PR against our docs to make it clear that CIRCLE_COMPARE_URL is not availble in 2.1, and point to this discuss post for more details.

Hello @stig, thanks for the quick reply!

My config seems to be using version: 2 not 2.1. Still, CIRCLE_COMPARE_URL is empty.

Any chance I am experiencing this because “Enable pipelines” is on under Advanced Settings?

Btw the pipeline values solution seems promising!

1 Like

Any chance I am experiencing this because “Enable pipelines” is on under Advanced Settings?

Not as far as I understand. If you’re using version: 2 config and CIRCLE_COMPARE_URL is not set it’s likely because we haven’t been able to capture the base (“before”) revision, which we cannot get from the repo itself. We get the base revision from the webhook associated with the event. (I.e. push/pr creation.) In some cases the base revision is not available in the webhook, and we are unable to create the CIRCLE_COMPARE_URL. (I’m afraid I don’t have a full understanding of why this is yet.)

PS: if you’re able to share a link to your job for future queries that would be most helpful.

Wait, is CIRCLE_COMPARE_URL only meant to be available on pull requests? I somehow thought this also allows retrieving the commit range between the current and previous build on any branch (the same commit range that is shown on the web UI too).

PS: if you’re able to share a link to your job for future queries that would be most helpful.

It’s a private repo but if you have access as an employee it’s the only repo this user has access to:

Yes, CIRCLE_COMPARE_URL should be available when you push new commits to an existing branch.

Pipeline variables documentation is now live: :tada:

Hi @stig I’m trying to use the CIRCLE_COMPARE_URL code you listed. What I’m seeing for new branches is that there is no pipeline.git.base_revision . Any recommendations on how to get this compare url to work for new branches? The old CIRCLE_COMPARE_URL handled this case.