Auto-increment variables


#1

I’m looking to convert over to Buddy from Jenkins. One of the things we do in Jenkins that I’ve yet to find an alternative to in Buddy is auto-incrementing the build version number. It’d be nice if we could use the existing Buddy environmental variables to cover this use case as we use the build version variable at various points in our pipeline.


#2

@codemoomba, we’ve added auto-increment variables to our backlog. Thanks for your suggestion!
For now you can use ${execution.id}, for instance.


#3

@Octavia ${execution.id} works so long as everything is in the same pipeline. We have three pipelines, two of which we want to kick off manually, but they need to share the same variable. Our use case is one pipeline would use and increment the project variable, and the other pipelines should be able to pull this variable without incrementing it.

A temporary fix would be to use the commit hash. Does this feature exist in Buddy currently?


#4

@Octavia Ignore my question about the commit hash. I found the variable: ${execution.pipeline.last_execution_revision}


#5

Thanks, @codemoomba. I’ve added your remarks to the task including auto-increment variables.


#6

Hello @Octavia ,

I would suggest not just add “auto-increment variables” but also consider implementing a pre-defined action to set git tag according to a build number.
“auto-increment variables” probably would be related to such feature.

Yet what I suggest it to automatically set git tag with build number if a build is successful. Each team use their own build number formats, like:
2017.01.20.1
release-15.1
2.0.15 (simple semantic versioning)
etc.

So with action that automatically set a build tag we would need to have an ability to customize tag format and specify when major an minor numbers should be changed.

Looking forward to your comments.

With best regards,
Dmitry


#7

@Dmitry, great idea with this auto-increment. We’ve added it to the list .

As for:

So with action that automatically set a build tag we would need to have an ability to customize tag format and specify when major an minor numbers should be changed.

It usually works this way that the minor version gets increased with auto increment. However, the major version is set by the devs upon releasing.

Wouldn’t it be more convenient to fetch the value from the file which is in the repository? Then, the dev could change the version thanks to git commit


#8

This is a feature which we would much prefer. To aid even more scenarios I was thinking about the possibility to set/change variables/params in an action. This would enable you to programmatically determine e.g. parsing a package.json file via jq.


#9

I see, thanks for your suggestion! I’ve passed that to the team.


#10

An update regarding this: I’m happy to let you know this feature is planned for the next sprint.
It may be ready in about a month.


#11

I’m very happy to hear that since I am also looking for this feature. Have the feature been released yet?


#12

Tomas, for now the only auto-increment variable is: $BUDDY_EXECUTION_ID
Apart from that, you can define your own environment variable, set it as settable and increment it with the usage of a build action.

Here you can find more details on that: https://buddy.works/blog/new-feature-passing-parameters


#13

Thanks! Works great :slight_smile:


#14

Hey guys, we’ve just published a new guide that explains how to create a pipeline that will automatically increment application version in your Git repo. Check it out: https://buddy.works/guides/semantic-versioning