2022-02-10 17:27:00 +00:00
|
|
|
def defaultOSConfigure(vm)
|
2022-06-13 20:36:26 +00:00
|
|
|
box = vm.box.to_s
|
|
|
|
if box.include?("generic/ubuntu")
|
2022-06-14 15:40:29 +00:00
|
|
|
vm.provision "Set DNS", type: "shell", inline: "netplan set ethernets.eth0.nameservers.addresses=[8.8.8.8,1.1.1.1]; netplan apply", run: 'once'
|
2022-06-13 20:36:26 +00:00
|
|
|
vm.provision "Install jq", type: "shell", inline: "apt install -y jq"
|
|
|
|
elsif box.include?("Leap") || box.include?("Tumbleweed")
|
|
|
|
vm.provision "Install jq", type: "shell", inline: "zypper install -y jq"
|
2022-08-26 18:42:04 +00:00
|
|
|
vm.provision "Install apparmor-parser", type: "shell", inline: "zypper install -y apparmor-parser"
|
2022-08-26 16:36:13 +00:00
|
|
|
elsif box.include?("rocky8") || box.include?("rocky9")
|
|
|
|
vm.provision "Install jq", type: "shell", inline: "dnf install -y jq"
|
|
|
|
vm.provision "Disable firewall", type: "shell", inline: "systemctl stop firewalld"
|
|
|
|
elsif box.include?("centos7")
|
|
|
|
vm.provision "Install jq", type: "shell", inline: "yum install -y jq"
|
|
|
|
vm.provision "Disable firewall", type: "shell", inline: "systemctl stop firewalld"
|
2022-06-13 20:36:26 +00:00
|
|
|
elsif box.include?("alpine")
|
|
|
|
vm.provision "Install tools", type: "shell", inline: "apk add jq coreutils"
|
|
|
|
elsif box.include?("microos")
|
|
|
|
vm.provision "Install jq", type: "shell", inline: "transactional-update pkg install -y jq"
|
|
|
|
vm.provision 'reload', run: 'once'
|
|
|
|
end
|
2022-06-14 15:40:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def getInstallType(vm, release_version, branch)
|
|
|
|
if release_version == "skip"
|
|
|
|
install_type = "INSTALL_K3S_SKIP_DOWNLOAD=true"
|
|
|
|
elsif !release_version.empty?
|
|
|
|
return "INSTALL_K3S_VERSION=#{release_version}"
|
|
|
|
else
|
2022-06-15 00:50:11 +00:00
|
|
|
scripts_location = Dir.exists?("./scripts") ? "./scripts" : "../scripts"
|
2022-06-14 15:40:29 +00:00
|
|
|
# Grabs the last 5 commit SHA's from the given branch, then purges any commits that do not have a passing CI build
|
|
|
|
# MicroOS requires it not be in a /tmp/ or other root system folder
|
2022-06-15 00:50:11 +00:00
|
|
|
vm.provision "Get latest commit", type: "shell", path: scripts_location +"/latest_commit.sh", args: [branch, "/tmp/k3s_commits"]
|
2022-06-14 15:40:29 +00:00
|
|
|
return "INSTALL_K3S_COMMIT=$(head\ -n\ 1\ /tmp/k3s_commits)"
|
|
|
|
end
|
2022-07-29 21:56:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def dockerInstall(vm)
|
|
|
|
vm.provider "libvirt" do |v|
|
|
|
|
v.memory = NODE_MEMORY + 1024
|
|
|
|
end
|
|
|
|
vm.provider "virtualbox" do |v|
|
|
|
|
v.memory = NODE_MEMORY + 1024
|
|
|
|
end
|
2023-01-18 17:34:52 +00:00
|
|
|
box = vm.box.to_s
|
|
|
|
if box.include?("ubuntu")
|
2022-08-31 22:40:17 +00:00
|
|
|
vm.provision "shell", inline: "apt update; apt install -y docker.io"
|
2023-01-18 17:34:52 +00:00
|
|
|
elsif box.include?("Leap")
|
2022-07-29 21:56:02 +00:00
|
|
|
vm.provision "shell", inline: "zypper install -y docker apparmor-parser"
|
2023-01-18 17:34:52 +00:00
|
|
|
elsif box.include?("microos")
|
2022-07-29 21:56:02 +00:00
|
|
|
vm.provision "shell", inline: "transactional-update pkg install -y docker apparmor-parser"
|
|
|
|
vm.provision 'docker-reload', type: 'reload', run: 'once'
|
|
|
|
vm.provision "shell", inline: "systemctl enable --now docker"
|
2023-01-18 17:34:52 +00:00
|
|
|
elsif box.include?("rocky8") || box.include?("rocky9")
|
|
|
|
vm.provision "shell", inline: "dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo"
|
|
|
|
vm.provision "shell", inline: "dnf install -y docker-ce"
|
2022-07-29 21:56:02 +00:00
|
|
|
end
|
|
|
|
end
|