Use annotated tags
parent
28f2537aed
commit
984b251615
|
@ -2625,7 +2625,20 @@ def git_list_tags(repo):
|
||||||
|
|
||||||
tags = []
|
tags = []
|
||||||
for tag in git_repo.tags:
|
for tag in git_repo.tags:
|
||||||
tags = tags + [tag.name]
|
tag_info = {
|
||||||
|
"name" : tag.name,
|
||||||
|
"commit" : tag.commit.hexsha,
|
||||||
|
"committer" : tag.commit.committer.name,
|
||||||
|
"committed_datetime" : tag.commit.committed_datetime.timestamp()
|
||||||
|
}
|
||||||
|
|
||||||
|
if not tag.tag is None:
|
||||||
|
tag_info["message"] = tag.tag.message
|
||||||
|
tag_info["tagged_date"] = tag.tag.tagged_date
|
||||||
|
tag_info["tagger"] = tag.tag.tagger.name
|
||||||
|
tag_info["tagger_tz_offset"] = tag.tag.tagger_tz_offset
|
||||||
|
|
||||||
|
tags = tags + [ tag_info ]
|
||||||
|
|
||||||
journal.send(f"Returning {len(tags)} branches", PRIORITY=journal.LOG_INFO, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
journal.send(f"Returning {len(tags)} branches", PRIORITY=journal.LOG_INFO, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
return {
|
return {
|
||||||
|
@ -2664,11 +2677,15 @@ def git_create_tag(repo, tag):
|
||||||
journal.send(f"Can't create tag. Commit parameter missing", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
journal.send(f"Can't create tag. Commit parameter missing", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
return jsonify({"error" : "commit parameter missing"}), 400
|
return jsonify({"error" : "commit parameter missing"}), 400
|
||||||
|
|
||||||
|
commit_message = ""
|
||||||
|
if "message" in data:
|
||||||
|
commit_message = data["message"]
|
||||||
|
|
||||||
if tag in git_repo.tags:
|
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")
|
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
|
return jsonify({"error": "Tag already exists"}), 409
|
||||||
|
|
||||||
git_repo.create_tag(tag, ref = data["commit"])
|
git_repo.create_tag(tag, ref = data["commit"], message = commit_message)
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -2058,8 +2058,36 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: object
|
||||||
example: v0.1
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: v0.1
|
||||||
|
commit:
|
||||||
|
type: string
|
||||||
|
example: db8e84d5d2548f589ee503c1c6d5003cc6a0d803
|
||||||
|
committer:
|
||||||
|
type: string
|
||||||
|
example: John Smith
|
||||||
|
committed_datetime:
|
||||||
|
type: int
|
||||||
|
example: 1745360193
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
example: "Initial release"
|
||||||
|
required: False
|
||||||
|
tagged_date:
|
||||||
|
type: int
|
||||||
|
example: 1745360194
|
||||||
|
required: False
|
||||||
|
tagger:
|
||||||
|
type: string
|
||||||
|
example: John Smith
|
||||||
|
required: False
|
||||||
|
tagger_tz_offset:
|
||||||
|
type: int
|
||||||
|
example: -7200
|
||||||
|
required: False
|
||||||
|
|
||||||
"500":
|
"500":
|
||||||
description: "Excepción"
|
description: "Excepción"
|
||||||
|
@ -2095,12 +2123,18 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: |
|
description: |
|
||||||
* **commit** - Commit al que apunta el tag nuevo. Puede ser un nombre de otra rama/tag.
|
* **commit** - Commit al que apunta el tag nuevo. Puede ser un nombre de otra rama/tag.
|
||||||
|
* **message** - Mensaje descriptivo para el tag. Opcional, si no se especifica se asume una cadena vacía.
|
||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
commit:
|
commit:
|
||||||
type: string
|
type: string
|
||||||
example: HEAD
|
example: HEAD
|
||||||
|
required: True
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
example: Version 1.0
|
||||||
|
required: False
|
||||||
responses:
|
responses:
|
||||||
"201":
|
"201":
|
||||||
description: "Tag creado"
|
description: "Tag creado"
|
||||||
|
|
Loading…
Reference in New Issue