mongrelion / ansible-role-docker

Ansible role for installing Docker
MIT License
62 stars 39 forks source link

Auto-release? #34

Closed paulfantom closed 6 years ago

paulfantom commented 6 years ago

I can provide a script to be included in travis CI pipeline which can automatically set new tags following semantic versioning. It runs only on master branch and by default it adds 1 to PATCH part of varsion tag when something new is pushed. It also can add 1 to MAJOR part when it detects special message in the last commit. This is how it looks: https://github.com/cloudalchemy/ansible-prometheus/blob/master/.travis/generatetag.sh

mongrelion commented 6 years ago

I like the idea of auto releases but auto-tagging from a machine is not my cup of tea. I wouldn't oppose to releasing using the hash of the last commit but for the semver I would like to keep it human with its proper git tag alongside an update to a CHANGELOG.md file.

paulfantom commented 6 years ago

Using hash is already an option for downloading role via ansible-galaxy. Docs: https://docs.ansible.com/ansible/latest/galaxy.html#version

I have couple of ideas on how to integrate auto-tagging with changelog, but all of them assume using annotated tags instead of changelog file: 1) do not use changelog for PATCH versions, and convert MINOR and MAJOR versions from tag to full release (it is quite easy in github) 2) automatically generate changelog based on last commits

Right now I don't have any easy way to automatically create meaningful changelog file.

mongrelion commented 6 years ago

Oh, I sorry, I don't think I explained myself properly. I didn't mean to automate the generation of the changelog file. Rather, as with the versioning of the project, we should do this manually. I like the format that sidekiq has: https://github.com/mperham/sidekiq/blob/master/Changes.md

paulfantom commented 6 years ago

That's generally a good idea and I haven't seen a proper changelog in any ansible role repository (I also don't do it :smile:). If I am correct, sidekiq approach is to add a short description of a PR to CHANGELOG by a person who writes a PR. It works in medium and large projects but I am afraid that it won't work in a small project like this one. Then there is a question will you commit to manually writing changelog and releasing versions? Or do you want such issues: https://github.com/antoiner77/caddy-ansible/issues/71 :smile:?

From my experience in using ansible roles it is generally better to have more releases than fewer. Also when writing ansible roles, basically every PR is a feature or a bugfix, so according to semver it should have it's own release, hence my idea of automating it and releasing after merging PR to master.

mongrelion commented 6 years ago

Haha, definitely not to fall into an issue like that one. I am willing to maintain the CHANGELOG, for sure. I think that having a frequent version release cycle (independent of the automatic release from merging PRs) is a good habit to have, specially since we can define and tell the community what we believe is a "stable" release, which can't be defined normally with automation. Ideally these releases (semver ones), match milestones from a roadmap that we can start ticking off as we go.

paulfantom commented 6 years ago

Ok, my thoughts:

What do you think about it?

paulfantom commented 6 years ago

I found a fancy tool to automatically generate changelogs based on commit messages: https://github.com/resin-io/versionist

paulfantom commented 6 years ago

I found a nice convention for changelogs: https://conventionalcommits.org

And a nice tool for automatic changelog generation: https://github.com/skywinder/github-changelog-generator

paulfantom commented 6 years ago

My whole day I was doing research on changelogs. As a result I came up with this script: https://github.com/cloudalchemy/ansible-prometheus/blob/master/.travis/auto.sh Basically it has two features:

1) Create a new release with semver in mind, but only when requested. More here: https://github.com/cloudalchemy/ansible-prometheus/blob/master/CONTRIBUTING.md#releases

2) Automatically generate changelog file on every PR merged to master. This is based on github issues, PRs and labels. More here: https://github.com/skywinder/github-changelog-generator

Example usage in ansible repo is here: https://github.com/cloudalchemy/ansible-prometheus. Keep in mind that changelog from taht repo might appear strange, that's because there was an auto-releaser applied (tag on every PR).

@mongrelion what do you think about such approach?

mongrelion commented 6 years ago

Sounds good to me. Do we need to have a properly defined tagging system for this to work?

paulfantom commented 6 years ago

We would probably need to drop v prefix. But we can first try with it and see what happens :smile:

mongrelion commented 6 years ago

Dropping the v shouldn't be a problem.

paulfantom commented 6 years ago

Ok, so I will implement it here soon.

paulfantom commented 6 years ago

Seems like it will need to wait a little since I found a bug in changelog generator (https://github.com/skywinder/github-changelog-generator/issues/642).