[MDSAL-489] Pull version for docs from git tag Created: 04/Nov/19 Updated: 12/Nov/19 Resolved: 12/Nov/19 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 4.0.8, 3.0.13, 5.0.5 |
| Type: | Story | Priority: | Medium |
| Reporter: | Thanh Ha (zxiiro) | Assignee: | Thanh Ha (zxiiro) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Rather than waste time remembering to bump versions for docs in the docs directory. We should pull that information automatically from git tags. This has been done before in LF tooling projects so we can port that into MD-SAL. # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. command = 'git describe --tags --long --dirty' try: git_version = format_version( subprocess.check_output(command.split()).decode('utf-8').strip()) except subprocess.CalledProcessError: # Handle docs builds from tarball git_version = "v0.0.9999-local" version = git_version # The full version, including alpha/beta/rc tags. release = version Source: https://github.com/lfit/releng-global-jjb/blob/master/docs/conf.py#L80-L93 |
| Comments |
| Comment by Thanh Ha (zxiiro) [ 04/Nov/19 ] |
|
Looks like using `git describe` does not work for us because our tags are not reachable from the master branch due to them being on forked branches. Unfortunately this prevents us from using the same solution as LF uses in global-jjb Moving this back to backlog as it's a good idea but we'd need to find an alternative way to do it. In the meantime I'll push patches to bump maintainenace branch versions at least. |
| Comment by Thanh Ha (zxiiro) [ 04/Nov/19 ] |
|
Decided to try parsing the version from pom.xml and it seems to work with this code. import xml.etree.ElementTree as ET
data = ET.parse('pom.xml')
mdsal_version = data.getroot().find('*//{http://maven.apache.org/POM/4.0.0}version').text
version = mdsal_version
release = mdsal_version
|