Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioning slem #15422

Merged
merged 3 commits into from Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
67 changes: 67 additions & 0 deletions data/microos/butane/config.fcc
@@ -0,0 +1,67 @@
variant: fcos
version: 1.1.0
passwd:
users:
- name: root
password_hash: $6$eEm2HpuzI7dfE4i7$dbYiTRLhrqVvwryR7zmMEcnrp13IqZ3mzLbsx9EeHAX7849PibGVgX5vdPuaeYYIO7hVfcboI9/JDpGiDZhHf/
- name: bernhard
password_hash: $6$eEm2HpuzI7dfE4i7$dbYiTRLhrqVvwryR7zmMEcnrp13IqZ3mzLbsx9EeHAX7849PibGVgX5vdPuaeYYIO7hVfcboI9/JDpGiDZhHf/
uid: 1001
gecos: Bernhard M. Wiedemann
- name: HomelessTester
uid: 2002
no_create_home: true
primary_group: geekos
groups:
- users
- geekos
groups:
- name: geekos
gid: 2002
systemd:
units:
- name: sshd.service
enabled: true
mask: false
- name: create_test_file.service
enabled: true
contents: |
[Unit]
Description=Just a Test!
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/touch /var/log/flagfile
[Install]
WantedBy=multi-user.target
storage:
disks:
- device: /dev/vdc
wipe_table: true
partitions:
- number: 1
label: testing_part
filesystems:
- path: /home
device: /dev/disk/by-partlabel/testing_part
format: ext4
wipe_filesystem: true
with_mount_unit: true
label: home
files:
- path: /etc/hostname
overwrite: true
contents:
inline: cucaracha
- path: /home/bernhard/testdir/hello
overwrite: true
mode: 0600
user:
name: bernhard
contents:
inline: Hello there!
directories:
- path: /home/bernhard/testdir
mode: 0755
user:
name: bernhard
81 changes: 81 additions & 0 deletions data/microos/butane/script
@@ -0,0 +1,81 @@
#!/bin/bash
# combustion: network
# Redirect output to the console
exec > >(exec tee -a /dev/console) 2>&1
set -eux

#
### drives and filesystems
#
DRIVE='/dev/vdc'
PART='/dev/vdc1'

# create partition and filesystem on additional drive
echo "label: gpt" | sfdisk "$DRIVE"
echo "name=testing_part" | sfdisk /dev/vdc -N1

# label new partition for testing and create labeled ext4
mkfs.ext4 -L home "$PART"

# mount new partition
mount -t ext4 "$PART" /home

# DEBUG
blkid
lsblk

#
### users and groups
# groups
groupadd --gid 2002 geekos

# users
echo 'root:$6$eEm2HpuzI7dfE4i7$dbYiTRLhrqVvwryR7zmMEcnrp13IqZ3mzLbsx9EeHAX7849PibGVgX5vdPuaeYYIO7hVfcboI9/JDpGiDZhHf/' | chpasswd -e
useradd --no-create-home --uid 2002 --gid geekos --groups users HomelessTester
useradd --create-home --uid 1001 --comment "Bernhard M. Wiedemann" --no-user-group --gid users bernhard
echo 'bernhard:$6$eEm2HpuzI7dfE4i7$dbYiTRLhrqVvwryR7zmMEcnrp13IqZ3mzLbsx9EeHAX7849PibGVgX5vdPuaeYYIO7hVfcboI9/JDpGiDZhHf/' | chpasswd -e

#
### files and directories
#
echo "cucaracha" > /etc/hostname
mkdir --mode=0755 /home/bernhard/testdir
chown bernhard:users /home/bernhard/testdir
echo "Hello there!" > /home/bernhard/testdir/hello
chown bernhard:users /home/bernhard/testdir/hello
chmod 0600 /home/bernhard/testdir/hello

#
### systemd units
#
cat << EOF > /etc/systemd/system/create_test_file.service
[Unit]
Description=Just a Test!
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/touch /var/log/flagfile
[Install]
WantedBy=multi-user.target
EOF

cat << EOF > /etc/systemd/system/home.mount
Vogtinator marked this conversation as resolved.
Show resolved Hide resolved
[Unit]
Before=local-fs.target
Requires=systemd-fsck@dev-disk-by\x2dpartlabel-testing_part.service
After=systemd-fsck@dev-disk-by\x2dpartlabel-testing_part.service

[Mount]
Where=/home
What=/dev/disk/by-partlabel/testing_part
Type=ext4

[Install]
RequiredBy=local-fs.target
EOF

systemctl enable sshd.service
systemctl enable create_test_file.service

echo Combustion was here > /usr/share/combustion-welcome
curl conncheck.opensuse.org
6 changes: 5 additions & 1 deletion schedule/sle-micro/raw_image.yaml
Expand Up @@ -46,7 +46,10 @@ conditional_schedule:
- microos/disk_boot
'combustion+ignition':
- microos/disk_boot

image_customization:
TEST_PROVISIONING:
'1':
- microos/verify_setup
schedule:
- '{{boot}}'
- transactional/host_config
Expand All @@ -56,6 +59,7 @@ schedule:
- '{{maintenance}}'
- '{{selinux}}'
- '{{k3s}}'
- '{{image_customization}}'
- microos/networking
- microos/libzypp_config
- microos/image_checks
Expand Down
8 changes: 8 additions & 0 deletions tests/microos/disk_boot.pm
Expand Up @@ -31,4 +31,12 @@ sub test_flags {
return {fatal => 1};
}

sub post_fail_hook {
assert_screen 'emergency-mode';
grisu48 marked this conversation as resolved.
Show resolved Hide resolved
send_key 'ret';
enter_cmd "echo '##### initramfs logs #####'> /dev/$serialdev";
script_run "cat /run/initramfs/rdsosreport.txt > /dev/$serialdev ";
enter_cmd "echo '##### END #####'> /dev/$serialdev";
}

mloviska marked this conversation as resolved.
Show resolved Hide resolved
1;