CIRCLE_COMPARE_URL is empty when running a workflow job

I want to use CIRCLE_COMPARE_URL to analyze the commits for my build, but it seems to be empty when running workflow jobs. It does seem defined for single (non-workflow) jobs.

Is this a not-yet-supported feature? Is there a time table for getting it available in workflow jobs?

3 Likes

I would love to use the tip suggested here: Get list of commits in build

Any update on the status of this?

I sm having the same problem, CIRCLE_COMPARE_URL is empty for all builds

I have the same problem here https://github.com/entria/entria-fullstack

is there any workaround?

Hey, just successfully implemented a workaround which makes use of the API:

LAST_SUCCESSFUL_BUILD_URL="https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/tree/$CIRCLE_BRANCH?filter=completed&limit=1"
LAST_SUCCESSFUL_COMMIT=`curl -Ss -u "$API_KEY:" $LAST_SUCCESSFUL_BUILD_URL | jq -r '.[0]["vcs_revision"]'`
CHANGES_SINCE_LAST_COMMIT=`git diff --name-only $CIRCLE_SHA1..$LAST_SUCCESSFUL_COMMIT`
changesArray=( $CHANGES_SINCE_LAST_COMMIT )

You need to generate an API key which could be defined via environment variables.

Downside is that the algorithm only works for the latest build. In case you restart an older one, the change set will be empty.

@mfittko I’ve created this https://github.com/entria/entria-deploy to help manage which packages/modules to deploy on circleci

I just came across this orb command. Huge, but looks promising. :sweat_smile:

https://circleci.com/orbs/registry/orb/iynere/compare-url#commands-reconstruct

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.