Files
sos_testing/lxd_profile_deb.yaml
T
2024-10-30 21:22:30 +00:00

297 lines
10 KiB
YAML

devices:
eth0:
name: eth0
network: lxdbr0
type: nic
root:
path: /
pool: virtual
type: disk
config:
user.user-data: |
#cloud-config
packages:
- python3-pip
- tox
- dh-python
- sbuild-debian-developer-setup
- devscripts
- piuparts
- equivs
write_files:
- path: /root/setup.sh
permissions: '0755'
owner: root:root
content: |
#!bin/bash
sudo apt update --allow-releaseinfo-change
sudo apt -y purge sosreport
- path: /root/.sbuildrc
owner: root:root
content: |
$chroot_mode = 'unshare';
#$run_autopkgtest = 1;
$autopkgtest_root_args = '';
$autopkgtest_opts = [ '--apt-upgrade', '--', 'unshare', '--release', '%r', '--arch', '%a' ];
- path: /root/.sbuildrc_sbuild
owner: root:root
content: |
# Name to use as override in .changes files for the Maintainer: field
# (mandatory, no default!).
$maintainer_name='Arif Ali <arif.ali@canonical.com>';
$uploader_name = 'Arif Ali <arif.ali@canonical.com>';
# Default distribution to build.
#$distribution = "unstable";
# Default chroot (defaults to distribution[-arch][-sbuild])
#$chroot = 'unstable-amd64-sbuild';
# Build arch-all by default.
$build_arch_all = 1;
$build_source = 1;
# --source-only-changes (applicable for dput. irrelevant for dgit push-source).
$source_only_changes = 1;
# By default, the -s option only includes the .orig.tar.gz when needed
# (i.e. when the Debian revision is 0 or 1). By setting this option
# to 1, the .orig.tar.gz will always be included when -s is used.
# This is equivalent to --force-orig-source.
$force_orig_source = 0;
# Verbose (-v)
$verbose = 1;
# Parallel build
$ENV{'DEB_BUILD_OPTIONS'} = 'parallel=4';
# Time to wait for a source dependency lock. The default is 1 minute.
my $srcdep_lock_wait = 1; # 1 minute
$run_lintian = 1;
$lintian_opts = ['-v', '-i', '-I', '-E', '--pedantic'];
$run_piuparts = 1;
$piuparts_opts = ['--schroot', '%r-%a-sbuild', '--no-eatmydata'];
$run_autopkgtest = 1;
$autopkgtest_root_args = '';
$autopkgtest_opts = [ '--', 'schroot', '%r-%a-sbuild' ];
# When to purge the build directory afterwards; possible values are "never",
# "successful", and "always". "always" is the default. It can be helpful
# to preserve failing builds for debugging purposes. Switch these comments
# if you want to preserve even successful builds, and then use
# "schroot -e --all-sessions" to clean them up manually.
$purge_build_directory = 'successful';
$purge_session = 'successful';
$purge_build_deps = 'successful';
# Directory for writing build logs to
$log_dir=$ENV{HOME}."/Development/builder/debian/sbuild_logs";
# don't remove this, Perl needs it:
1;
- path: /root/.sbuildrc_unshare
owner: root:root
content: |
$chroot_mode = 'unshare';
$external_commands = { "build-failed-commands" => [ [ '%SBUILD_SHELL' ] ] };
# Build arch-all by default.
$build_arch_all = 1;
$build_source = 1;
# --source-only-changes (applicable for dput. irrelevant for dgit push-source).
$source_only_changes = 1;
# By default, the -s option only includes the .orig.tar.gz when needed
# (i.e. when the Debian revision is 0 or 1). By setting this option
# to 1, the .orig.tar.gz will always be included when -s is used.
# This is equivalent to --force-orig-source.
$force_orig_source = 0;
# Verbose (-v)
$verbose = 1;
# Parallel build
$ENV{'DEB_BUILD_OPTIONS'} = 'parallel=12';
# Time to wait for a source dependency lock. The default is 1 minute.
my $srcdep_lock_wait = 1; # 1 minute
$run_lintian = 1;
$lintian_opts = ['-v', '-i', '-I', '--pedantic', '--profile=debian'];
$run_piuparts = 1;
$piuparts_root_args = ['PATH=/usr/sbin:/usr/bin:/sbin:/bin', 'unshare', '--pid', '--fork', '--mount-proc', '--map-root-user', '--map-auto'];
$piuparts_opts = ["--basetgz=$HOME/.cache/sbuild/%r-%a.tar.zst", '--fake-essential-packages=systemd-sysv', '--distribution=%r'];
$run_autopkgtest = 1;
$autopkgtest_root_args = '';
$autopkgtest_opts = [ '--apt-upgrade', '--', 'unshare', '--release', '%r', '--arch', '%a' ];
# When to purge the build directory afterwards; possible values are "never",
# "successful", and "always". "always" is the default. It can be helpful
# to preserve failing builds for debugging purposes. Switch these comments
# if you want to preserve even successful builds, and then use
# "schroot -e --all-sessions" to clean them up manually.
$purge_build_directory = 'successful';
$purge_session = 'successful';
$purge_build_deps = 'successful';
# Directory for writing build logs to
$log_dir=$ENV{HOME}."/Development/temporary/sbuild_logs";
# don't remove this, Perl needs it:
1;
- path: /root/deb_build_check.sh
permissions: '0755'
owner: root:root
content: |
#!bin/bash
LICENSECHECK=0
PBUILDER=0
LINTIAN=0
REPROTEST=0
SBUILD=0
SBUILD_UNSHARE=1
prod="${1}"
rm -rf /root/${prod} ~/.cache/sbuild
mkdir -p ~/.cache/sbuild /root/${prod}
cd /root/${prod}
tar xfz ../${prod}.tgz
series=$(head -n 1 debian/changelog | awk '{print $3}' | sed 's/;//g')
if [[ $LICENSECHECK -eq 1 ]] ; then
apt -y install licenserecon
lrc | tee /root/license-check.log
fi
export EMAIL="Some One <some.one@canonical.com>"
export DEBEMAIL="Some One <some.one@canonical.com>"
uscan --download-current-version --rename
dpkg-buildpackage -S -d
mk-build-deps
apt -y install ./*${prod}-build-deps*.deb
dpkg-buildpackage -b -us -uc -rfakeroot -m
rm -rf ./*${prod}-build-deps*
if [[ $PBUILDER -eq 1 ]] ; then
apt install -y pbuilder
pbuilder create
pbuilder build --twice ../*${prod}*.dsc \
| tee /root/pbuilder.log
fi
if [[ $LINTIAN -eq 1 ]] ; then
apt -y install lintian
lintian -v -i -I -E --pedantic --profile debian ../*${prod}*.dsc \
| tee /root/lintian-dsc.log
lintian -v -i -I -E --pedantic --profile debian ../*${prod}*.changes \
| tee /root/lintian-changes.log
lintian -v -i -I -E --pedantic --profile debian ../*${prod}*.buildinfo \
| tee /root/lintian-buildinfo.log
fi
if [[ $REPROTEST -eq 1 ]] ; then
apt install -y reprotest
chroot="${series}-amd64-sbuild"
sbuild-createchroot --include=eatmydata,ccache ${series} /srv/chroot/${chroot}
reprotest --print-sudoers \
--variations=user_group.available+=guest-builder,domain_host.use_sudo=1 \
| EDITOR=tee visudo -f /etc/sudoers.d/local-reprotest
echo "/etc/sudoers.d/local-reprotest /etc/sudoers.d/local-reprotest none bind 0 0" \
| tee -a /srv/chroot/${chroot}/etc/fstab
cd -
reprotest --vary=-build_path,domain_host.use_sudo=1 --auto-build ./*${prod}*.dsc -- schroot ${chroot} \
| tee /root/reprotest.log
rm -rf /srv/chroot/${chroot}
fi
if [[ $SBUILD -eq 1 ]] ; then
apt install -y sbuild mmdebstrap uidmap
cd /root/${prod}
cp /root/.sbuildrc_sbuild /root/.sbuildrc
mmdebstrap --variant=buildd unstable ~/.cache/sbuild/${series}-amd64.tar.zst
echo "$(id -un):120000:65536" | sudo tee -a /etc/subuid /etc/subgid
sbuild | tee /root/sbuild.log
cd -
fi
if [[ $SBUILD_UNSHARE -eq 1 ]] ; then
apt install -y sbuild mmdebstrap uidmap
cd /root/${prod}
cp /root/.sbuildrc_unshare /root/.sbuildrc
mmdebstrap --variant=buildd unstable ~/.cache/sbuild/${series}-amd64.tar.zst
echo "$(id -un):120000:65536" | sudo tee -a /etc/subuid /etc/subgid
sbuild | tee /root/sbuild_unshare.log
cd -
fi
cd /root
tar cf build-logs-${prod}.tgz *.log
- path: /root/enable_proposed.sh
permissions: '0755'
owner: root:root
content: |
#!bin/bash
echo "Enabling proposed repo ..."
sudo sed -i 's/# suite disabled by cloud-init: //g' /etc/apt/sources.list
sudo apt update
- path: /root/run_avocado.sh
permissions: '0755'
owner: root:root
content: |
#!bin/bash
mkdir -p /root/sos
cd /root/sos
tar xfz ../sos.tgz
git config --global --add safe.directory /root/sos
mkdir -p /etc/sos
cp sos.conf /etc/sos/sos.conf
echo "Cleaning up any old .tox environments ..."
rm -rf .tox
echo "Running Unit Tests ..."
tox -e unit_tests
echo "Running Stage One Tests ..."
tox -e stageone_tests
echo "Running Stage Two Tests ..."
tox -e stagetwo_tests
- path: /root/run_sos.sh
permissions: '0755'
owner: root:root
content: |
#!bin/bash
sos report -a --all-logs --batch
runcmd:
- [ /root/setup.sh ]