Add a build number for workflow runs (shared by all jobs in a workflow)
complete
J
Jonah
Concurrent deploys have been a problem for us when using workflows. E.g. I merge commits A and B in rapid succession and two deploy workflows run at the same time potentially failing if my deploy task can't handle concurrent runs or deploying an older revision than expected when the builds finish out of order.
A partial, and possibly easy to implement, solution to this would be if we had access to a build number shared across all jobs in the workflow so we could at least identify build order (currently CIRCLE_BUILD_NUM is set when a job starts so the deploy job for the workflow triggered by commit A might be higher than the number for the deploy job in the workflow triggered by commit B if any of A's preceding jobs are slow).
This would also allow us to easily tag releases with a workflow number which might prove to be more human friendly than a job number because it would increment less dramatically (we run ~12 jobs per workflow iteration).
CCI-I-348
N
Nathan Dintenfass
You can now refer to << pipeline.number >> in configuration, which will be the same for all workflows and all jobs within the configuration file. See https://circleci.com/docs/2.0/pipeline-variables/#pipeline-values for more info.
C
Chris Taylor
Any update on this?
c
chris.taylor
Any idea when this will be implemented?
H
Harry Adams
I understand this may cause problems with existing artifacts created using the CIRCLE_BUILD_NUM var in v1; but persisting the first build step number is a bit messy.
Just from the hip, maybe some sort of prefixing: e.g. `WORKFLOW_X'. It's not ideal, we'd just really like to see this added. We'll take anything incremental and human readable :)
N
Nick s
Furthermore, it would be great to be able to access all the build numbers and artifacts for a given workflow, e.g.
orhttps://circleci.com/workflow-run/<workflow_id>/builds/buildjs/artifacts (if you want to namespace the artifacts)
This will make it much easier to access builds and artifacts for a workflow. A particular use-case that we depend on is posting links to artifacts like screenshots, logs, etc. when our bots post build summary comments to Slack/Github/Zulip at the end of workflow runs.
N
Nathan Dintenfass
We have plans along these lines. Not yet sure when you'll see the changes, but we agree that there should be a way to tie all the jobs together via an incrementing integer.