Sign inSign up

koscicz/release-bot

By koscicz

•Updated over 8 years ago

Automated releasing from GitHub repositories

Image
0

100K+

koscicz/release-bot repository overview

⁠Release bot Build Status PyPI version

This is a bot that helps maintainers deliver their software to users. It is meant to watch github repositories for release pull requests. The PR must be named in this format 0.1.0 release. No other format is supported yet. Once this PR is closed (and merged) bot will create a new github release. Changelog will be pulled from root of the repository and must be named CHANGELOG.md. Changelog for the new version must begin with version heading, i.e # 0.1.0 . Everything between this heading and the heading for previous version will be pulled into the changelog.

A release-conf.yaml file is required. See Configuration⁠ section for details.

Once a release is complete, bot will upload this release to PyPi. Note that you have to setup your login details (see Requirements⁠).

After PyPi release, if enabled in release-conf.yaml, bot will try to release on Fedora dist-git, on master branch and branches specified in configuration. It should not create merge conflicts, but in case it does, you have to solve them first before attempting the release again.

⁠Configuration

Configuration is in a form of a yaml file. You can specify your config using -c file.yaml or --configuration file.yaml. If you do not specify it using an argument, bot will try to find conf.yaml in current working directory. Here are the configuration options:

OptionMeaningRequired
repository_nameName of your Github repositoryYes
repository_ownerOwner of the repositoryYes
github_tokenGithub personal access token⁠Yes
fas_usernameFAS⁠ username. Only need for releasing on FedoraNo
refresh_intervalTime in seconds between checks on repository. Default is 180No

Sample config can be found in this repository.

Best option for this is creating a github account for this bot so you can keep track of what changes were made by bot and what are your own.

You also have to have a release-conf.yaml file in the root of your project repository. Here are the possible options:

OptionMeaningRequired
python_versionsList of major python versions that bot will build separate wheels forYes
changelogList of changelog entries. If empty, changelog defaults to $version releaseNo
author_nameAuthor name for changelog. If not set, author of the merge commit is usedNo
author_emailAuthor email for changelog. If not set, author of the merge commit is usedNo
fedoraWhether to release on fedora. False by defaultNo
fedora_branchesList of branches that you want to release on. Master is always impliedNo

Sample config named release-conf-example.yaml⁠ can be found in this repository.

⁠Requirements

Releasing to PyPi requires to have wheel package both for python 2 and python 3, therefore please install requirements.txt with both versions of pip. You also have to setup your PyPi login details in $HOME/.pypirc as described in PyPi documentation⁠ If you are releasing to Fedora, you will need to have an active kerberos ticket while the bot runs. Also, fedpkg requires that you have ssh key in your keyring, that you uploaded to FAS.

⁠Docker image

To make it easier to run this, release-bot is available as an source-to-image⁠ builder image. You need to setup a git repository, where you'll store the conf.yaml and .pypirc files. If you are releasing on Fedora, you will also need to add id_rsa (a private ssh key that you configured in FAS) and fedora.keytab (kerberos keytab for fedora). If this is not a local repository, make sure it it's private so you prevent any private info leaking out. You can then create the final image like this:

$ s2i build $SECRET_REPOSITORY_URL koscicz/release-bot app-name

⁠OpenShift template

You can also run this bot in OpenShift using openshift-template.yml⁠ in this repository. You must set two environment variables, the $APP_NAME is the name of your release-bot deployment, and $SOURCE_REPOSITORY which contains configuration for the release-bot. The contents of the repository are described above⁠. Note that if you use private repository (which you absolutely should), you will need to set up a new OpenShift secret⁠ named release-bot-secret to authenticate. It can be a ssh private key that you can use to access the repository (for GitHub see deploy keys⁠). Here's an guide⁠ on how to do that in OpenShift GUI, or another guide⁠ that uses oc commandline tool.

By default, the release-bot builder image won't update itself when a new version of this image is pushed to docker hub. You can change it by uncommenting lines with #importPolicy: and #scheduled: true in openshift-template.yml⁠. Then the image will be pulled on a new release.

Tag summary

Content type

Image

Digest

Size

293.2 MB

Last updated

over 8 years ago

docker pull koscicz/release-bot