1

An independent Jenkins server monitors my develop branch in Team Foundation Server's Git repository and builds a new package when it's updated. The problem I'm having is that it uses the same version, specified in setup.py. I could configure pypi-server to allow overwrites, but prefer to maintain build history.

Theoretically, there could be a build step that checks the version and increments it, but I'm hoping that someone has already done this work and published it somewhere.

Has anyone seen something like this?

1
  • could you please clarify if your code is hosted on gitlab, github, bitbucket or something else? This may help to narrow the relevant answers. Aug 26 '20 at 20:20
1

If you follow Semantic Versioning you could achieve this as a step in the pipeline using Semantic Release.

This and the original tool it's based on are designed for automated releases as part of a continuous integration and delivery pipeline. From the docs:

The key point with using this package is to automate your releases and stop worrying about version numbers. Different approaches to automatic releases and publishing with the help of this package can be found below. Using a CI is the recommended approach.

In your case the workflow would be to do all the testing in pull request, and then when they are merged, a step in the develop branch would run semantic-release publish. Again, referencing the docs, this does the following actions:

Publish will do a sequence of things:

  • Run semantic-release version.
  • Push changes to git.
  • Run build_command and upload the created files to PyPI.
  • Run semantic-release changelog and post to your vcs provider.
  • Attach the files created by build_command to GitHub releases.

Part of the benefit of having this included in the pipeline is maintaining a clear and consistent changelog, with the help of a commit message linter like committizen.

1
  • Thank you. I'll give this a spin and respond when I see how suitable it is. Aug 28 '20 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.