Compare commits

...

27 Commits

Author SHA1 Message Date
Natalia Serrano b2066d3e5d Merge pull request 'refs #2831 set safe.directory just once' (#47) from safe_dir into main
ogrepository/pipeline/head This commit looks good Details
ogrepository/pipeline/tag This commit looks good Details
Reviewed-on: #47
2025-09-30 12:38:34 +02:00
Natalia Serrano eace7142ae refs #2831 set safe.directory just once 2025-09-30 12:37:57 +02:00
Luis Gerardo Romero Garcia 8bd472fd6b Merge pull request 'refs #2789 Adds necessary ogboot commands to sudoers' (#46) from sudoers-ogboot into main
ogrepository/pipeline/head This commit looks good Details
Reviewed-on: #46
2025-09-22 13:12:34 +02:00
Luis Gerardo Romero Garcia 6ea7699ca5 refs #2789 Adds necessary ogboot commands to sudoers 2025-09-22 13:11:13 +02:00
Natalia Serrano c9c8952741 Merge pull request 'refs #2830 create tags via a query to the forgejo API' (#45) from forgejo-tags into main
ogrepository/pipeline/head This commit looks good Details
ogrepository/pipeline/tag This commit looks good Details
Reviewed-on: #45
2025-09-18 13:53:09 +02:00
Natalia Serrano e0b9a036ca refs #2830 create tags via a query to the forgejo API 2025-09-18 13:52:34 +02:00
Vadim vtroshchinskiy 206853bd23 Merge pull request 'refs #2509 Add missing Git swagger endpoints' (#44) from complete-git-swaggger-endpoints into main
ogrepository/pipeline/head This commit looks good Details
Reviewed-on: #44
2025-09-03 15:58:14 +02:00
Nicolas Arenas 1761ec4378 refs #2741 Test auto launch puublish
ogrepository/pipeline/head This commit looks good Details
2025-09-03 10:25:44 +02:00
Nicolas Arenas d8f3eb0a19 refs #2741 Test auto launch puublish
ogrepository/pipeline/head This commit looks good Details
2025-09-03 10:01:46 +02:00
Vadim vtroshchinskiy 4447126891 refs #2509 Add missing Git swagger endpoints 2025-09-03 00:18:09 +02:00
Nicolas Arenas 49f72febf8 Merge pull request 'fix_checked_file' (#43) from fix_checked_file into main
ogrepository/pipeline/head This commit looks good Details
Reviewed-on: #43
2025-09-01 16:48:04 +02:00
Nicolas Arenas 6811665993 Updated CHANGELOG.md 2025-09-01 16:28:04 +02:00
Nicolas Arenas bc134d13a4 refs #2723 Fix problems with checked and non-checked info files 2025-09-01 16:24:09 +02:00
Nicolas Arenas 8611995dda refs #2723 #2722 Fix problems with checked and non-checked info files 2025-09-01 14:41:28 +02:00
Nicolas Arenas 1256229340 refs #2733 Check files in try except block 2025-09-01 14:39:27 +02:00
Nicolas Arenas f6617aee77 Merge pull request 'fix_checked_file' (#42) from fix_checked_file into main
ogrepository/pipeline/head This commit looks good Details
Reviewed-on: #42
2025-09-01 12:20:22 +02:00
Nicolas Arenas 4301fb4635 refs #2723 2025-09-01 12:19:23 +02:00
Nicolas Arenas 597f0a156b Update CHANGELOG.md, refs #2722 2025-08-29 15:54:07 +02:00
Nicolas Arenas 7a878edf1d refs #2727 unify log messages 2025-08-29 15:47:03 +02:00
Nicolas Arenas 32174016be refs #2726 Waits 30 min for auxiliary files 2025-08-29 12:34:35 +02:00
Nicolas Arenas 75efb96653 refs #2723 Improves logging in check_aux_files function 2025-08-29 12:03:55 +02:00
Nicolas Arenas ae1cec5cd4 refs #2723 Check if file exists and return 400 if info file don´t exists 2025-08-29 11:57:14 +02:00
Nicolas Arenas 04c9cd7950 Enable opentracker after install ogrepository
ogrepository/pipeline/head This commit looks good Details
2025-08-08 11:49:45 +02:00
Nicolas Arenas bc50845742 Hot Fix postinst debian package
ogrepository/pipeline/head This commit looks good Details
2025-08-08 10:48:14 +02:00
Nicolas Arenas c964ab75da Merge ticket-2610 into main, Resolve conflicts
ogrepository/pipeline/head This commit looks good Details
2025-08-08 09:34:30 +02:00
Nicolas Arenas 61e2e2468d Merge pull request 'Remove Systemd block' (#40) from remove_systemd_block into main
ogrepository/pipeline/head This commit looks good Details
Reviewed-on: #40
2025-08-07 10:26:13 +02:00
Nicolas Arenas ef8112b8c1 Remove Systemd block 2025-08-07 10:25:04 +02:00
8 changed files with 550 additions and 241 deletions

View File

@ -1,17 +1,50 @@
# 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.4] - 2025-09-30
### Fixed
- Set safe.directory just once
## [0.10.3] - 2025-09-18
### Changed
- Create tags via a query to the forgejo API
## [0.10.2] - 2025-09-01
### Fixed
- Corregida la logica en el endpoint create torrent sum
- Mejoras en los mensajes de logs
- Mejoras en la validación de los archivos info e info.checked
## [0.10.1] - 2025-08-25
### Fixed
- Import images problems when there is not info.checked file (#2723, #2726)
- Improves logging (#2727)
## [0.10.0] - 2025-07-07
### Added
- OgGit functionality (#2371, #2363, #2363, #2317)
- OgGit functionality (#2371, #2363, #2363, #2317)
### Removed
- Removed unused BitTorrent-related packages and logic
### Removed
- Removed unused BitTorrent-related packages and logic
## [0.9.0] - 2025-06-25
## Added
### Added
- Changed old tools for tools non dependant of Pyhton2 in repo
- mktorrent to handle creation of torrent files

View File

@ -99,15 +99,22 @@ pipeline {
}
}
post {
success {
script {
// Solo lanzar cuando el build sea exitoso y en la rama main
if (env.BRANCH_NAME == 'main') {
build job: 'Aptly publish nightly repository',
wait: false,
parameters: [
string(name: 'TRIGGERED_BY', value: "${env.JOB_NAME}-${env.BUILD_NUMBER}")
]
}
}
}
always {
notifyBuildStatus('narenas@qindel.com')
notifyBuildStatus('opengnsys@qindel.com')
}
}
}
// stage ('Publish to Debian Repository') {
// agent { label 'debian-repo' }
// steps {
// sh "aptly repo add opengnsys-devel /var/tmp/opengnsys/debian-repo/*.deb"
// }
// }

File diff suppressed because it is too large Load Diff

View File

@ -2087,6 +2087,203 @@ paths:
error:
type: string
example: "Parameters missing"
/ogrepository/v1/git/repositories/{repository}:
delete:
summary: "Eliminar repositorio"
description: |
Elimina un repositorio de Git
tags:
- "Git"
parameters:
- name: repository
in: path
required: true
type: string
description: "Nombre de repositorio"
responses:
"200":
description: "Repositorio eliminado"
schema:
type: object
properties:
status:
type: string
example: deleted
"404":
description: "Repositorio no encontrado"
schema:
type: object
properties:
status:
type: string
example: not found
"500":
description: "Excepción"
schema:
type: object
properties:
success:
type: boolean
example: false
exception:
type: string
example: "(Exception description)"
/ogrepository/v1/git/repositories/{repository}/sync:
post:
summary: "Sincronizar con repositorio remoto"
description: |
Sincroniza un repositorio de Git con uno remoto.
tags:
- "Git"
parameters:
- name: repository
in: path
required: true
type: string
description: "Nombre de repositorio"
- name: JSON
in: body
required: true
description: |
* **remote_repository** - Reposition remoto al que hacer push
responses:
"200":
description: "Repositorio en proceso de sincronización"
schema:
type: object
properties:
success:
type: boolean
example: True
output:
type: string
example: "Synchronizing..."
job_id:
type: string
example: "GitSync_02345"
"404":
description: "Repositorio no encontrado"
schema:
type: object
properties:
status:
type: string
example: not found
"500":
description: "Excepción"
schema:
type: object
properties:
success:
type: boolean
example: false
exception:
type: string
example: "(Exception description)"
/ogrepository/v1/git/repositories/{repository}/backup:
post:
summary: "Sincronizar con repositorio remoto"
description: |
Sincroniza un repositorio de Git con uno remoto.
tags:
- "Git"
parameters:
- name: repository
in: path
required: true
type: string
description: "Nombre de repositorio"
- name: JSON
in: body
required: true
description: |
* **ssh_server** - Servidor SSH al que enviar el backup
* **ssh_port** - Puerto del servidor SSH al que enviar el backup
* **ssh_user** - Usuario del servidor SSH al que enviar el backup
* **filename** - Nombre de archivo del backup
responses:
"200":
description: "Repositorio en proceso de sincronización"
schema:
type: object
properties:
success:
type: boolean
example: True
output:
type: string
example: "Backing up..."
job_id:
type: string
example: "GitBackup_02345"
"404":
description: "Repositorio no encontrado"
schema:
type: object
properties:
status:
type: string
example: not found
"500":
description: "Excepción"
schema:
type: object
properties:
success:
type: boolean
example: false
exception:
type: string
example: "(Exception description)"
/ogrepository/v1/git/repositories/{repository}/compact:
post:
summary: "Compactar repositorio"
description: |
Compacta un repositorio de Git para optimizar el rendimiento y liberar espacio
tags:
- "Git"
parameters:
- name: repository
in: path
required: true
type: string
description: "Nombre de repositorio"
responses:
"200":
description: "Repositorio en proceso de compactación"
schema:
type: object
properties:
success:
type: boolean
example: True
output:
type: string
example: "Compacting..."
job_id:
type: string
example: "GitGC_02345"
"404":
description: "Repositorio no encontrado"
schema:
type: object
properties:
status:
type: string
example: not found
"500":
description: "Excepción"
schema:
type: object
properties:
success:
type: boolean
example: false
exception:
type: string
example: "(Exception description)"
/ogrepository/v1/git/repositories/{repository}/tags:
get:
summary: "Obtener lista de tags"

View File

@ -184,11 +184,16 @@ def main():
# Obtenemos la ruta completa de la imagen:
file_path = build_file_path()
# Si no existe el archivo de imagen, imprimimos un mensaje de error y salimos del script:
if not os.path.exists(file_path):
journal.send("createTorrentSum.py: Image not found", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print("Image file doesn't exist")
# Si no existe el archivo de imagen o el .info, imprimimos un mensaje de error y salimos del script:
if not os.path.exists(file_path) or not (os.path.exists(f"{file_path}.info.checked") or os.path.exists(f"{file_path}.info")):
if not os.path.exists(file_path):
journal.send(f"createTorrentSum.py: Image file '{file_path}' not found", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print(f"Image file '{file_path}' doesn't exist")
if not os.path.exists(f"{file_path}.info.checked") and not os.path.exists(f"{file_path}.info"):
journal.send(f"createTorrentSum.py: Neither '{file_path}.info.checked' nor '{file_path}.info' found", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print(f"Neither info file '{file_path}.info.checked' nor '{file_path}.info' exists")
sys.exit(2)
# Si la imagen está bloqueada, imprimimos un mensaje de error y salimos del script:
if os.path.exists(f"{file_path}.lock"):
@ -257,7 +262,8 @@ def main():
# Actualizamos la información del repositorio, ejecutando el script "updateRepoInfo.py":
journal.send("createTorrentSum.py: Updating repository info...", PRIORITY=journal.LOG_INFO, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print("Updating Repository Info...")
update_repo_info()
if os.path.exists(f"{file_path}.info"):
update_repo_info()

View File

@ -67,33 +67,50 @@ def check_files():
continue
# Comprobamos si existe un archivo ".info" asociado a la imagen actual:
info_file = f"{img_path}.info"
if os.path.exists(info_file):
# Si la fecha de modificación del archivo ".info" es anterior a la de la imagen, lo eliminamos (porque estará desactualizado):
if os.path.getmtime(info_file) < os.path.getmtime(img_path):
os.remove(info_file)
print(f"Warning: Deleted outdated file {info_file}")
try:
if os.path.exists(info_file):
# Si la fecha de modificación del archivo ".info" es anterior a la de la imagen, lo eliminamos (porque estará desactualizado):
if os.path.getmtime(info_file) < os.path.getmtime(img_path):
os.remove(info_file)
print(f"Warning: Deleted outdated file {info_file}")
# En caso contrario, almacenamos el contenido del archivo ".info" (del tipo "PARTCLONE:LZOP:EXTFS:8500000:Ubuntu_20") en la variable "data":
else:
with open(info_file, 'r') as file:
info_data = file.read()
# Almacenamos el contenido de los archivos ".size", ".sum" y ".full.sum":
with open(f"{img_path}.size", 'r') as file:
size = file.read().strip('\n')
with open(f"{img_path}.sum", 'r') as file:
_sum = file.read().strip('\n')
with open(f"{img_path}.full.sum", 'r') as file:
fullsum = file.read().strip('\n')
# Llamamos a la función "add_to_json", para que inserte la información de la imagen en el archivo json
# (pasándole el nombre de la imagen, la extensión, y los datos extraídos del archivo ".info"):
img_name = os.path.relpath(img_path, repo_path)
add_to_json(os.path.splitext(img_name)[0], os.path.splitext(img_name)[1][1:], info_data, size, _sum, fullsum)
else:
with open(info_file, 'r') as file:
info_data = file.read()
# Almacenamos el contenido de los archivos ".size", ".sum" y ".full.sum":
with open(f"{img_path}.size", 'r') as file:
size = file.read().strip('\n')
with open(f"{img_path}.sum", 'r') as file:
sum = file.read().strip('\n')
with open(f"{img_path}.full.sum", 'r') as file:
fullsum = file.read().strip('\n')
# Renombramos el archivo ".info" a ".info.checked", para que ya no se añada la información que contiene
# (originalmente se eliminaba el archivo, pero creo que es mejor mantenerlo):
os.rename(info_file, f"{info_file}.checked")
# Renombramos el archivo ".info" a ".info.checked", para que ya no se añada la información que contiene
# (originalmente se eliminaba el archivo, pero creo que es mejor mantenerlo):
os.rename(info_file, f"{info_file}.checked")
# Llamamos a la función "add_to_json", para que inserte la información de la imagen en el archivo json
# (pasándole el nombre de la imagen, la extensión, y los datos extraídos del archivo ".info"):
img_name = os.path.relpath(img_path, repo_path)
add_to_json(os.path.splitext(img_name)[0], os.path.splitext(img_name)[1][1:], info_data, size, sum, fullsum)
def add_to_json(image_name, image_type, data, size, _sum, fullsum):
except (IOError, OSError, PermissionError) as e:
# Si hay algún error leyendo los archivos, registramos el error y continuamos con la siguiente imagen
journal.send(f"updateRepoInfo.py: Error processing files for {img_path}: {str(e)}", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print(f"Warning: Could not process files for {item}: {str(e)}")
continue
except ValueError as e:
# Si hay algún error con el formato de los datos en los archivos
journal.send(f"updateRepoInfo.py: Data format error for {img_path}: {str(e)}", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print(f"Warning: Data format error for {item}: {str(e)}")
continue
except Exception as e:
# Para cualquier otra excepción inesperada
journal.send(f"updateRepoInfo.py: Unexpected error processing {img_path}: {str(e)}", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print(f"Error: Unexpected error processing {item}: {str(e)}")
continue
def add_to_json(image_name, image_type, data, size, sum, fullsum):
""" Esta función añade al archivo "repoinfo.json" la información de las imágenes que aun no ha sido introducida en él (imágenes nuevas, básicamente).
"""
# Almacenamos el contenido de la variable "data" (del tipo "PARTCLONE:LZOP:EXTFS:8500000:Ubuntu_20") en variables separadas:
@ -109,7 +126,7 @@ def add_to_json(image_name, image_type, data, size, _sum, fullsum):
"filesystem": fstype.upper(),
"datasize": int(datasize) * 1024, # Convertimos el valor a bytes (desde KB)
"size": int(size),
"sum": _sum,
"sum": sum,
"fullsum": fullsum
}
# Almacenamos el contenido del archivo "repoinfo.json" en la variable "info_data"

View File

@ -42,7 +42,6 @@ USER="opengnsys"
if [ "$1" = "configure" ] && [ -z "$2" ]; then
sed -i "s/%%OGREPOSITORY_USER%%/$SAMBA_USER/g" /etc/systemd/system/ogrepo-api.service
sed -i "s/%%OGREPOSITORY_USER%%/$SAMBA_USER/g" /etc/samba/ogrepo-smb.conf
@ -129,5 +128,8 @@ systemctl daemon-reload
systemctl enable ogrepo-api
systemctl restart ogrepo-api
systemctl restart smbd
systemctl enable --now opentracker || true
systemctl restart opentracker || true
exit 0

View File

@ -10,6 +10,25 @@ Cmnd_Alias MOUNT_RECOVERY = \
/usr/bin/umount /mnt/recovery/sys, \
/usr/bin/umount -l /mnt/recovery
Cmnd_Alias OGBOOT = \
/opt/bin/oglivecli, \
/usr/bin/chmod, \
/usr/bin/chown, \
/usr/bin/md5sum, \
/usr/bin/smbpasswd, \
/usr/bin/cat, \
/usr/bin/tee, \
/usr/bin/sed, \
/usr/bin/gzip, \
/usr/bin/lz4, \
/usr/bin/cpio, \
/usr/bin/find, \
/bin/tee, \
/usr/bin/dd, \
/usr/bin/mkfs.ext4, \
/usr/bin/rsync, \
/opt/opengnsys/ogboot/lib/*.iso /mnt
Cmnd_Alias CHROOT_GRUB = \
/usr/sbin/chroot /mnt/recovery /usr/sbin/grub-install --target=i386-pc *, \
/usr/sbin/chroot /mnt/recovery /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
@ -28,4 +47,4 @@ Cmnd_Alias KILL_BT = \
Cmnd_Alias PYTHON_OGREPO = /usr/bin/python3 /opt/opengnsys/ogrepository/bin/*
# Permitir al usuario opengnsys ejecutar estos comandos sin contraseña
opengnsys ALL=(root) NOPASSWD: MOUNT_RECOVERY, CHROOT_GRUB, LOOP_KPARTX, KILL_BT, PYTHON_OGREPO
opengnsys ALL=(root) NOPASSWD: MOUNT_RECOVERY, CHROOT_GRUB, LOOP_KPARTX, OGBOOT, KILL_BT, PYTHON_OGREPO