For projects that use our GitLab or GitHub App integration, The CIRCLE_BUILD_URL
environment variable currently resolves to a URL in this format:
“https://circleci.com/circleci/orgID/projectID/jobNumber ”
This URL returns a 404.
On or after Dec 5, 2023, the CIRCLE_BUILD_URL
environment variable will resolve to a URL in this format:
“https://app.circleci.com/pipelines/circleci/orgID/projectID/pipelineNumber/workflows/workflowID/jobNumber ”
This will no longer return a 404 and link to the relevant job.
1 Like
This has now changed as of today
Something must be off because we are still seeing (see https://app.circleci.com/pipelines/github/s2technologies/testspace.test.ci/8947/workflows/248f0d2a-83bb-4e2d-96e4-597551c8fb9a/jobs/7176/parallel-runs/0/steps/0-102 )
CIRCLE_BUILD_URL=https://circleci.com/gh/s2technologies/testspace.test.ci/7176
Besides that, shouldn’t the correct/expected URL be formatted as:
https://app.circleci.com/pipelines/github/orgID/projectID/pipelineNumber/workflows/workflowID/jobs/jobNumber
@ivailop The change is only applicable to organizations that are integrated with CircleCI’s GitHub App .
From the link you sent, that organization is integrated with CircleCI’s OAuth App (you can tell by the “/github” in the URL).
Are there issues that you’re having with the environment variable’s value that you posted?
ivailop
January 27, 2024, 11:34pm
5
I guess, I expected the format of the URL to be the same (just github or circleci be different).
That inconsistency and others (as mentioned in CIRCLE_PROJECT_USERNAME & CIRCLE_PROJECT_REPONAME environment variables changing for projects that use GitHub App & GitLab ) makes things very confusing. As a user I should not be knowing the type of integration (GH App, GH OAuth, GL, or BB) when using any of the environment variables!?!
For example, how should I obtain (consistently) the:
Workflow URL - currently there is no env-var for that! How to construct it without know the “integration” type?
Job URL - currently the misnamed CIRCLE_BUILD_URL
exists, but is non-consistently formatted!
VCS user/org-name - is the current CIRCLE_PROJECT_USERNAME
good for that?
VCS repo-name - is the current CIRCLE_PROJECT_REPONAME
good for that?
@sebastian-lerner any comment to the above?
Sorry for the delay:
Unfortunately there is no way to get the workflow URL in a way that’s agnostic to the integration type. The only option would be to manipulate the current string from CIRCLE_BUILD_URL. You could also construct it with CIRCLE_PIPELINE_ID and CIRCLE_WORKFLOW_ID but it will differ a bit between the integrations. ie. GitHub OAuth App will be “app.circleci.com/pipelines/github/org-name/project-name/pipelineID/workflows/workflowID ” whereas a project using the GitHub App integration will be “app.circleci.com/pipelines/circleci/orgID/projectID/pipelineID/workflows/workflowID ”
I’m still a little confused why you believe that CIRCLE_BUILD_URL is misnamed? In this case we are using “build” and “job” interchangeably. And for all integration types, while the formatting is inconsistent, the result should be a URL to a specific job
VCS org name: yes you can use CIRCLE_PROJECT_USERNAME
VCS repo name: yes you can use CIRCLE_PROJECT_REPONAME
we have a goal to enable a way to get these types of values in an “integration-agnostic” way, but we don’t have that yet unfortunately. When we make progress on that, I’ll be sure to update this thread.