# CI job for cookbook version increment + upload

**URL:** <https://discourse.chef.io/t/ci-job-for-cookbook-version-increment-upload/4400>\
**Category:** Chef Infra (archive)\
**Created:** [August 6, 2013, 8:19pm UTC](https://discourse.chef.io/t/ci-job-for-cookbook-version-increment-upload/4400 "2013-08-06T20:19:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anton\_Koldaev](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/anton_koldaev/32/91_2.png) [@Anton\_Koldaev](https://discourse.chef.io/u/Anton_Koldaev)\
**Post date:** [August 6, 2013, 8:19pm UTC](https://discourse.chef.io/t/ci-job-for-cookbook-version-increment-upload/4400/1 "2013-08-06T20:19:55Z")

</div>

Does anyone has such experience? Can you share it?

We’re already doing some syntax and foodcritic tests with Jenkins and  
looking forward to create auto-bump-and-upload job so it can do it on every  
git commit.

Thinking on doing ‘patch’ level version increment by default if there was  
no level bump in commit. Any better solutions? Any great tools to use(aka  
knife-spork)?

–  
Best regards,  
Koldaev Anton

---

<div class="post-metadata">

**Author:** ![Andrew\_Gross](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/andrew_gross/32/320_2.png) [@Andrew\_Gross](https://discourse.chef.io/u/Andrew_Gross)\
**Post date:** [August 6, 2013, 8:23pm UTC](https://discourse.chef.io/t/ci-job-for-cookbook-version-increment-upload/4400/2 "2013-08-06T20:23:35Z")

</div>

- knife-spork

We do patch by default for now, freeze cookbooks in production, unfrozen in  
staging. (AKA you cant push to prod unless you have bumped the version).

On Tue, Aug 6, 2013 at 4:19 PM, Anton Koldaev [koldaevav@gmail.com](mailto:koldaevav@gmail.com) wrote:

> Does anyone has such experience? Can you share it?
> 
> We're already doing some syntax and foodcritic tests with Jenkins and  
> looking forward to create auto-bump-and-upload job so it can do it on every  
> git commit.
> 
> Thinking on doing 'patch' level version increment by default if there was  
> no level bump in commit. Any better solutions? Any great tools to use(aka  
> knife-spork)?
> 
> --  
> Best regards,  
> Koldaev Anton

---

<div class="post-metadata">

**Author:** ![Anton\_Koldaev](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/anton_koldaev/32/91_2.png) [@Anton\_Koldaev](https://discourse.chef.io/u/Anton_Koldaev)\
**Post date:** [August 6, 2013, 8:26pm UTC](https://discourse.chef.io/t/ci-job-for-cookbook-version-increment-upload/4400/3 "2013-08-06T20:26:58Z")

</div>

Are you doing it manually or using CI job?

On Tue, Aug 6, 2013 at 1:23 PM, Andrew Gross [andrew@yipit.com](mailto:andrew@yipit.com) wrote:

> - knife-spork
> 
> We do patch by default for now, freeze cookbooks in production, unfrozen  
> in staging. (AKA you cant push to prod unless you have bumped the version).
> 
> On Tue, Aug 6, 2013 at 4:19 PM, Anton Koldaev [koldaevav@gmail.com](mailto:koldaevav@gmail.com) wrote:
> 
> > Does anyone has such experience? Can you share it?
> > 
> > We're already doing some syntax and foodcritic tests with Jenkins and  
> > looking forward to create auto-bump-and-upload job so it can do it on every  
> > git commit.
> > 
> > Thinking on doing 'patch' level version increment by default if there was  
> > no level bump in commit. Any better solutions? Any great tools to use(aka  
> > knife-spork)?
> > 
> > --  
> > Best regards,  
> > Koldaev Anton

--  
Best regards,  
Koldaev Anton

---

<div class="post-metadata">

**Author:** ![Andrew\_Gross](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/andrew_gross/32/320_2.png) [@Andrew\_Gross](https://discourse.chef.io/u/Andrew_Gross)\
**Post date:** [August 6, 2013, 8:33pm UTC](https://discourse.chef.io/t/ci-job-for-cookbook-version-increment-upload/4400/4 "2013-08-06T20:33:34Z")

</div>

Manually for now.

On Tue, Aug 6, 2013 at 4:26 PM, Anton Koldaev [koldaevav@gmail.com](mailto:koldaevav@gmail.com) wrote:

> Are you doing it manually or using CI job?
> 
> On Tue, Aug 6, 2013 at 1:23 PM, Andrew Gross [andrew@yipit.com](mailto:andrew@yipit.com) wrote:
> 
> > - knife-spork
> > 
> > We do patch by default for now, freeze cookbooks in production, unfrozen  
> > in staging. (AKA you cant push to prod unless you have bumped the version).
> > 
> > On Tue, Aug 6, 2013 at 4:19 PM, Anton Koldaev [koldaevav@gmail.com](mailto:koldaevav@gmail.com)wrote:
> > 
> > > Does anyone has such experience? Can you share it?
> > > 
> > > We're already doing some syntax and foodcritic tests with Jenkins and  
> > > looking forward to create auto-bump-and-upload job so it can do it on every  
> > > git commit.
> > > 
> > > Thinking on doing 'patch' level version increment by default if there  
> > > was no level bump in commit. Any better solutions? Any great tools to  
> > > use(aka knife-spork)?
> > > 
> > > --  
> > > Best regards,  
> > > Koldaev Anton
> 
> --  
> Best regards,  
> Koldaev Anton

---

<div class="post-metadata">

**Author:** ![Jesse\_Mauntel](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_mauntel/32/319_2.png) [@Jesse\_Mauntel](https://discourse.chef.io/u/Jesse_Mauntel)\
**Post date:** [August 7, 2013, 2:13am UTC](https://discourse.chef.io/t/ci-job-for-cookbook-version-increment-upload/4400/5 "2013-08-07T02:13:13Z")

</div>

We manually update the version number with every change to the cookbook. Then, we have a Jenkins job looking at each cookbook’s git repo and the build triggers on any change to the repo. In each job we run the following:

- clone repo
- bundle install
- foodcritic linting
- custom linting (that we haven’t yet migrated to foodcritic)
- kitchen destroy
- kitchen test
- grep the version number from the metadata file and store it in a variable
- using the version variable, check and see if there is an existing git tag with the same name, if not, git tag and git push, then upload the cookbook to the chef server via berks upload

The nice thing is that any fail along the way prevents an upload to the chef server.

It’s working out quite nicely for us.

On Aug 6, 2013, at 13:34, “Andrew Gross” \<[andrew@yipit.com](mailto:andrew@yipit.com)[mailto:andrew@yipit.com](mailto:andrew@yipit.com)\> wrote:

Manually for now.

On Tue, Aug 6, 2013 at 4:26 PM, Anton Koldaev \<[koldaevav@gmail.com](mailto:koldaevav@gmail.com)[mailto:koldaevav@gmail.com](mailto:koldaevav@gmail.com)\> wrote:  
Are you doing it manually or using CI job?

On Tue, Aug 6, 2013 at 1:23 PM, Andrew Gross \<[andrew@yipit.com](mailto:andrew@yipit.com)[mailto:andrew@yipit.com](mailto:andrew@yipit.com)\> wrote:

- knife-spork

We do patch by default for now, freeze cookbooks in production, unfrozen in staging. (AKA you cant push to prod unless you have bumped the version).

On Tue, Aug 6, 2013 at 4:19 PM, Anton Koldaev \<[koldaevav@gmail.com](mailto:koldaevav@gmail.com)[mailto:koldaevav@gmail.com](mailto:koldaevav@gmail.com)\> wrote:  
Does anyone has such experience? Can you share it?

We’re already doing some syntax and foodcritic tests with Jenkins and looking forward to create auto-bump-and-upload job so it can do it on every git commit.

Thinking on doing ‘patch’ level version increment by default if there was no level bump in commit. Any better solutions? Any great tools to use(aka knife-spork)?

–  
Best regards,  
Koldaev Anton

–  
Best regards,  
Koldaev Anton

---

<div class="post-metadata">

**Author:** ![David\_Petzel](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/david_petzel/32/38_2.png) [@David\_Petzel](https://discourse.chef.io/u/David_Petzel)\
**Post date:** [August 7, 2013, 2:47am UTC](https://discourse.chef.io/t/ci-job-for-cookbook-version-increment-upload/4400/6 "2013-08-07T02:47:06Z")

</div>

We do something very similar. We so far have opted for the manual version  
bump, but CI reads the version and does all the tagging and auto-uploading  
magic.

For us, we've discussed the auto version bump vs manual bump many times and  
I'd say we are still undecided on what is best. At the end of the day the  
main reason that we currently do the version bump manually rather than  
letting CI do it all stems around CHANGELOG.md. We wanted to have clear and  
concise change log entries and not simply depend on a dump of commit  
messages. Consumers of our cookbooks have a very wide range of experience  
with both Chef and Ruby, so we try to include a large amount of information  
in the change log entry (IE the GitHub issue the release is addressing,  
what the change is doing, and any gotchas you need to look out for)

If we had a solution for keeping CHANGELOG entries in sync with  
automatically generated versions we would probably move to the auto  
increment model as well

On Tue, Aug 6, 2013 at 10:13 PM, Jesse Mauntel [jmauntel@24hourfit.com](mailto:jmauntel@24hourfit.com)wrote:

> We manually update the version number with every change to the cookbook.  
> Then, we have a Jenkins job looking at each cookbook's git repo and the  
> build triggers on any change to the repo. In each job we run the following:
> 
> - clone repo
> - bundle install
> - foodcritic linting
> - custom linting (that we haven't yet migrated to foodcritic)
> - kitchen destroy
> - kitchen test
> - grep the version number from the metadata file and store it in a variable
> - using the version variable, check and see if there is an existing git  
> tag with the same name, if not, git tag and git push, then upload the  
> cookbook to the chef server via berks upload
> 
> The nice thing is that any fail along the way prevents an upload to the  
> chef server.
> 
> It's working out quite nicely for us.
