From e263d51aacefb781f36d3a523ce08fa0c05531f2 Mon Sep 17 00:00:00 2001
From: Katharina Renk <katharina.renk@stud.h-da.de>
Date: Thu, 1 Feb 2024 14:40:43 +0000
Subject: [PATCH] Resolve "Update go version in packer and vagrant VMs"

See merge request danet/gosdn!731
---
 lab-vm/vm-with-packer/gosdn_vm.pkr.hcl       |  2 +-
 lab-vm/vm-with-packer/scripts/gosdn_clone.sh | 14 ++++++--------
 lab-vm/vm-with-packer/scripts/setup.sh       |  6 +++---
 lab-vm/vm-with-vagrant/Vagrantfile           | 19 +++++++++----------
 4 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/lab-vm/vm-with-packer/gosdn_vm.pkr.hcl b/lab-vm/vm-with-packer/gosdn_vm.pkr.hcl
index 93679494b..2b36f90fa 100644
--- a/lab-vm/vm-with-packer/gosdn_vm.pkr.hcl
+++ b/lab-vm/vm-with-packer/gosdn_vm.pkr.hcl
@@ -21,7 +21,7 @@ source "virtualbox-iso" "baseimage" {
   gfx_controller = "vmsvga"
   gfx_vram_size  = 128
 
-  iso_url                = "https://ftp.halifax.rwth-aachen.de/ubuntu-releases/jammy/ubuntu-22.04.2-live-server-amd64.iso"
+  iso_url                = "https://ftp.halifax.rwth-aachen.de/ubuntu-releases/jammy/ubuntu-22.04.3-live-server-amd64.iso"
   iso_checksum           = "file:https://ftp.halifax.rwth-aachen.de/ubuntu-releases/jammy/SHA256SUMS"
   ssh_username           = "gosdn"
   ssh_password           = "gosdn"
diff --git a/lab-vm/vm-with-packer/scripts/gosdn_clone.sh b/lab-vm/vm-with-packer/scripts/gosdn_clone.sh
index 9bef72322..1463c1921 100644
--- a/lab-vm/vm-with-packer/scripts/gosdn_clone.sh
+++ b/lab-vm/vm-with-packer/scripts/gosdn_clone.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 source /home/gosdn/.profile
+
 # Clone goSDN
 git clone https://code.fbi.h-da.de/danet/gosdn.git
 cd ~/gosdn
@@ -9,11 +10,8 @@ git submodule update --init --recursive
 # Build goSDN
 make build
 
-# Clone gNMI-Target
-cd ~/
-git clone --branch develop https://code.fbi.h-da.de/danet/gnmi-target.git
-cd gnmi-target
-
-# Build gNMI-Target
-docker build -f target.Dockerfile .
-make container
+# Clone gNMI-Target - only use if you want to use the gnmi-target image locally
+#cd ~/
+#git clone https://code.fbi.h-da.de/danet/gnmi-target.git
+#cd gnmi-target
+#make container
diff --git a/lab-vm/vm-with-packer/scripts/setup.sh b/lab-vm/vm-with-packer/scripts/setup.sh
index 7a000f5e9..38cea0299 100644
--- a/lab-vm/vm-with-packer/scripts/setup.sh
+++ b/lab-vm/vm-with-packer/scripts/setup.sh
@@ -5,9 +5,9 @@ sudo apt update
 sudo apt upgrade -y
 
 # Install go
-wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
-sudo tar -C /usr/local/ -xzf go1.21.0.linux-amd64.tar.gz
-rm go1.21.0.linux-amd64.tar.gz
+wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz
+rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz
+rm go1.21.5.linux-amd64.tar.gz
 echo "export PATH=$PATH:/usr/local/go/bin" >>/home/gosdn/.profile
 echo "export GOPATH=$HOME/go " >>/home/gosdn/.profile
 source /home/gosdn/.profile
diff --git a/lab-vm/vm-with-vagrant/Vagrantfile b/lab-vm/vm-with-vagrant/Vagrantfile
index bd855998b..e3e3883f1 100644
--- a/lab-vm/vm-with-vagrant/Vagrantfile
+++ b/lab-vm/vm-with-vagrant/Vagrantfile
@@ -37,9 +37,9 @@ Vagrant.configure(2) do |config|
     zip
     apt-get autoremove -y
     ####### installing go #######
-    wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
-    rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
-    rm go1.21.0.linux-amd64.tar.gz
+    wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz
+    rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz
+    rm go1.21.5.linux-amd64.tar.gz
     echo 'export PATH=$PATH:/usr/local/go/bin' >> /home/vagrant/.profile
     echo 'export GOPATH=$HOME/go' >> /home/vagrant/.profile
     source /home/vagrant/.profile
@@ -58,13 +58,12 @@ Vagrant.configure(2) do |config|
     bash -c "$(curl -sL https://get.containerlab.dev)"
     ####### get gosdn repository #######
     su - vagrant -c "git clone https://code.fbi.h-da.de/danet/gosdn.git"
-    cd gosdn
-    su - vagrant -c "git submodule update --init --recursive"
+    su - vagrant -c "cd gosdn && git submodule update --init --recursive"
     su - vagrant -c "cd gosdn && make build"
-    ####### get gnmi target repository #######
-    cd ..
-    su - vagrant -c "git clone --branch develop https://code.fbi.h-da.de/danet/gnmi-target.git"
-    su - vagrant -c "cd gnmi-target && docker build -f target.Dockerfile ."
-    su - vagrant -c "cd gnmi-target && make container"
+    ####### get gnmi target repository ####### only if you want to use the gnmi-target image locally
+    #cd ..
+    #su - vagrant -c "git clone https://code.fbi.h-da.de/danet/gnmi-target.git"
+    #su - vagrant -c "cd gnmi-target && docker build -f target.Dockerfile ."
+    #su - vagrant -c "cd gnmi-target && make container"
   SHELL
 end
-- 
GitLab