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: ogLive-Builder-Git/Jenkinsfile

main opengnsys-3.1.0
Last change on this file was a98a449, checked in by Natalia Serrano <natalia.serrano@…>, 4 weeks ago

refs #2814 actually fix final iso filename

  • Property mode set to 100644
File size: 5.4 KB
Line 
1pipeline {
2  agent { label 'built-in' }
3
4  options {
5    timestamps()
6    // Conserva la concurrencia como en el job original (no añadimos disableConcurrentBuilds)
7    skipDefaultCheckout(true) // Haremos el checkout con los parámetros manualmente
8  }
9
10  parameters {
11    string(name: 'OGLIVE_BUILDER_BRANCH', defaultValue: 'main',
12           description: 'What branch of repository oglive-builder to work in.')
13    string(name: 'OGCLONE_ENGINE_BRANCH', defaultValue: 'main',
14           description: 'What branch of repository ogclone-engine to pick files from.')
15    string(name: 'OGREPOSITORY_BRANCH', defaultValue: 'main',
16           description: 'What branch of repository ogrepository to pick files from.')
17    booleanParam(name: 'REUSE_PREV_FS', defaultValue: true,
18           description: 'Whether to reuse the virtual filesystem from the previous build or to start from scratch.')
19  }
20
21  environment {
22    CODENAME = 'noble' // Igual que en tu script actual (hardcoded)
23  }
24
25  stages {
26    stage('Workspace cleanup (pre-build)') {
27      when {
28          expression { return params.REUSE_PREV_FS == false }
29      }
30      steps {
31        // Equivalente al PreBuildCleanup del plugin ws-cleanup
32        cleanWs()
33      }
34    }
35
36    stage('Checkout oglive-builder') {
37      steps {
38        checkout([
39          $class: 'GitSCM',
40          userRemoteConfigs: [[
41            url: 'https://ognproject.evlt.uma.es/gitea/opengnsys/oglive-builder.git',
42            credentialsId: 'gitea-unizar'
43          ]],
44          branches: [[ name: "refs/heads/${params.OGLIVE_BUILDER_BRANCH}" ]],
45          extensions: []
46        ])
47      }
48    }
49
50    stage('Build ogLive') {
51      steps {
52        sh '''#!/bin/bash
53set -euo pipefail
54export CODENAME="${CODENAME}"  ## hardcoded at the moment
55
56echo ========================= Parameters
57echo OGLIVE_BUILDER_BRANCH=${OGLIVE_BUILDER_BRANCH}
58echo OGCLONE_ENGINE_BRANCH=${OGCLONE_ENGINE_BRANCH}
59echo OGREPOSITORY_BRANCH=${OGREPOSITORY_BRANCH}
60echo REUSE_PREV_FS=${REUSE_PREV_FS}
61echo CODENAME=${CODENAME}
62
63echo ========================= Clone/fetch clone-engine repo
64if [[ -d ogclone-engine-repo ]]; then
65    cd ogclone-engine-repo; git fetch; git checkout "${OGCLONE_ENGINE_BRANCH}"; cd ..
66else
67    git clone -c http.sslVerify=false --branch "${OGCLONE_ENGINE_BRANCH}" \
68        https://ognproject.evlt.uma.es/gitea/opengnsys/ogclone-engine.git ogclone-engine-repo
69fi
70HEAD=$(git --git-dir ./ogclone-engine-repo/.git rev-parse HEAD)
71echo "ogclone-engine HEAD: $HEAD"
72
73echo ========================= Clone/fetch ogrepository repo
74if [[ -d ogrepository-repo ]]; then
75    cd ogrepository-repo; git fetch; git checkout "${OGREPOSITORY_BRANCH}"; cd ..
76else
77    git clone -c http.sslVerify=false --branch "${OGREPOSITORY_BRANCH}" \
78        https://ognproject.evlt.uma.es/gitea/opengnsys/ogrepository.git ogrepository-repo
79fi
80HEAD=$(git --git-dir ./ogrepository-repo/.git rev-parse HEAD)
81echo "ogrepository HEAD: $HEAD"
82
83echo ========================= Take stuff out of the ogclone-engine repo
84mkdir -p shared
85mkdir -p engine
86cp -a ./ogclone-engine-repo/ogclient/{bin,etc,lib,scripts} shared/
87cp -a ./ogclone-engine-repo/ogclient/lib/engine/bin        engine/
88git --git-dir ./ogclone-engine-repo/.git log --date format:r%Y%m%d --format=%ad.%h -1 > gitrelease
89
90echo ========================= Take stuff out of the ogrepository repo
91mkdir -p ogrepo-ssh-key
92cp ./ogrepository-repo/installer/ssh-keys/opengnsys     ogrepo-ssh-key/
93cp ./ogrepository-repo/installer/ssh-keys/opengnsys.pub ogrepo-ssh-key/
94
95# echo ========================= Fetch deb packages from the artefacts server
96# AGENT_DEB=$(env - /bin/ls -t /mnt/srv/artefactos/ogagent/*.deb 2>/dev/null | head -n 1)
97# BROWSER_DEB=$(env - /bin/ls -t /mnt/srv/artefactos/ogbrowser/* | head -n 1)
98# echo "Found agent package '$AGENT_DEB' and browser package '$BROWSER_DEB'"
99# cp -vf $AGENT_DEB $BROWSER_DEB .
100
101echo ========================= Build docker image
102docker build --build-arg OPENGNSYS_HEAD="$HEAD" -t opengnsys/mkoglive .   ## invalidate cache when $HEAD changes
103rm -rf shared engine gitrelease ogrepo-ssh-key
104
105echo ========================= Build ogLive
106if [[ "${REUSE_PREV_FS}" == "false" ]]; then
107    echo "Not reusing old build"
108    sudo chown user:user "$WORKSPACE/ogclient" || true
109    rm -rf ogclient
110else
111    echo "Reusing old build. In the following 'ls' output there should be something"
112    ls -la ogclient/ || true
113fi
114mkdir -p ogclient    ## run this as user; otherwise docker may create it as root
115if [[ "zjenkins" != "z$(stat --format %U ogclient)" ]]; then
116  echo "warning: directory 'ogclient' not owned by user 'jenkins'"
117fi
118
119docker run --rm --name mkoglive --privileged=true \
120  --volume "$PWD/ogclient:/var/lib/tftpboot/ogclient" \
121  opengnsys/mkoglive --codename "$CODENAME" --loglevel debug
122
123echo Uploading to the artefactos NFS share
124[[ -d /mnt/srv ]] || mount /mnt
125cp -av ogclient/ogLive-*.iso /mnt/srv/artefactos/oglive/ || true
126
127echo Cleaning up
128sudo chown jenkins:jenkins "$WORKSPACE/ogclient" || true
129rm -vf ogclient/ogclient.sqfs* ogclient/ogLive-*.iso ogclient/*.iso.sum ogclient/oginitrd.img* ogclient/ogvmlinuz* || true
130'''
131      }
132    }
133  }
134
135  // Si te interesa conservar el ISO como artefacto de Jenkins, descomenta el 'post' siguiente y
136  // mueve/duplica el borrado de ficheros para que ocurra después del archiveArtifacts.
137  // post {
138  //   success {
139  //     archiveArtifacts artifacts: 'ogclient/ogLive-*.iso, ogclient/*.iso.sum', allowEmptyArchive: true
140  //   }
141  //   always {
142  //     wsCleanup()
143  //   }
144  // }
145}
Note: See TracBrowser for help on using the repository browser.