Added Fedora, fixed cache script and did some cleanup
* Added Alpine 3.21 to the jenkinsfile * Added Debian Trixe(13) to the jenkinsfile * Fixed broken cache script Alpine edge builds * Added Fedora (41) distro * Cleaned-up Debian.yaml
This commit is contained in:
3
.vscode/tasks.json
vendored
3
.vscode/tasks.json
vendored
@@ -37,7 +37,8 @@
|
||||
"description": "Wich Distro shoud be used",
|
||||
"options": [
|
||||
"Debian",
|
||||
"Alpine"
|
||||
"Alpine",
|
||||
"Fedora"
|
||||
],
|
||||
"default": "Debian"
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ pipeline {
|
||||
string defaultValue: '192.168.200.11', description: 'Proxy server for packages, when enabled', name: 'ProxyServer'
|
||||
booleanParam description: 'will disable use of proxy server', name: 'DisProxy'
|
||||
checkboxParameter(name: 'ImgVersionList', format: 'JSON', displayNodePath: "//Versions/Version", valueNodePath: "//Versions/Version", description: 'Select the vesions(s) that should be build',
|
||||
pipelineSubmitContent: '{"Versions": [{"Version": "3.17"},{"Version": "3.18"},{"Version": "3.19"},{"Version": "3.20"},{"Version": "edge"}]}')
|
||||
pipelineSubmitContent: '{"Versions": [{"Version": "3.17"},{"Version": "3.18"},{"Version": "3.19"},{"Version": "3.20"},{"Version": "3.21"},{"Version": "edge"}]}')
|
||||
}
|
||||
options {
|
||||
skipDefaultCheckout()
|
||||
|
||||
@@ -270,13 +270,13 @@ packages:
|
||||
url: |-
|
||||
#StartREPOS
|
||||
{% if image.release != "edge" %}
|
||||
http://dl-4.alpinelinux.org/alpine/v{{ image.release }}/main
|
||||
http://dl-4.alpinelinux.org/alpine/v{{ image.release }}/community
|
||||
https://dl-4.alpinelinux.org/alpine/v{{ image.release }}/main
|
||||
https://dl-4.alpinelinux.org/alpine/v{{ image.release }}/community
|
||||
{% endif %}
|
||||
{% if image.release == "edge" %}
|
||||
http://dl-4.alpinelinux.org/alpine/{{ image.release }}/main
|
||||
http://dl-4.alpinelinux.org/alpine/{{ image.release }}/community
|
||||
#http://dl-4.alpinelinux.org/alpine/{{ image.release }}/testing
|
||||
https://dl-4.alpinelinux.org/alpine/edge/main
|
||||
https://dl-4.alpinelinux.org/alpine/edge/community
|
||||
#https://dl-4.alpinelinux.org/alpine/edge/testing
|
||||
{% endif %}
|
||||
#EndREPOS
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ pipeline {
|
||||
string defaultValue: '192.168.200.11', description: 'Proxy server for packages, when enabled', name: 'ProxyServer'
|
||||
booleanParam description: 'will disable use of proxy server', name: 'DisProxy'
|
||||
checkboxParameter(name: 'ImgVersionList', format: 'JSON', displayNodePath: "//Versions/Version", valueNodePath: "//Versions/Version", description: 'Select the vesions(s) that should be build',
|
||||
pipelineSubmitContent: '{"Versions": [{"Version": "bookworm"},{"Version": "bullseye"}]}')
|
||||
pipelineSubmitContent: '{"Versions": [{"Version": "bullseye"},{"Version": "bookworm"},{"Version": "trixie"}]}')
|
||||
}
|
||||
options {
|
||||
skipDefaultCheckout()
|
||||
|
||||
@@ -74,14 +74,6 @@ files:
|
||||
types:
|
||||
- container
|
||||
|
||||
- path: /etc/sudoers.d/imgbuilder
|
||||
generator: dump
|
||||
content: |-
|
||||
Defaults env_keep += "XZ_DEFAULTS"
|
||||
jenkins ALL=(root:root)NOPASSWD:/bin/chown,/home/jenkins/workspace/*/*/*/*/*/*/*/*/distrobuilder,/home/jenkins/workspace/*/*/distrobuilder,/home/jenkins/workspace/*/distrobuilder
|
||||
variants:
|
||||
- imgbuilder
|
||||
|
||||
#Unattended-Upgrade configuration
|
||||
- path: /etc/apt/apt.conf.d/50unattended-upgrades
|
||||
generator: dump
|
||||
@@ -105,9 +97,6 @@ files:
|
||||
Unattended-Upgrade::InstallOnShutdown "false";
|
||||
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
|
||||
Unattended-Upgrade::Remove-Unused-Dependencies "true";
|
||||
//Unattended-Upgrade::Automatic-Reboot "true";
|
||||
//Unattended-Upgrade::Automatic-Reboot-WithUsers "true";
|
||||
//Unattended-Upgrade::Automatic-Reboot-Time "02:00";
|
||||
Unattended-Upgrade::SyslogEnable "true";
|
||||
|
||||
- path: /etc/apt/apt.conf.d/20auto-upgrades
|
||||
|
||||
81
CT-Build/Fedora.Jenkinsfile
Normal file
81
CT-Build/Fedora.Jenkinsfile
Normal file
@@ -0,0 +1,81 @@
|
||||
pipeline {
|
||||
agent { label 'LXCBuilder' }
|
||||
parameters {
|
||||
booleanParam description: 'Will only update Jenkins piplinefile (jenkinsfile)', name: 'OnlyUpdatePipeline'
|
||||
booleanParam defaultValue: true, description: 'Enable muticore support for ZX compression', name: 'ZX_Multicore'
|
||||
string defaultValue: '0', description: 'Set amount of core\'s ZX is allowed when compressing (use 0 for all cores)', name: 'ZX_Cores'
|
||||
string defaultValue: '192.168.200.11', description: 'Proxy server for packages, when enabled', name: 'ProxyServer'
|
||||
booleanParam description: 'will disable use of proxy server', name: 'DisProxy'
|
||||
checkboxParameter(name: 'ImgVersionList', format: 'JSON', displayNodePath: "//Versions/Version", valueNodePath: "//Versions/Version", description: 'Select the vesions(s) that should be build',
|
||||
pipelineSubmitContent: '{"Versions": [{"Version": "41"},{"Version": "Rawhide"}]}')
|
||||
}
|
||||
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: 'distrobuilder-BrampCustom', fingerprintArtifacts: true, flatten: true, projectName: 'LXC-ImgBuilder/DistroBuilder', selector: lastSuccessful()
|
||||
// Setup Env
|
||||
sh '''mkdir $WORKSPACE/REL
|
||||
mv distrobuilder-* distrobuilder
|
||||
'''
|
||||
//Check if Proxy is disabled
|
||||
script{
|
||||
if (env.DisProxy == 'true') {
|
||||
sh '''bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -d'''
|
||||
} else {
|
||||
env.ProxyServer = ProxyServer
|
||||
sh '''bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -e $ProxyServer'''
|
||||
}
|
||||
if (env.OnlyUpdatePipeline == 'true') {
|
||||
error 'Build ended early, only updated jenkins file'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Image Configs'){
|
||||
steps{
|
||||
script{
|
||||
//Run build for requested Versions
|
||||
for(ImgVersion in ImgVersionList.split(',')){
|
||||
env.ZX_Multicore = ZX_Multicore
|
||||
env.ZX_Cores = ZX_Cores
|
||||
env.ImgVersion = ImgVersion
|
||||
stage("Build ${ImgVersion}") {
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
||||
sh '''
|
||||
if $ZX_Multicore; then
|
||||
export XZ_DEFAULTS="-T $ZX_Cores"
|
||||
fi
|
||||
sudo $WORKSPACE/distrobuilder build-lxc CT-Build/Fedora.yaml $WORKSPACE/REL/$ImgVersion/ -o image.release=$ImgVersion
|
||||
sudo chown jenkins:jenkins -R $WORKSPACE/REL
|
||||
mv $WORKSPACE/REL/$ImgVersion/rootfs.tar.xz Fedora-$ImgVersion.tar.xz
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Finish') {
|
||||
steps {
|
||||
// Save generated files
|
||||
archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false
|
||||
// Copy artifacts to /LXCBuild folder
|
||||
sh '''
|
||||
mkdir -p /LXCBuild/template/cache
|
||||
cp -f *.tar.xz /LXCBuild/template/cache
|
||||
'''
|
||||
// Cleaning WorkSpace when build successfully
|
||||
cleanWs cleanWhenAborted: false, cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
157
CT-Build/Fedora.yaml
Normal file
157
CT-Build/Fedora.yaml
Normal file
@@ -0,0 +1,157 @@
|
||||
image:
|
||||
distribution: fedora
|
||||
|
||||
source:
|
||||
downloader: fedora-http
|
||||
url: https://kojipkgs.fedoraproject.org
|
||||
|
||||
targets:
|
||||
lxc:
|
||||
#create_message: |
|
||||
# You just created a {{ image.description }} container.
|
||||
config:
|
||||
- type: all
|
||||
before: 5
|
||||
content: |-
|
||||
lxc.include = LXC_TEMPLATE_CONFIG/fedora.common.conf
|
||||
|
||||
- type: user
|
||||
before: 5
|
||||
content: |-
|
||||
lxc.include = LXC_TEMPLATE_CONFIG/fedora.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_kernel }}
|
||||
|
||||
files:
|
||||
- path: /etc/machine-id
|
||||
generator: dump
|
||||
|
||||
- path: /etc/fstab
|
||||
generator: dump
|
||||
types:
|
||||
- container
|
||||
|
||||
- path: /var/lib/dbus/machine-id
|
||||
generator: remove
|
||||
|
||||
- path: /etc/hostname
|
||||
generator: hostname
|
||||
|
||||
- path: /etc/hosts
|
||||
generator: hosts
|
||||
|
||||
#dnf-automatic configuration
|
||||
- path: /etc/dnf/automatic.conf
|
||||
generator: dump
|
||||
content: |-
|
||||
apply_updates = yes
|
||||
download_updates = yes
|
||||
upgrade_type = security
|
||||
|
||||
|
||||
packages:
|
||||
manager: dnf
|
||||
update: true
|
||||
cleanup: true
|
||||
sets:
|
||||
- packages:
|
||||
- cpio
|
||||
- file
|
||||
- findutils
|
||||
- fipscheck
|
||||
- gettext
|
||||
- glibc-all-langpacks
|
||||
- hardlink
|
||||
- hostname
|
||||
- ipcalc
|
||||
- iproute
|
||||
- iproute-tc
|
||||
- iputils
|
||||
- kbd
|
||||
- kmod
|
||||
- openssh-clients
|
||||
- passwd
|
||||
- policycoreutils
|
||||
- procps-ng
|
||||
- systemd-udev
|
||||
- which
|
||||
- dnf-automatic
|
||||
action: install
|
||||
|
||||
- packages:
|
||||
- libsss_idmap
|
||||
- libsss_nss_idmap
|
||||
- sssd-client
|
||||
action: remove
|
||||
|
||||
actions:
|
||||
- trigger: post-unpack
|
||||
action: |-
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
# Increase connection timeout
|
||||
echo timeout=60 >> /etc/dnf/dnf.conf
|
||||
|
||||
# Let dnf find the fastest mirror
|
||||
echo fastestmirror=True >> /etc/dnf/dnf.conf
|
||||
|
||||
#ProxyCacheSetting
|
||||
echo '#CacheServer not set' >> /etc/dnf/dnf.conf
|
||||
|
||||
# Backup all repo files
|
||||
for repo in $(ls /etc/yum.repos.d/*.repo); do
|
||||
cp "${repo}" "${repo}.bak"
|
||||
done
|
||||
|
||||
- trigger: post-unpack
|
||||
action: |-
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
# Use Fedora 38 GPG key to avoid package installation errors
|
||||
for repo in $(ls /etc/yum.repos.d/*.repo); do
|
||||
grep -q 'RPM-GPG-KEY-fedora-38' "${repo}" && continue
|
||||
|
||||
sed -ri 's#^gpgkey=.*#\0 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-38-$basearch#g' "${repo}"
|
||||
done
|
||||
architectures:
|
||||
- aarch64
|
||||
- x86_64
|
||||
releases:
|
||||
- Rawhide
|
||||
|
||||
- trigger: post-packages
|
||||
action: |-
|
||||
#!/bin/sh
|
||||
umount -l /etc/resolv.conf || true
|
||||
rm /etc/resolv.conf
|
||||
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||
systemctl enable systemd-resolved
|
||||
cp -R /etc/skel/.bash* /root/
|
||||
|
||||
systemctl enable dnf-automatic.timer
|
||||
|
||||
- trigger: post-files
|
||||
action: |-
|
||||
#!/bin/sh
|
||||
set -eux
|
||||
|
||||
# Restore repos
|
||||
for repo in $(ls /etc/yum.repos.d/*.bak); do
|
||||
mv "${repo}" ${repo%.*}
|
||||
done
|
||||
@@ -23,6 +23,7 @@ fi
|
||||
CacheAlpineRepo="http://$UseServer/alpine/"
|
||||
CacheDebianCache="http://$UseServer:80"
|
||||
CacheDebianCore="http://$UseServer/deb.debian.org/debian"
|
||||
CacheFedoraCache="http://$UseServer:80"
|
||||
|
||||
#Check if using StatusFlag if not chek if scipt is configured
|
||||
if [ -n "$StatusFlag" ]; then
|
||||
@@ -43,11 +44,13 @@ if [ $UseCache = yes ]; then
|
||||
AlpineRepo=$CacheAlpineRepo
|
||||
DebianCache='Acquire::http::Proxy "'$CacheDebianCache'";'
|
||||
DebianCore=$CacheDebianCore
|
||||
FedoraCache='proxy = "'$CacheFedoraCache'"'
|
||||
elif [ $UseCache = no ]; then
|
||||
echo "Not using cache server"
|
||||
AlpineRepo=$DefaultAlpineRepo
|
||||
DebianCache='#CacheServer not set'
|
||||
DebianCore=$DefaultDebianCore
|
||||
FedoraCache='#CacheServer not set'
|
||||
fi
|
||||
|
||||
#Goto ProjectRoot
|
||||
@@ -61,7 +64,7 @@ sed -i -e '/#InitDownloadREPO/a \ url: '$DefaultAlpineRepo'' CT-Build/Alpine.ya
|
||||
|
||||
#AlpineRepo
|
||||
sed -i -n '/#StartREPOS/{:a;N;/#EndREPOS/!ba;N;s/.*\n/#HereREPO\n/};p' CT-Build/Alpine.yaml
|
||||
sed -i -e 's#\#HereREPO#\ \#StartREPOS\n\ '$AlpineRepo'v{{ image.release }}/main\n\ '$AlpineRepo'v{{ image.release }}/community\n\ \#EndREPOS#g' CT-Build/Alpine.yaml
|
||||
sed -i -e 's#\#HereREPO#\ \#StartREPOS\n\ {% if image.release != "edge" %}\n\ '$AlpineRepo'v{{ image.release }}/main\n\ '$AlpineRepo'v{{ image.release }}/community\n\ {% endif %}\n\ {% if image.release == "edge" %}\n\ '$AlpineRepo'edge/main\n\ '$AlpineRepo'edge/community\n\ \#'$AlpineRepo'edge/testing\n\ {% endif %}\n\ \#EndREPOS#g' CT-Build/Alpine.yaml
|
||||
|
||||
#DebianBaseRepo
|
||||
sed -i -e '/#InitDownloadREPO/{n;d}' CT-Build/Debian.yaml
|
||||
@@ -70,3 +73,7 @@ sed -i -e '/#InitDownloadREPO/a \ url: '$DebianCore'' CT-Build/Debian.yaml
|
||||
#DebianProxyCache
|
||||
sed -i -e '/#ProxyCacheSetting/{n;d}' CT-Build/Debian.yaml
|
||||
sed -i -e "/#ProxyCacheSetting/a \ echo \'$DebianCache\' > /etc/apt/apt.conf.d/01prox" CT-Build/Debian.yaml
|
||||
|
||||
#FedoraProxyCache
|
||||
sed -i -e '/#ProxyCacheSetting/{n;d}' CT-Build/Fedora.yaml
|
||||
sed -i -e "/#ProxyCacheSetting/a \ echo \'$FedoraCache\' >> /etc/dnf/dnf.conf" CT-Build/Fedora.yaml
|
||||
|
||||
Reference in New Issue
Block a user