Merged in bugfix/generate-changelog-on-version-bump (pull request #21)
bugfix: actualizo changelog en bump de version via pipeline
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
.repository-token
|
||||
|
||||
**/__pycache__/
|
||||
build/
|
||||
**/*.egg-info/
|
||||
|
||||
+10
-264
@@ -1,273 +1,19 @@
|
||||
## Jueves, 6 de Noviembre de 2025, 21:18
|
||||
## Viernes, 7 de Noviembre de 2025, 11:42
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `bugfix/remove-branch-from-last-env-tag`
|
||||
- Autor: [Jonathan Teran](mailto:jteran@renatre.org.ar)
|
||||
- Rama: `bugfix/generate-changelog-on-version-bump`
|
||||
|
||||
### Commits
|
||||
|
||||
- **bugfix**: elimino nombre de rama de tag en el ultimo environment (e9b44eb)
|
||||
- **bugfix**: muevo generacion de CHANGELOG.md a comando tag (4bccd20)
|
||||
- src/git_flow/git.py (M)
|
||||
- src/git_flow/main.py (M)
|
||||
|
||||
---
|
||||
|
||||
## Martes, 4 de Noviembre de 2025, 21:11
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `refactor/remove-dev-branch`
|
||||
|
||||
### Commits
|
||||
|
||||
- **refactor**: elimino rama dev de lista de branches de git-flow (794fc6a)
|
||||
- .flowconfig (M)
|
||||
|
||||
---
|
||||
|
||||
## Martes, 4 de Noviembre de 2025, 20:59
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `bugfix/pipeline-run-tag`
|
||||
|
||||
### Commits
|
||||
|
||||
- **bugfix**: cambio script de build para ejecutar git-flow tag (34b07ab)
|
||||
- **refactor**: elimino seccion dev de bitbucket-pipelines.yml (71a5643)
|
||||
- bitbucket-pipelines.yml (M)
|
||||
- pyproject.toml (M)
|
||||
|
||||
---
|
||||
|
||||
## Lunes, 3 de Noviembre de 2025, 21:54
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `refactor/build-system`
|
||||
|
||||
### Commits
|
||||
|
||||
- **bugfix**: arreglo ejecucion de tag mediante pipeline (96c787b)
|
||||
- bitbucket-pipelines.yml (M)
|
||||
- src/git_flow/main.py (M)
|
||||
- **refactor**: cambio estructura de proyecto siguiendo guidelines de python (9e1c710)
|
||||
- git-flow (D)
|
||||
- lib/__init__.py (D)
|
||||
- lib/git.py (D)
|
||||
- lib/io.py (D)
|
||||
- pyproject.toml (A)
|
||||
- pyrightconfig.json (D)
|
||||
- requirements.txt (D)
|
||||
- src/git_flow/__init__.py (A)
|
||||
- src/git_flow/git.py (A)
|
||||
- src/git_flow/io.py (A)
|
||||
- src/git_flow/main.py (A)
|
||||
|
||||
---
|
||||
|
||||
## Lunes, 3 de Noviembre de 2025, 08:28
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `feature/release-command`
|
||||
|
||||
### Commits
|
||||
|
||||
- **bugfix**: elimino debug print y return en merge_command (cc66c5b)
|
||||
- git-flow (M)
|
||||
- **bugfix**: uso distintos target branches para obtener env y type de ramas dev y release (b8ef0b9)
|
||||
- git-flow (M)
|
||||
- **docs**: actualizo texto de ayuda de help_command (8bb0965)
|
||||
- git-flow (M)
|
||||
- **feature**: agrego comando release (1bdac67)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Domingo, 2 de Noviembre de 2025, 17:37
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `feature/release-command`
|
||||
|
||||
### Commits
|
||||
|
||||
- **docs**: actualizo texto de ayuda de help_command (8bb0965)
|
||||
- git-flow (M)
|
||||
- **feature**: agrego comando release (1bdac67)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Domingo, 2 de Noviembre de 2025, 15:47
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `feature/add-release-tag-support`
|
||||
|
||||
### Commits
|
||||
|
||||
- **feature**: agrego soporte para tag de merge de ramas release (d74bafe)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Domingo, 2 de Noviembre de 2025, 15:32
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `bugfix/set-locale-error`
|
||||
|
||||
### Commits
|
||||
|
||||
- **bugfix**: agrego try except al setlocale para capturar errores en pipeline (f45d313)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Domingo, 2 de Noviembre de 2025, 14:00
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `docs/change-changelog-format`
|
||||
|
||||
### Commits
|
||||
|
||||
- **bugfix**: arreglo concatenacion de lineas de changelog (8f30dc6)
|
||||
- git-flow (M)
|
||||
- **docs**: agrego link a respuesta de PR creado (2bf8dbc)
|
||||
- git-flow (M)
|
||||
- **docs**: cambio descripcion de PR para que solo contenga los commits (1de6a64)
|
||||
- git-flow (M)
|
||||
- lib/io.py (M)
|
||||
- **docs**: cambio header de changelog, arreglo generacion de descripcion de Prs (eba73fe)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
- **docs**: agrego link a respuesta de PR creado (2bf8dbc)
|
||||
- git-flow (M)
|
||||
- **docs**: cambio descripcion de PR para que solo contenga los commits (1de6a64)
|
||||
- git-flow (M)
|
||||
- lib/io.py (M)
|
||||
- **docs**: cambio header de changelog, arreglo generacion de descripcion de Prs (eba73fe)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
- **docs**: cambio descripcion de PR para que solo contenga los commits (1de6a64)
|
||||
- git-flow (M)
|
||||
- lib/io.py (M)
|
||||
- **docs**: cambio header de changelog, arreglo generacion de descripcion de Prs (eba73fe)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Domingo, 2 de Noviembre de 2025, 13:47
|
||||
|
||||
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
|
||||
- Rama: `docs/change-changelog-format`
|
||||
### Commits
|
||||
- **docs**: cambio header de changelog, arreglo generacion de descripcion de Prs (eba73fe)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Domingo, 2 de Noviembre de 2025, 13:40
|
||||
|
||||
### Autor
|
||||
|
||||
- Usuario: **Jonathan Teran Carballo**
|
||||
- Email: **jonathan.nerat@gmail.com**
|
||||
|
||||
### Commits
|
||||
|
||||
Rama: **docs/change-changelog-format**
|
||||
|
||||
- **docs**: agrego secciones de autor y commits, cambio formato de timestamp (35f9b18)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Domingo, 2 De Noviembre De 2025, 13:36:22
|
||||
|
||||
- Usuario: **Jonathan Teran Carballo**
|
||||
- Email: **jonathan.nerat@gmail.com**
|
||||
- Rama: **docs/change-changelog-format**
|
||||
|
||||
- **docs**: agrego setteo de locale, muevo usuario y mail a contenido de seccion de CHANGELOG.md (143c704)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Jonathan Teran Carballo (jonathan.nerat@gmail.com) - 02/11/2025 13:19
|
||||
|
||||
**refactor/remove-unused-git-functions**
|
||||
- **refactor**: elimino funciones no usadas de modulo git (76c7b35)
|
||||
- lib/git.py (M)
|
||||
|
||||
---
|
||||
|
||||
## Jonathan Teran Carballo (jonathan.nerat@gmail.com) - 02/11/2025 12:47
|
||||
|
||||
**bugfix/tag-command-checks**
|
||||
- **bugfix**: cambio la imagen de default a python:3.12 (b1aecf4)
|
||||
- bitbucket-pipelines.yml (M)
|
||||
|
||||
---
|
||||
|
||||
## Jonathan Teran Carballo (jonathan.nerat@gmail.com) - 02/11/2025 12:40
|
||||
|
||||
**bugfix/tag-command-checks**
|
||||
- **bugfix**: cambio llamada a pip en pipeline (7330024)
|
||||
- bitbucket-pipelines.yml (M)
|
||||
|
||||
---
|
||||
|
||||
## Jonathan Teran Carballo (jonathan.nerat@gmail.com) - 02/11/2025 12:34
|
||||
|
||||
**bugfix/tag-command-checks**
|
||||
- **bugfix**: cambio imagen de python a la default de atlassian (ee8eb17)
|
||||
- bitbucket-pipelines.yml (M)
|
||||
- **bugfix**: deshabilito los checks para la ejecucion de commandos para obtener tags (83c1ebc)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Jonathan Teran Carballo (jonathan.nerat@gmail.com) - 02/11/2025 12:26
|
||||
|
||||
**feature/agregar-bitbucket-pipelines.yml**
|
||||
- **bugfix**: modifico shebang para buscar python3 con env (c07fdb9)
|
||||
- git-flow (M)
|
||||
|
||||
---
|
||||
|
||||
## Jonathan Teran Carballo (jonathan.nerat@gmail.com) - 02/11/2025 12:23
|
||||
|
||||
**feature/agregar-bitbucket-pipelines.yml**
|
||||
- **feature**: agrego bitbucket-pipelines.yml y requirements.txt (2afa845)
|
||||
- bitbucket-pipelines.yml (A)
|
||||
- requirements.txt (A)
|
||||
|
||||
---
|
||||
|
||||
## Jonathan Teran Carballo (jonathan.nerat@gmail.com) - 02/11/2025 12:13
|
||||
|
||||
**refactor/git-commands-lib**
|
||||
- **bugfix**: detectar host ficticion de bitbucket (6264062)
|
||||
- git-flow (M)
|
||||
- **refactor**: clase Git para ejecutar comandos (89eb969)
|
||||
- .gitignore (A)
|
||||
- README.md (A)
|
||||
- git-flow (A)
|
||||
- lib/__init__.py (A)
|
||||
- lib/git.py (A)
|
||||
- lib/io.py (A)
|
||||
- pyrightconfig.json (A)
|
||||
|
||||
---
|
||||
|
||||
## Jonathan Teran Carballo (jonathan.nerat@gmail.com) - 02/11/2025 12:10
|
||||
|
||||
**refactor/git-commands-lib**
|
||||
- **refactor**: clase Git para ejecutar comandos (89eb969)
|
||||
- .gitignore (A)
|
||||
- README.md (A)
|
||||
- git-flow (A)
|
||||
- lib/__init__.py (A)
|
||||
- lib/git.py (A)
|
||||
- lib/io.py (A)
|
||||
- pyrightconfig.json (A)
|
||||
- **docs**: elimino CHANGELOG.md (17eb6c2)
|
||||
- CHANGELOG.md (D)
|
||||
- **ignore**: ignoro archivos de build (90b420f)
|
||||
- .gitignore (M)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -2,16 +2,6 @@ image: python:3.12
|
||||
|
||||
pipelines:
|
||||
branches:
|
||||
'dev':
|
||||
- step:
|
||||
name: "Tag dev"
|
||||
caches:
|
||||
- pip
|
||||
script:
|
||||
- cd $BITBUCKET_CLONE_DIR
|
||||
- pip install --upgrade pip
|
||||
- pip install .
|
||||
- git-flow tag $BEARER
|
||||
'main':
|
||||
- step:
|
||||
name: "Tag main"
|
||||
|
||||
+18
-5
@@ -17,7 +17,7 @@ class Status:
|
||||
class Git:
|
||||
FLOWCONFIG_FILE = ".flowconfig"
|
||||
CHANGELOG_FILE = "CHANGELOG.md"
|
||||
UPDATED_CHANGELOG_MSG = "Updated " + CHANGELOG_FILE
|
||||
BUMP_VERSION = "chore: bump version and update CHANGELOG.md [skip ci]"
|
||||
|
||||
command: list[str]
|
||||
check_returncode: bool = True
|
||||
@@ -38,15 +38,28 @@ class Git:
|
||||
def status():
|
||||
return list(map(Status, Git("status", porcelain=True).lines(False)))
|
||||
|
||||
@staticmethod
|
||||
def get_current_tag():
|
||||
return Git("describe", abbrev="0", tags=True).without_checking().firstline()
|
||||
|
||||
@staticmethod
|
||||
def get_first_fork_point(branch: str, env: str):
|
||||
boundary_commits = list(filter(
|
||||
lambda c: c.startswith("-"), # boundary commits
|
||||
Git("rev-list", env + "..." + branch, topo_order=True, boundary=True).lines()
|
||||
))
|
||||
|
||||
if not boundary_commits:
|
||||
raise RuntimeError("No se encontro un commit base para realizar el rebase.")
|
||||
|
||||
return boundary_commits[-1].removeprefix("-")
|
||||
|
||||
@staticmethod
|
||||
def _get_references(kind: str):
|
||||
prefix = "refs/" + kind + "/"
|
||||
return map(
|
||||
lambda r: r.removeprefix(prefix),
|
||||
filter(
|
||||
lambda l: l.startswith(prefix),
|
||||
Git("for-each-ref", format="%(refname)").lines(),
|
||||
),
|
||||
Git("for-each-ref", prefix + "*", format="%(refname)").lines(),
|
||||
)
|
||||
|
||||
def __init__(self, subcommand: str, *args: str, **kwargs: str | int | bool) -> None:
|
||||
|
||||
+15
-25
@@ -269,10 +269,6 @@ def merge_command():
|
||||
"y ejecutar nuevamente este comando.")
|
||||
return
|
||||
|
||||
if update_changelog(branch, target):
|
||||
Git("add", Git.CHANGELOG_FILE).exec()
|
||||
Git("commit", message=Git.UPDATED_CHANGELOG_MSG).exec()
|
||||
|
||||
if remote:
|
||||
Git("push", remote, branch, set_upstream=True).exec()
|
||||
url = Git("remote", "get-url", remote).firstline()
|
||||
@@ -379,8 +375,7 @@ def tag_command():
|
||||
|
||||
remote = Git.flow_config("flow.remote").firstline()
|
||||
branch = Git.get_current_branch()
|
||||
output = Git("describe", abbrev="0", tags=True).without_checking().firstline()
|
||||
last_version = output if output else "v1.0.0"
|
||||
last_version = Git.get_current_tag() or "v1.0.0"
|
||||
from_major = 1
|
||||
until_dash = last_version.index("-") if "-" in last_version else None
|
||||
[major, minor, patch] = map(int, last_version[from_major:until_dash].split("."))
|
||||
@@ -408,6 +403,11 @@ def tag_command():
|
||||
if url:
|
||||
[service, repository] = parse_url(url)
|
||||
create_tag(service, repository, token, new_version, commit)
|
||||
|
||||
if update_changelog(merged_branch, branch):
|
||||
Git("add", Git.CHANGELOG_FILE).exec()
|
||||
Git("commit", message=Git.UPDATED_CHANGELOG_MSG).exec()
|
||||
Git("push").exec()
|
||||
else:
|
||||
Git("tag", new_version, commit).exec()
|
||||
|
||||
@@ -422,16 +422,8 @@ def release_command():
|
||||
if env == env_branches[-1]:
|
||||
raise RuntimeError("No se puede hacer release de una rama en el ultimo entorno.")
|
||||
|
||||
base = Git.get_first_fork_point(branch, env)
|
||||
next_env = env_branches[env_branches.index(env) + 1]
|
||||
boundary_commits = list(filter(
|
||||
lambda c: c.startswith("-"), # boundary commits
|
||||
Git("rev-list", env + "..." + branch, topo_order=True, boundary=True).lines()
|
||||
))
|
||||
|
||||
if not boundary_commits:
|
||||
raise RuntimeError("No se encontro un commit base para realizar el rebase.")
|
||||
|
||||
base = boundary_commits[-1].removeprefix("-")
|
||||
next_branch = branch.replace(f"/{env}/", f"/{next_env}/") if branch.startswith("release/") else f"release/{next_env}/{branch}"
|
||||
|
||||
Git("switch", next_branch, create=True).exec()
|
||||
@@ -566,12 +558,15 @@ def get_changelog_header_lines(branch: str):
|
||||
""
|
||||
]
|
||||
|
||||
def get_changelog_content_lines(target: str):
|
||||
def get_changelog_content_lines(branch: str, target: str):
|
||||
lines = []
|
||||
commits = Git("log", target + "..", first_parent=True, format="%h", merges=False).lines()
|
||||
base = Git.get_first_fork_point(branch, target)
|
||||
commits = Git("log", base + ".." + branch, first_parent=True, format="%h", merges=False).lines()
|
||||
|
||||
for commit in commits:
|
||||
message = Git("show", commit, no_patch=True, format="%s").firstline()
|
||||
message = Git("show", commit, patch=False, format="%s").firstline()
|
||||
email = Git("show", commit, patch=False, format="%ae").firstline()
|
||||
username = email[:email.index('@')]
|
||||
|
||||
if message == Git.UPDATED_CHANGELOG_MSG:
|
||||
continue
|
||||
@@ -580,12 +575,7 @@ def get_changelog_content_lines(target: str):
|
||||
commit_type = message[:index]
|
||||
commit_message = message[index+1:]
|
||||
|
||||
lines.append(f"- **{commit_type}**: {commit_message} ({commit})")
|
||||
diff_tree = Git("diff-tree", commit, r=True, commit_id=False, name_status=True).lines()
|
||||
|
||||
for diff in diff_tree:
|
||||
[status, filename] = diff.split("\t")
|
||||
lines.append(f"\t- {filename} ({status})")
|
||||
lines.append(f"- **{commit_type}**: {commit_message} por [{username}]({email}) ({commit})")
|
||||
|
||||
return lines
|
||||
|
||||
@@ -599,7 +589,7 @@ def get_changelog_footer_lines():
|
||||
|
||||
def generate_changelog_entry(branch: str, target: str):
|
||||
entry_lines = get_changelog_header_lines(branch)
|
||||
entry_lines += get_changelog_content_lines(target)
|
||||
entry_lines += get_changelog_content_lines(branch, target)
|
||||
entry_lines += get_changelog_footer_lines()
|
||||
|
||||
return "\n".join(entry_lines)
|
||||
|
||||
Reference in New Issue
Block a user