fix: improve git url parsing and deployment

- Improve the parsing of Git URLs to correctly handle paths and branches.
- Fix an issue where the `griddriver` installer was not correctly
- installed.
- Fix a bug in the `IPAddress` `ping` function.
- Update the `GitLocation` struct to correctly handle branches and
- tags.
- Fix a bug in the `GitRepo` `checkout` function.
- Improve the `gitlocation_from_url` function to handle various Git
- URL formats.
- Update the `livekit` installer to use the correct source command.
- Update the `golang` installer to use the correct `go version`
- command.
- Update the `griddriver` installer to use the correct version
- command.

Co-authored-by: supermario <mariobassem12@gmail.com>
This commit is contained in:
Mahmoud Emad
2025-01-02 13:35:36 +02:00
parent 36f41150c2
commit 2e14b7b7af
13 changed files with 209 additions and 269 deletions

View File

@@ -10,8 +10,7 @@ import os
// checks if a certain version or above is installed
fn installed_() !bool {
res := os.execute('${osal.profile_path_source_and()!} go version')
res := os.execute('/bin/bash -c "go version"')
if res.exit_code == 0 {
r := res.output.split_into_lines()
.filter(it.contains('go version'))

View File

@@ -1,11 +1,8 @@
module golang
import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.sysadmin.startupmanager
import freeflowuniverse.herolib.osal.zinit
import time
import freeflowuniverse.herolib.ui.console
__global (
golang_global map[string]&GolangInstaller
@@ -14,29 +11,66 @@ __global (
/////////FACTORY
@[params]
pub struct ArgsGet {
pub mut:
name string
}
pub fn get(args_ ArgsGet) !&GolangInstaller {
return &GolangInstaller{}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////# LIVE CYCLE MANAGEMENT FOR INSTALLERS ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
fn startupmanager_get(cat zinit.StartupManagerType) !startupmanager.StartupManager {
// unknown
// screen
// zinit
// tmux
// systemd
match cat {
.zinit {
console.print_debug('startupmanager: zinit')
return startupmanager.get(cat: .zinit)!
}
.systemd {
console.print_debug('startupmanager: systemd')
return startupmanager.get(cat: .systemd)!
}
else {
console.print_debug('startupmanager: auto')
return startupmanager.get()!
}
}
}
@[params]
pub struct InstallArgs {
pub mut:
reset bool
}
pub fn install(args InstallArgs) ! {
if args.reset {
destroy()!
}
if !(installed_()!) {
pub fn (mut self GolangInstaller) install(args InstallArgs) ! {
switch(self.name)
if args.reset || (!installed_()!) {
install_()!
}
}
pub fn destroy() ! {
pub fn (mut self GolangInstaller) build() ! {
switch(self.name)
build_()!
}
pub fn (mut self GolangInstaller) destroy() ! {
switch(self.name)
destroy_()!
}
pub fn build() ! {
build_()!
// switch instance to be used for golang
pub fn switch(name string) {
golang_default = name
}