Compare commits

...

5 Commits

Author SHA1 Message Date
cclecle
0d1e981b6b beautify jenkins file 2023-03-28 01:01:10 +01:00
cclecle
b01779dd06 add missing parentheses 2023-03-28 00:50:43 +01:00
cclecle
f7ec5d98a7 fix changelog multiline 2023-03-28 00:45:48 +01:00
cclecle
82d4b1bd70 fix: remove useless printf in getMessagesSinceTag() 2023-03-28 00:45:00 +01:00
cclecle
880fa29bbd try to get changelog before tag creation 2023-03-28 00:35:00 +01:00
2 changed files with 28 additions and 12 deletions

38
Jenkinsfile vendored
View File

@@ -148,6 +148,7 @@ pipeline {
PY_PROJECT_NAME = "__NOTSET__"
PY_PROJECT_VERSION = "__NOTSET__"
PY_PROJECT_VERSION_STRIPPED = "__NOTSET__"
CHANGELOG = "__NOTSET__"
}
stages {
@@ -215,6 +216,32 @@ pipeline {
withCredentials([usernamePassword(credentialsId: _SCMCredentials, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh("git remote set-url origin https://${GIT_USERNAME}:${GIT_PASSWORD}@chacha.ddns.net/gitea/${_PROJECT_USER_NAME}/${_PROJECT_NAME}.git")
}
CHANGELOG = sh(script: """#!/bin/sh -
|. ~/TOOLS_ENV/bin/activate
|exec python - << '__EOWRAPPER__'
|
|import re
|
|try:
| from pychangelogfactory import ChangelogFactory
|except ImportError:
| from src.pychangelogfactory import ChangelogFactory
|
|try:
| from pygitversionhelper import gitversionhelper
|except ImportError:
| from src.pygitversionhelper import gitversionhelper
|
|
|LastTag=gitversionhelper.tag.getLastTag(same_branch=True)
|CommitHistory=gitversionhelper.commit.getMessagesSinceTag(LastTag, merged_output=True, ignore_merged=True)
|Changelog = ChangelogFactory(CommitHistory).RenderFullChangelog(include_unknown=True)
|print(Changelog.replace("\\n","\\n\\n"))
|
|__EOWRAPPER__
""".stripMargin(),
returnStdout: true).trim()
if(_GIT_BRANCH=="master") {
if(sh(returnStdout: true, script: "git tag --points-at HEAD").trim().isEmpty()) {
@@ -571,10 +598,6 @@ pipeline {
|from simple_rest_client.api import API
|from simple_rest_client.resource import Resource
|
|try:
| from pychangelogfactory import ChangelogFactory
|except ImportError:
| from src.pychangelogfactory import ChangelogFactory
|
|try:
| from pygitversionhelper import gitversionhelper
@@ -623,12 +646,7 @@ pipeline {
| + "\\n" \\
| + "Reference documentation: [mkdocs page](https://chacha.ddns.net/mkdocs-web/${_PROJECT_USER_NAME}/${PY_PROJECT_NAME}/${_GIT_BRANCH}/${PY_PROJECT_VERSION_STRIPPED}/) "
|
|LastTag=gitversionhelper.tag.getLastTag(same_branch=True)
|print(f"LastTag= {LastTag}")
|CommitHistory=gitversionhelper.commit.getMessagesSinceTag(LastTag, merged_output=True, ignore_merged=True)
|print(f"CommitHistory= {CommitHistory}")
|Changelog = ChangelogFactory(CommitHistory).RenderFullChangelog(include_unknown=True)
|print(f"Changelog= {Changelog}")
|Changelog='''${CHANGELOG}'''
|
|ReleaseContent = ReleaseContent + "\\n"+ "\\n"+ "## Changelog:\\n" + Changelog
|

View File

@@ -163,9 +163,7 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
the commit message
"""
current_commit_id = cls.getLast(**kwargs)
print(f"current_commit_id = {current_commit_id}")
tag_commit_id = cls.getFromTag(tag)
print(f"tag_commit_id = {tag_commit_id}")
str_cmd: str
if ("same_branch" in kwargs) and (kwargs["same_branch"] is True):