forked from espos/base-files
Remove obsolete files and add kernel metapackage build scripts
- Deleted the Mozilla Public License file as it is no longer needed. - Removed unused MOTD and Debian vendor information files. - Added new scripts for building a kernel metapackage and detecting kernel packages. - Removed legacy shell configuration files and associated MD5 sums. - Cleaned up unnecessary documentation and policy files related to /usr/local permissions.
This commit is contained in:
Vendored
+78
-54
@@ -1,98 +1,122 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
options {
|
||||
skipDefaultCheckout(true)
|
||||
disableConcurrentBuilds()
|
||||
timestamps()
|
||||
}
|
||||
|
||||
environment {
|
||||
PACKAGE_NAME = "base-files"
|
||||
APTLY_REPO = "espos-unstable"
|
||||
|
||||
APTLY_HOST = "ubuntu@elordenador.org"
|
||||
|
||||
DEB_FILE = "*.deb"
|
||||
KERNEL_JOB = 'espos-kernel'
|
||||
APTLY_REPO = 'espos-unstable'
|
||||
APTLY_HOST = 'ubuntu@elordenador.org'
|
||||
APTLY_SSH_HOST = 'elordenador.org'
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
deleteDir()
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install Build Dependencies') {
|
||||
stage('Download kernel artifacts') {
|
||||
steps {
|
||||
// Copy Artifact plugin: latest successful build of espos-kernel.
|
||||
copyArtifacts(
|
||||
projectName: env.KERNEL_JOB,
|
||||
selector: lastSuccessful(stable: false),
|
||||
filter: '**/linux-image-*-espos_*.deb,**/linux-headers-*-espos_*.deb',
|
||||
target: 'kernel-artifacts',
|
||||
flatten: true,
|
||||
optional: false
|
||||
)
|
||||
sh 'find kernel-artifacts -maxdepth 1 -type f -name "*.deb" -print'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install build dependencies') {
|
||||
steps {
|
||||
sh '''
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential devscripts debhelper lintian
|
||||
set -eu
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y dpkg-dev lintian
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build Debian Package") {
|
||||
stage('Build metapackage') {
|
||||
steps {
|
||||
sh '''
|
||||
dpkg-buildpackage -us -uc
|
||||
ls -lah ..
|
||||
set -eu
|
||||
./scripts/build-metapackage kernel-artifacts dist
|
||||
dpkg-deb --info dist/espos-kernel_*.deb
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage("Lintian Check") {
|
||||
stage('Lintian') {
|
||||
steps {
|
||||
sh '''
|
||||
lintian ../*.deb || true
|
||||
'''
|
||||
sh 'lintian dist/espos-kernel_*.deb'
|
||||
}
|
||||
}
|
||||
stage("Upload to aptly") {
|
||||
|
||||
stage('Publish in Aptly') {
|
||||
steps {
|
||||
sshagent(['srv01_elordenador_org']) {
|
||||
sh '''
|
||||
ssh-keyscan -H elordenador.org >> ~/.ssh/known_hosts
|
||||
scp ../${DEB_FILE} ${APTLY_HOST}:/tmp/
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Publish Repository") {
|
||||
steps {
|
||||
sshagent(['srv01_elordenador_org']) {
|
||||
|
||||
withCredentials([
|
||||
string(
|
||||
credentialsId: 'aptly_gpg_pass',
|
||||
variable: 'GPG_PASS'
|
||||
)
|
||||
string(credentialsId: 'aptly_gpg_pass', variable: 'GPG_PASS')
|
||||
]) {
|
||||
|
||||
sh '''
|
||||
ssh ${APTLY_HOST} "
|
||||
aptly repo add espos-unstable /tmp/*.deb
|
||||
|
||||
if aptly publish list | grep -q espos-unstable
|
||||
then
|
||||
aptly publish update \
|
||||
-passphrase='${GPG_PASS}' \
|
||||
espos-unstable
|
||||
else
|
||||
aptly publish repo \
|
||||
-distribution=espos-unstable \
|
||||
-component=main \
|
||||
-passphrase='${GPG_PASS}' \
|
||||
espos-unstable
|
||||
fi
|
||||
"
|
||||
set -eu
|
||||
|
||||
remote_dir="/tmp/espos-kernel-metapackage-${BUILD_TAG}"
|
||||
mkdir -p "$HOME/.ssh"
|
||||
chmod 700 "$HOME/.ssh"
|
||||
ssh-keyscan -H "$APTLY_SSH_HOST" >> "$HOME/.ssh/known_hosts"
|
||||
|
||||
ssh "$APTLY_HOST" "mkdir -p '$remote_dir' && chmod 700 '$remote_dir'"
|
||||
trap 'ssh "$APTLY_HOST" "rm -rf '\''$remote_dir'\''"' EXIT HUP INT TERM
|
||||
scp dist/espos-kernel_*.deb "$APTLY_HOST:$remote_dir/"
|
||||
|
||||
# The passphrase travels over SSH stdin and is never an argument.
|
||||
printf '%s' "$GPG_PASS" | ssh "$APTLY_HOST" \
|
||||
"umask 077; cat > '$remote_dir/gpg-passphrase'"
|
||||
|
||||
ssh "$APTLY_HOST" "
|
||||
set -eu
|
||||
aptly repo add -force-replace '$APTLY_REPO' '$remote_dir'/espos-kernel_*.deb
|
||||
|
||||
if aptly publish list -raw | grep -Eq '^[^[:space:]]+[[:space:]]+$APTLY_REPO$'; then
|
||||
aptly publish update \
|
||||
-passphrase-file='$remote_dir/gpg-passphrase' \
|
||||
'$APTLY_REPO'
|
||||
else
|
||||
aptly publish repo \
|
||||
-distribution='$APTLY_REPO' \
|
||||
-component=main \
|
||||
-passphrase-file='$remote_dir/gpg-passphrase' \
|
||||
'$APTLY_REPO'
|
||||
fi
|
||||
"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: 'dist/espos-kernel_*.deb', fingerprint: true, allowEmptyArchive: true
|
||||
}
|
||||
success {
|
||||
echo "Paquete publicado correctamente"
|
||||
echo 'Metapaquete espos-kernel publicado correctamente'
|
||||
}
|
||||
failure {
|
||||
echo "Error construyendo paquete"
|
||||
echo 'Error construyendo o publicando espos-kernel'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user