Compare commits

...

11 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
cclecle
7347106694 test printing changelog parts 2023-03-28 00:21:37 +01:00
cclecle
e1c1e643c3 include others changes in changelog 2023-03-28 00:08:18 +01:00
cclecle
a5f39d6cb2 update changelog 2023-03-28 00:04:31 +01:00
cclecle
c6ed7ef0a1 fix wrong typo in jenkinsfile 2023-03-27 23:48:18 +01:00
cclecle
0ef5a8f463 feature: add changelog ! 2023-03-27 23:46:34 +01:00
cclecle
e06a3b00ae fix wrong getMessagesSinceTag() command 2023-03-27 23:27:21 +01:00
3 changed files with 40 additions and 10 deletions

43
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 {
@@ -184,16 +185,14 @@ pipeline {
sh(". ~/BUILD_ENV/bin/activate && pip install --upgrade setuptools build pip copier jinja2-slug toml")
sh(". ~/TOOLS_ENV/bin/activate && pip install simple_rest_client requests twine")
sh(". ~/TOOLS_ENV/bin/activate && pip install simple_rest_client requests twine packaging")
script {
if(_PROJECT_NAME!="pygitversionhelper") {
sh(". ~/TOOLS_ENV/bin/activate && pip install pygitversionhelper")
}
else
{
//TODO: need to install pygitversionhelper deps from a better way...
sh(". ~/TOOLS_ENV/bin/activate && pip install packaging")
if(_PROJECT_NAME!="pychangelogfactory") {
sh(". ~/TOOLS_ENV/bin/activate && pip install pychangelogfactory")
}
}
sh("git config --global user.email $_MaintainerEmail")
@@ -217,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()) {
@@ -573,6 +598,7 @@ pipeline {
|from simple_rest_client.api import API
|from simple_rest_client.resource import Resource
|
|
|try:
| from pygitversionhelper import gitversionhelper
|except ImportError:
@@ -619,6 +645,13 @@ pipeline {
|ReleaseContent = "${_ReleaseContent_Title}" + "\\n" \\
| + "\\n" \\
| + "Reference documentation: [mkdocs page](https://chacha.ddns.net/mkdocs-web/${_PROJECT_USER_NAME}/${PY_PROJECT_NAME}/${_GIT_BRANCH}/${PY_PROJECT_VERSION_STRIPPED}/) "
|
|Changelog='''${CHANGELOG}'''
|
|ReleaseContent = ReleaseContent + "\\n"+ "\\n"+ "## Changelog:\\n" + Changelog
|
|if not Changelog:
| ReleaseContent = ReleaseContent + "code/project maintainance"
|
|data={
| "body": ReleaseContent,

View File

@@ -19,7 +19,6 @@ from radon.cli import Config
from radon.cli.harvest import CCHarvester, HCHarvester, MIHarvester
from .helper_base import helper_withresults_base
from pprint import pprint
class complexity_check(helper_withresults_base):

View File

@@ -163,15 +163,13 @@ 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):
str_cmd = f"git rev-list --first-parent --ancestry-path {tag_commit_id}..{current_commit_id}"
str_cmd = f"git rev-list --first-parent {tag_commit_id}..{current_commit_id}" # ok
else:
str_cmd = f"git rev-list --ancestry-path {tag_commit_id}..{current_commit_id}"
str_cmd = f"git rev-list {tag_commit_id}..{current_commit_id}" # ok
if ("ignore_merged" in kwargs) and (kwargs["ignore_merged"] is True):
str_cmd = str_cmd + " --no-merges" # ok