echo "FLAVOR LABELS" > /etc/jenkins-agent/labels
echo "127.0.0.1 $(hostname)" >> /etc/hosts
echo "FLOATING" > /etc/jenkins-agent/description
- service jenkins-swarm-agent restart
+ systemctl enable jenkins-swarm-agent
+ #service jenkins-swarm-agent start
+ apt update
+ sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT=\).*$/\1\"console=tty1 console=ttyS0 noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier\"/g' /etc/default/grub.d/50-cloudimg-settings.cfg
+ apt install -y linux-generic-hwe-16.04 linux-tools-generic-hwe-16.04 linux-cloud-tools-generic-hwe-16.04 linux-tools-common
+ update-grub
+
wc_notify --data-binary '{"status": "SUCCESS"}'
+ reboot
params:
FLAVOR: {get_param: flavor}
LABELS: {get_param: jenkins_labels}
echo "LABELS" > /etc/jenkins-agent/labels
echo "127.0.0.1 $(hostname)" >> /etc/hosts
echo "FLOATING" > /etc/jenkins-agent/description
- service jenkins-swarm-agent restart
+
+ apt update
+ sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT=\).*$/\1\"console=tty1 console=ttyS0 noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier\"/g' /etc/default/grub.d/50-cloudimg-settings.cfg
+ apt install -y linux-generic-hwe-16.04 linux-tools-generic-hwe-16.04 linux-cloud-tools-generic-hwe-16.04 linux-tools-common
+ update-grub
+
+ systemctl enable jenkins-swarm-agent
wc_notify --data-binary '{"status": "SUCCESS"}'
+ reboot
params:
LABELS: {get_param: jenkins_labels}
wc_notify: { get_attr: [wait_handle, curl_cli] }
echo "FLAVOR LABELS" > /etc/jenkins-agent/labels
echo "127.0.0.1 $(hostname)" >> /etc/hosts
echo "FLOATING" > /etc/jenkins-agent/description
- service jenkins-swarm-agent restart
+
+ apt update
+ sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT=\).*$/\1\"console=tty1 console=ttyS0 noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier\"/g' /etc/default/grub.d/50-cloudimg-settings.cfg
+ apt install -y linux-generic-hwe-16.04 linux-tools-generic-hwe-16.04 linux-cloud-tools-generic-hwe-16.04 linux-tools-common
+ update-grub
+
+ systemctl enable jenkins-swarm-agent
wc_notify --data-binary '{"status": "SUCCESS"}'
+ reboot
params:
FLAVOR: {get_param: flavor}
LABELS: {get_param: jenkins_labels}
EOF
chmod +x /home/jenkins/launch_jenkins_agent.sh
+# service jenkins-swarm-agent must be "enable"d in heat template
cat > /etc/systemd/system/jenkins-swarm-agent.service << EOF
[Unit]
Description=jenkins-swarm-agent
[Install]
WantedBy=cloud-init.target
EOF
-systemctl enable jenkins-swarm-agent
shopt -s dotglob
chown -R jenkins:jenkins /home/jenkins/
EOF
chmod +x /home/jenkins/launch_jenkins_agent.sh
+# service jenkins-swarm-agent must be "enable"d in heat template
cat > /etc/systemd/system/jenkins-swarm-agent.service << EOF
[Unit]
Description=jenkins-swarm-agent
[Install]
WantedBy=cloud-init.target
EOF
-systemctl enable jenkins-swarm-agent
pg_version=$(dpkg-query --show --showformat='${version;3}' postgresql)
pg_createcluster $pg_version main --start || true
fi
echo "${UPDATE_SCRIPT?} will be used for image building"
-if [[ ! -f /tmp/xenial-server-cloudimg-amd64-disk1.img ]] ; then
- wget -q https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img -O /tmp/xenial-server-cloudimg-amd64-disk1.img
- cp /tmp/xenial-server-cloudimg-amd64-disk1.img xenial-server-cloudimg-amd64-disk1.img
+if [[ ! -f /home/jenkins/xenial-server-cloudimg-amd64-disk1.img.bpk ]] ; then
+ wget -q https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img -O /home/jenkins/xenial-server-cloudimg-amd64-disk1.img.bpk
+ cp /home/jenkins/xenial-server-cloudimg-amd64-disk1.img.bpk xenial-server-cloudimg-amd64-disk1.img
else
- cp /tmp/xenial-server-cloudimg-amd64-disk1.img xenial-server-cloudimg-amd64-disk1.img
+ cp /home/jenkins/xenial-server-cloudimg-amd64-disk1.img.bpk xenial-server-cloudimg-amd64-disk1.img
fi
# collect maintenance team ssh keys from reclass-system
sudo mount /dev/nbd0p1 /mnt/image
sudo mount --bind /dev /mnt/image/dev
sudo mount --bind /proc /mnt/image/proc
+sudo mount --bind /sys /mnt/image/sys
sudo mv /mnt/image/etc/resolv.conf /mnt/image/etc/resolv.conf.bak
sudo cp -f /etc/resolv.conf /mnt/image/etc/resolv.conf
sudo rm -rf /mtn/image/tmp/*
sudo umount -l /mnt/image/dev/
sudo umount -l /mnt/image/proc/
+sudo umount -l /mnt/image/sys/
sudo umount -l /mnt/image
sudo qemu-nbd -d /dev/nbd0
sudo rm -rf /mnt/image