-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Unique Build Number for CI Build Artifacts #65
Comments
We don't have this right now, not sure if this is on the roadmap or not, @chrispat would know better than me.
This is a great place 😄 |
I was hoping there was something I could use from an environment variable to use as the build number, but I can't see anything that increments for each run, listed there currently. However I did notice the debug output of the actions/upload-artifact does print/output a run number. As the src of this is not available due to it being a plugin. Are you able to tell me how or where to obtain the same build/run number please?
|
I was hoping that the contexts listed here in the docs, would have what I need but I still can't seem to find anything that I can use. The {
"fail-fast": true,
"job-index": 0,
"job-total": 1,
"max-parallel": 1
} |
@chrispat any idea on time-frame on when we would be able to get access to a build/run number please? |
We would like a build number for publishing docker images. This is an example for Elixir/Phoenix apps:
($CIRCLE_PREVIOUS_BUILD_NUM also came in handy) For now I'm using UPDATE: our particular toolchain supports
|
Rigth now we don't even have that concpet in the system so it is going to be a ways out. However, having some sort of run number as well as a scheme for letting customers name their runs is an area we do plan to address. |
We migrated from GitLab CI to GitHub actions and we used to use the incremental integer build number as Android app version code but now we have no idea what to do without it. 😞 |
I had the same problem and for now I'm using a small Firebase project (Cloud Function + Database) as a hack for that. You can create a free Firebase project, upload the cloud function and use something like this in your workflow:
Of course your build process has to use the env variable then. Kind of a weird idea, but works well for us.. 😉 This is the project: https://github.com/joernahrens/autoinc |
nice hack! |
|
As the GitHub Actions' docs state:
Having the Notice, that could currently be obtained in a very awkward way:
In addition, having the
|
As @chrispat noted, service doesn't have the concept. |
It does not have to be strictly a "build number" concept. All that needs to be provided is a
As I stated above, simply providing the associated |
We would love to have a unique id generated for each action run - and shared across jobs and parallel steps. In our case, we run end-to-end Cypress tests in https://github.com/cypress-io/github-action where multiple machines can split the test load - because API can "detect" that all machines are running for the same action. name: Parallel Cypress Tests
on: [push]
jobs:
test:
name: Cypress run
runs-on: ubuntu-latest
strategy:
matrix:
# run 3 copies of the current job in parallel
containers: [1, 2, 3]
steps:
- name: Checkout
uses: actions/checkout@v1
# because of "record" and "parallel" parameters
# these containers will load balance all found tests among themselves
- name: Cypress run
uses: cypress-io/github-action@v1
with:
record: true
parallel: true
group: 'Actions example'
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} Currently we use commit SHA as a workflow id - but this breaks when the users click "re-run checks", a better id (like Azure BuildID) would be ideal |
fyi run ID is being added probably will land sometime in January |
@ericsciple can you link to docs or implementation details once its rolled out please in this issue, so anyone who comes across this issue in the future can find the info they need. |
FYI i have a solution for those in need for a temporary workaround. It's not elegant but it works™️ https://medium.com/attest-engineering/adding-a-unique-github-build-identifier-7aa2e83cadca |
@ericsciple, could you please clarify what is a As I pointed above, the docs state that a workflow is identified with a Depending on the needs a "build number" could be:
To support both use cases, should there be provided both |
We are working on an Actions API that will be out for preview later this month. As part of that effort we have added a concept of RunId which is unique per workflow run across the repo. |
Is there any problem using github.run_number from the github context? It's not mentioned in the documentation but a dump of the github context object reveals it's there. It's also shown in the logs produced by the upload artifacts action. It seems to be exactly what we need, a sequential index that increments for any new run of the workflow. |
@JoseHernandezTR yes that will give you a unique number per run of that workflow. The docs updates are rolling out as part of the API beta that shipped today. |
Awesome news! Thanks! |
Along with the new API, would there be a related Webhook |
@chrispat I also just noticed the We are using Cypress and as @bahmutov pointed out above, we're looking for a unique identifier across all jobs in a workflow. The Is there something else we can use to make it truly unique? Couldn't find anything in the new GitHub Actions API. |
@chrispat - is it a bug? it seems like run_number should remain the same but id should change. |
It is a rerun of the same run so I expect them to both be the same. |
@chrispat - love the run_id, but the fact that it doesn't increment on reran workflows makes it useless for our purposes. We have the same scenario as @bahmutov, we need to coordinate with a build parallelization server that needs a guaranteed unique ID. These also need to be rerun, but if using any of the stock github options, we end up appending to the previous run, not start a new one as is desired. |
Another workaround for this - https://github.com/marketplace/actions/uuid-action |
It would really be awesome if in addition to |
@liskin
|
@ericsciple That doesn't solve my problem at all:
And as I said before, there already is an ID in the GitHub API (and the user-facing URLs use this ID as well) that satisfies all these requirements. It is the |
How can I obtain the const github = require('@actions/github');
const runId = github....? |
Check this out: https://medium.com/attest-engineering/adding-a-unique-github-build-identifier-7aa2e83cadca . A smart and simple idea that is basically: before any of your job that requires a build id, do a job that produces a |
Similar to the previous post, our solution is to generate a GUID and set it as an output parameter on the job, then use it in other jobs. This will be a unique id across all jobs in a run and will generate a different unique id across all jobs when re-running the workflow.
|
@mpdude They aren't available in github object yet, but you can get them from env vars: |
Hope I won't jinx it, but it looks like this might finally get implemented: https://news.ycombinator.com/item?id=28472454 :-) |
With addition of |
@joebowbeer |
How can I have unique build number for every workflow/branch |
I'm working around with the following:
That's good enough in my case to be able to have a unique number. |
Using Actions as CI
How or where can I get a unique build number to append build Artifacts with a unique CI version
/cc @damccorm
The text was updated successfully, but these errors were encountered: