Initial Commit
Some checks failed
LXC-ImageBuilder/Debian/pipeline/head There was a failure building this commit
Some checks failed
LXC-ImageBuilder/Debian/pipeline/head There was a failure building this commit
This commit is contained in:
89
Jenkinsfile
vendored
Normal file
89
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
pipeline {
|
||||
agent { label 'LXCBuilder' }
|
||||
parameters {
|
||||
booleanParam defaultValue: true, description: 'Builds Default images', name: 'BuildDefault'
|
||||
booleanParam defaultValue: false, description: 'Builds Extra images', name: 'BuildExtra'
|
||||
}
|
||||
options {
|
||||
skipDefaultCheckout()
|
||||
buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '1'))
|
||||
}
|
||||
stages {
|
||||
stage('Prepare') {
|
||||
steps {
|
||||
// Cleanup before starting
|
||||
cleanWs()
|
||||
// Checkout the repository
|
||||
checkout scm
|
||||
// Get distrobuilder
|
||||
copyArtifacts filter: 'bin/distrobuilder', fingerprintArtifacts: true, flatten: true, projectName: '/Public/DistroBuilder/BuildConfig=BrampCustom', selector: lastSuccessful()
|
||||
// Setup Env
|
||||
sh '''mkdir $WORKSPACE/REL'''
|
||||
}
|
||||
}
|
||||
stage("Image Configs") {
|
||||
matrix {
|
||||
axes {
|
||||
axis {
|
||||
name 'ImgRelease'
|
||||
values 'buster'
|
||||
}
|
||||
axis {
|
||||
name 'ImgVariant'
|
||||
values 'Default-minmal', 'Default-default'
|
||||
}
|
||||
}
|
||||
// //Exclude unwanted conbinatinations
|
||||
// excludes {
|
||||
// exclude {
|
||||
// axis {
|
||||
// name 'ImgRelease'
|
||||
// values 'edge'
|
||||
// }
|
||||
// axis {
|
||||
// name 'ImgVariant'
|
||||
// //use notValues to invert
|
||||
// values 'Extra-extended'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
stages {
|
||||
stage('Build image') {
|
||||
when {
|
||||
//ImgTypeTest
|
||||
anyOf {
|
||||
allOf {
|
||||
expression { return (env.ImgVariant).startsWith('Default-') }
|
||||
environment name: 'BuildDefault', value: 'true'
|
||||
}
|
||||
allOf {
|
||||
expression { return (env.ImgVariant).startsWith('Extra-') }
|
||||
environment name: 'BuildExtra', value: 'true'
|
||||
}
|
||||
}
|
||||
}
|
||||
steps {
|
||||
// Build script
|
||||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
||||
sh '''echo "$(date) Do Build for $ImgRelease - $ImgVariant"
|
||||
ImgVariantName=${ImgVariant#Default-} && ImgVariantName=${ImgVariantName#Extra-}
|
||||
sudo $WORKSPACE/distrobuilder build-lxc Debian.yaml $WORKSPACE/REL/$ImgRelease-$ImgVariant/ -o image.release=$ImgRelease -o image.variant=$ImgVariantName
|
||||
sudo chown jenkins:jenkins -R $WORKSPACE/REL
|
||||
mv $WORKSPACE/REL/$ImgRelease-$ImgVariant/rootfs.tar.xz Debian-$ImgRelease-$ImgVariant.tar.xz
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Finish') {
|
||||
steps {
|
||||
// Save generated files
|
||||
archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false
|
||||
// Cleaning WorkSpace
|
||||
//cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
143
debian.yaml
Normal file
143
debian.yaml
Normal file
@@ -0,0 +1,143 @@
|
||||
image:
|
||||
distribution: "debian"
|
||||
|
||||
source:
|
||||
downloader: debootstrap
|
||||
url: http://192.168.2.83/deb.debian.org/debian
|
||||
keys:
|
||||
- 0x126C0D24BD8A2942CC7DF8AC7638D0442B90D010
|
||||
- 0xA1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553
|
||||
- 0x6D33866EDD8FFA41C0143AEDDCC9EFBF77E11517
|
||||
- 0x80D15823B7FD1561F9F7BCDDDC30D7C23CBBABEE
|
||||
variant: minbase
|
||||
|
||||
targets:
|
||||
lxc:
|
||||
create-message: |-
|
||||
You just created a {{ image.description }} container.
|
||||
|
||||
To enable SSH, run: apt install openssh-server
|
||||
No default root or user password are set by LXC.
|
||||
|
||||
config:
|
||||
- type: all
|
||||
before: 5
|
||||
content: |-
|
||||
lxc.include = LXC_TEMPLATE_CONFIG/debian.common.conf
|
||||
|
||||
- type: user
|
||||
before: 5
|
||||
content: |-
|
||||
lxc.include = LXC_TEMPLATE_CONFIG/debian.userns.conf
|
||||
|
||||
- type: all
|
||||
after: 4
|
||||
content: |-
|
||||
lxc.include = LXC_TEMPLATE_CONFIG/common.conf
|
||||
|
||||
- type: user
|
||||
after: 4
|
||||
content: |-
|
||||
lxc.include = LXC_TEMPLATE_CONFIG/userns.conf
|
||||
- type: all
|
||||
content: |-
|
||||
lxc.arch = {{ image.architecture_personality }}
|
||||
|
||||
files:
|
||||
- path: /etc/hostname
|
||||
generator: hostname
|
||||
|
||||
- path: /etc/hosts
|
||||
generator: hosts
|
||||
|
||||
- path: /etc/resolvconf/resolv.conf.d/original
|
||||
generator: remove
|
||||
|
||||
- path: /etc/resolvconf/resolv.conf.d/tail
|
||||
generator: remove
|
||||
|
||||
- path: /etc/machine-id
|
||||
generator: dump
|
||||
|
||||
- path: /var/lib/dbus/machine-id
|
||||
generator: remove
|
||||
|
||||
- path: /etc/network/interfaces
|
||||
generator: dump
|
||||
content: |-
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
|
||||
source /etc/network/interfaces.d/*
|
||||
types:
|
||||
- container
|
||||
|
||||
packages:
|
||||
manager: apt
|
||||
update: true
|
||||
cleanup: true
|
||||
sets:
|
||||
- packages:
|
||||
- dialog
|
||||
- ifupdown
|
||||
- init
|
||||
- iproute2
|
||||
- iputils-ping
|
||||
- isc-dhcp-client
|
||||
- locales
|
||||
- netbase
|
||||
- net-tools
|
||||
- openssh-client
|
||||
- procps
|
||||
action: install
|
||||
- packages:
|
||||
- nano
|
||||
action: install
|
||||
variants:
|
||||
- default
|
||||
|
||||
repositories:
|
||||
- name: sources.list
|
||||
url: |-
|
||||
deb http://deb.debian.org/debian {{ image.release }} main
|
||||
{% if image.release != "sid" and image.release != "bullseye" and not (image.release == "wheezy" and image.architecture_mapped == "powerpc") and not (image.release == "wheezy" and image.architecture_mapped == "s390x") %}deb http://security.debian.org/debian-security {{ image.release }}/updates main{% endif %}
|
||||
|
||||
actions:
|
||||
- trigger: post-unpack
|
||||
action: |-
|
||||
#!/bin/sh
|
||||
echo 'Acquire::http::Proxy "http://192.168.2.83:80";' > /etc/apt/apt.conf.d/01prox
|
||||
echo '#Acquire::http::Proxy "http://192.168.200.60:80";' >> /etc/apt/apt.conf.d/01prox
|
||||
|
||||
- trigger: post-packages
|
||||
action: |-
|
||||
#!/bin/sh
|
||||
set -eux
|
||||
|
||||
# Disable networkd (unused)
|
||||
systemctl mask systemd-networkd.service
|
||||
systemctl mask systemd-networkd.socket
|
||||
systemctl mask systemd-networkd-wait-online.service
|
||||
|
||||
# Make sure the locale is built and functional
|
||||
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
|
||||
locale-gen en_US.UTF-8 UTF-8
|
||||
update-locale LANG=en_US.UTF-8
|
||||
|
||||
# Cleanup underlying /run
|
||||
mount -o bind / /mnt
|
||||
rm -rf /mnt/run/*
|
||||
umount /mnt
|
||||
|
||||
# Cleanup temporary shadow paths
|
||||
rm /etc/*-
|
||||
|
||||
mappings:
|
||||
architecture_map: debian
|
||||
Reference in New Issue
Block a user