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 @ f527d33

fix_video_2fix_video_problemmain
Last change on this file since f527d33 was f527d33, checked in by Nicolas Arenas <narenas@…>, 5 weeks ago

Fix typo in jenkisfile

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