close Warning: Failed to sync with repository "ogBrowser-Git": (1366, "Incorrect string value: '\\xF0\\x9F\\x93\\xA6 I...' for column 'message' at row 1"); repository information may be out of date. Look in the Trac log for more information including mitigation strategies.

source: ogBrowser-Git/Jenkinsfile

fix_uploadmain
Last change on this file was dbdc0c7, checked in by Nicolas Arenas <narenas@…>, 4 weeks ago

refs #2663 Creates changelog from debian changelog and updates Jenkinsfile

  • Property mode set to 100644
File size: 6.7 KB
Line 
1@Library('jenkins-shared-library') _
2
3pipeline {
4    agent {
5        docker {
6            image 'ogbrowser-build:latest'
7            args '-u root:root'
8            label 'jenkins-slave'
9        }
10    }
11    environment {
12        DEBIAN_FRONTEND = 'noninteractive'
13        DEFAULT_DEV_NAME = 'Opengnsys Team'
14        DEFAULT_DEV_EMAIL = 'opengnsys@qindel.com'
15    }
16    parameters {
17        string(name: 'DEV_NAME', defaultValue: '', description: 'Nombre del desarrollador')
18        string(name: 'DEV_EMAIL', defaultValue: '', description: 'Email del desarrollador')
19    }
20    stages {
21        stage('Prepare environment') {
22            steps {
23                sh '''
24                    apt-get update
25                    apt-get install -y openssh-client
26                    mkdir -p debian
27                    echo "Workspace preparado: ${WORKSPACE}"
28                '''
29            }
30        }
31
32        stage('Install Dependencies') {
33            steps {
34                sshagent (credentials: ['aptly-key']) {
35                    sh '''
36                        export DEBIAN_FRONTEND=noninteractive
37                        apt-get update
38                        apt-get install -y build-essential cmake g++ qt6-base-dev qt6-webengine-dev linguist-qt6 libgl1-mesa-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools libqt6core5compat6-dev lxqt-build-tools qt6-webengine-dev-tools libqt6webenginecore6-bin ninja-build
39
40                        # Verificar conexión con aptly
41                        aptly=172.17.8.68
42                        ssh aptly@${aptly} -o StrictHostKeyChecking=no "uptime"
43                    '''
44                }
45            }
46        }
47
48        stage('Generate Changelog') {
49            when {
50                expression { return env.TAG_NAME != null }
51            }
52            steps {
53                script {
54                    def devName = params.DEV_NAME ? params.DEV_NAME : env.DEFAULT_DEV_NAME
55                    def devEmail = params.DEV_EMAIL ? params.DEV_EMAIL : env.DEFAULT_DEV_EMAIL
56
57                    // Generar changelog en el workspace root (donde está el directorio debian)
58                    generateDebianChangelog(env.WORKSPACE, devName, devEmail)
59                }
60            }
61        }
62
63        stage('Generate Changelog (Nightly)') {
64            when {
65                anyOf {
66                    branch 'main'
67                    branch 'fix_upload'
68                }
69            }
70            steps {
71                script {
72                    def devName = params.DEV_NAME ? params.DEV_NAME : env.DEFAULT_DEV_NAME
73                    def devEmail = params.DEV_EMAIL ? params.DEV_EMAIL : env.DEFAULT_DEV_EMAIL
74                   
75                    // Generar changelog nightly en el workspace root
76                    generateDebianChangelog(env.WORKSPACE, devName, devEmail, 'nightly')
77                }
78            }
79        }
80
81        stage('Verify Changelog') {
82            steps {
83                sh '''
84                    echo "=== Verificando changelog generado ==="
85                    echo "Workspace: ${WORKSPACE}"
86                    ls -la debian/ || echo "❌ No existe directorio debian"
87                    if [ -f debian/changelog ]; then
88                        echo "✅ Changelog encontrado:"
89                        head -5 debian/changelog
90                    else
91                        echo "❌ No existe archivo changelog"
92                    fi
93                '''
94            }
95        }
96
97        stage('Build') {
98            steps {
99                sh '''
100                    echo "=== Preparando build ==="
101                    mkdir -p build
102                    cd build
103                   
104                    echo "=== Verificando estructura antes de CMake ==="
105                    echo "Directorio actual: $(pwd)"
106                    echo "Buscando changelog en: ../debian/changelog"
107                    ls -la ../debian/changelog || echo "❌ Changelog no encontrado"
108                   
109                    echo "=== Configurando CMake ==="
110                    cmake .. -G Ninja
111                   
112                    echo "=== Compilando ==="
113                    ninja
114                '''
115            }
116        }
117
118        stage('Create package') {
119            steps {
120                sh '''
121                    cd build
122                   
123                    echo "=== Verificando configuración de versión ==="
124                    cmake -L . | grep -i "cpack.*version" || echo "No hay variables de versión configuradas"
125                   
126                    echo "=== Creando paquete Debian ==="
127                    cpack -G DEB --verbose
128                   
129                    echo "=== Paquetes generados ==="
130                    ls -la *.deb
131                   
132                    echo "=== Información del paquete ==="
133                    PACKAGE_FILE=$(ls *.deb | head -1)
134                    dpkg-deb --info "$PACKAGE_FILE" | head -20
135                   
136                    echo "=== Verificando contenido del paquete ==="
137                    dpkg-deb --control "$PACKAGE_FILE" extracted_control
138                    if [ -f extracted_control/changelog.Debian.gz ]; then
139                        echo "✅ Changelog incluido en el paquete"
140                    else
141                        echo "❌ Changelog NO incluido en el paquete"
142                    fi
143                '''
144            }
145        }
146
147        stage("Upload package to Aptly") {
148            steps {
149                sshagent (credentials : ['aptly-key']) {
150                    withCredentials([string(credentialsId: 'aptly-gpg-passphrase', variable: 'GPG_PASSPHRASE')]) {
151                        sh '''
152                        aptly=172.17.8.68
153                       
154                        # Detectar automáticamente el nombre del paquete generado
155                        PACKAGE_FILE=$(ls build/*.deb | head -1)
156                        PACKAGE_NAME=$(basename "$PACKAGE_FILE")
157                        echo "📦 Subiendo paquete: $PACKAGE_NAME"
158                       
159                        # Verificar que el archivo existe
160                        if [ ! -f "$PACKAGE_FILE" ]; then
161                            echo "❌ Error: No se encontró el paquete generado"
162                            exit 1
163                        fi
164                       
165                        # Subir el paquete
166                        scp -o StrictHostKeyChecking=no "$PACKAGE_FILE" aptly@${aptly}:/tmp/
167                        ssh aptly@${aptly} -o StrictHostKeyChecking=no "aptly repo add nightly /tmp/$PACKAGE_NAME"
168                       
169                        echo "✅ Paquete subido correctamente: $PACKAGE_NAME"
170                        '''
171                    }
172                }
173            }
174        }
175    }
176    post {
177        always {
178            cleanWs()
179        }
180    }
181}
Note: See TracBrowser for help on using the repository browser.