refs #2830 create tags via a query to the forgejo API #45
21
CHANGELOG.md
21
CHANGELOG.md
|
|
@ -1,11 +1,22 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.10.3] - 2025-09-18
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Create tags via a query to the forgejo API
|
||||||
|
|
||||||
## [0.10.2] - 2025-09-01
|
## [0.10.2] - 2025-09-01
|
||||||
|
|
||||||
## Fixed
|
### Fixed
|
||||||
|
|
||||||
- Corregida la logica en el endpoint create torrent sum
|
- Corregida la logica en el endpoint create torrent sum
|
||||||
- Mejoras en los mensajes de logs
|
- Mejoras en los mensajes de logs
|
||||||
- Mejoras en la validación de los archivos info e info.checked
|
- Mejoras en la validación de los archivos info e info.checked
|
||||||
|
|
||||||
## [0.10.1] - 2025-08-25
|
## [0.10.1] - 2025-08-25
|
||||||
|
|
@ -21,13 +32,13 @@
|
||||||
|
|
||||||
- OgGit functionality (#2371, #2363, #2363, #2317)
|
- OgGit functionality (#2371, #2363, #2363, #2317)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Removed unused BitTorrent-related packages and logic
|
- Removed unused BitTorrent-related packages and logic
|
||||||
|
|
||||||
## [0.9.0] - 2025-06-25
|
## [0.9.0] - 2025-06-25
|
||||||
|
|
||||||
## Added
|
### Added
|
||||||
|
|
||||||
- Changed old tools for tools non dependant of Pyhton2 in repo
|
- Changed old tools for tools non dependant of Pyhton2 in repo
|
||||||
- mktorrent to handle creation of torrent files
|
- mktorrent to handle creation of torrent files
|
||||||
|
|
|
||||||
|
|
@ -2301,6 +2301,12 @@ def git_forgejo_create_repo(repo):
|
||||||
"private" : False
|
"private" : False
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def git_forgejo_create_tag(repo,tag,msg,target):
|
||||||
|
return git_forgejo_post_command(f"/api/v1/repos/oggit/{repo}/tags", {
|
||||||
|
"message": msg,
|
||||||
|
"tag_name": tag,
|
||||||
|
"target": target
|
||||||
|
})
|
||||||
|
|
||||||
def git_forgejo_add_sshkey(pubkey, description = ""):
|
def git_forgejo_add_sshkey(pubkey, description = ""):
|
||||||
return git_forgejo_post_command("/api/v1/user/keys",
|
return git_forgejo_post_command("/api/v1/user/keys",
|
||||||
|
|
@ -2818,14 +2824,6 @@ def git_create_tag(repo):
|
||||||
- 409: A JSON object with an "error" key containing the message "Tag already exists"
|
- 409: A JSON object with an "error" key containing the message "Tag already exists"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
repo_path = os.path.join(REPOSITORIES_BASE_PATH, OGGIT_USER, repo + ".git")
|
|
||||||
if not os.path.isdir(repo_path):
|
|
||||||
journal.send(f"Can't create tag. Repository storage at {REPOSITORIES_BASE_PATH} not found", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
|
||||||
return jsonify({"error": "Repository not found"}), 404
|
|
||||||
|
|
||||||
git_repo = git.Repo(repo_path)
|
|
||||||
git_repo.git.config('--global', '--add', 'safe.directory', repo_path)
|
|
||||||
|
|
||||||
data = request.json
|
data = request.json
|
||||||
if data is None:
|
if data is None:
|
||||||
journal.send(f"Can't create tag. JSON post data missing", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
journal.send(f"Can't create tag. JSON post data missing", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
|
|
@ -2845,21 +2843,16 @@ def git_create_tag(repo):
|
||||||
if "message" in data:
|
if "message" in data:
|
||||||
commit_message = data["message"]
|
commit_message = data["message"]
|
||||||
|
|
||||||
if tag in git_repo.tags:
|
|
||||||
journal.send(f"Can't create tag. Already found in repository {repo}", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
|
||||||
return jsonify({"error": "Tag already exists"}), 409
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
git_repo.create_tag(tag, ref = data["commit"], message = commit_message)
|
res = git_forgejo_create_tag(repo,tag,commit_message,data["commit"])
|
||||||
except git.exc.GitCommandError as ge:
|
except Exception as e:
|
||||||
if "not a valid tag name" in ge.stderr:
|
journal.send (str(e), PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
journal.send(f"Tag name {tag} is invalid", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
return jsonify({"error" : f"git_forgejo_create_tag failed: {e}"}), 500
|
||||||
return jsonify({"error" : "Invalid tag name"}), 400
|
|
||||||
else:
|
|
||||||
journal.send(f"Git error {ge}", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
|
||||||
return jsonify({"error" : "Error when performing git command"}), 500
|
|
||||||
|
|
||||||
|
|
||||||
|
if 200 != res[0]:
|
||||||
|
j = json.loads(res[1])
|
||||||
|
journal.send (j["message"], PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
|
return jsonify({"error" : j["message"]}), 409
|
||||||
|
|
||||||
journal.send(f"Tag {tag} created in repo {repo}", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
journal.send(f"Tag {tag} created in repo {repo}", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
return jsonify({"status": "created"}), 200
|
return jsonify({"status": "created"}), 200
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue