CI_PIPELINE_IID: Can I use this variable to find my commit?

Hey everyone,
I want to use the CI_PIPELINE_IID variable for a build version in my project, and I need to be able to use this variable to go back to the commit where it was generated. Is there a way to use this variable to go back to the specific pipeline/commit where it was generated?

Thanks

Hey Elran,

We use that variable for our build numbers as well. You can see it if you go to CI/CD > Pipelines and then select Pipeline IID from the dropdown menu on the top right side:

Unfortunately, it seems like you cannot filter pipelines by that number, at least not via UI - perhaps you could look up if it’s supported by API directly.

Hope this helps!

2 Likes

Thanks!
This is very helpful. Is there a way to search for it? I see that I can only find it manually

No, I think there is currently no way to search for it. I checked the API as well, only Pipeline ID would work.

But, you could write yourself a script for it, if it really matters. You could fetch all pipelines from API with

GET /projects/:id/pipelines

maybe even filter by source/something to narrow it down and then go through results checking which one matches the IID and print out the commit sha :slight_smile:

2 Likes