mirror of
https://github.com/kairos-io/osbuilder.git
synced 2025-07-05 11:16:17 +00:00
Drop uneeded stuff
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
parent
a296b96af5
commit
3938a66c56
2
.github/workflows/enki.yml
vendored
2
.github/workflows/enki.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: earthly/actions/setup-earthly@v1
|
- uses: earthly/actions-setup@v1.0.7
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
@ -82,13 +82,6 @@ func (b *BuildISOAction) ISORun() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
b.cfg.Logger.Infof("Preparing EFI image...")
|
b.cfg.Logger.Infof("Preparing EFI image...")
|
||||||
if b.spec.BootloaderInRootFs {
|
|
||||||
err = b.PrepareEFI(rootDir, uefiDir)
|
|
||||||
if err != nil {
|
|
||||||
b.cfg.Logger.Errorf("Failed fetching EFI data: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = b.applySources(uefiDir, b.spec.UEFI...)
|
err = b.applySources(uefiDir, b.spec.UEFI...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.cfg.Logger.Errorf("Failed installing EFI packages: %v", err)
|
b.cfg.Logger.Errorf("Failed installing EFI packages: %v", err)
|
||||||
@ -96,13 +89,6 @@ func (b *BuildISOAction) ISORun() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
b.cfg.Logger.Infof("Preparing ISO image root tree...")
|
b.cfg.Logger.Infof("Preparing ISO image root tree...")
|
||||||
if b.spec.BootloaderInRootFs {
|
|
||||||
err = b.PrepareISO(rootDir, isoDir)
|
|
||||||
if err != nil {
|
|
||||||
b.cfg.Logger.Errorf("Failed fetching bootloader binaries: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = b.applySources(isoDir, b.spec.Image...)
|
err = b.applySources(isoDir, b.spec.Image...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.cfg.Logger.Errorf("Failed installing ISO image packages: %v", err)
|
b.cfg.Logger.Errorf("Failed installing ISO image packages: %v", err)
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/fs"
|
|
||||||
"os"
|
|
||||||
"reflect"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/kairos-io/enki/internal/version"
|
"github.com/kairos-io/enki/internal/version"
|
||||||
"github.com/kairos-io/enki/pkg/constants"
|
"github.com/kairos-io/enki/pkg/constants"
|
||||||
"github.com/kairos-io/enki/pkg/utils"
|
"github.com/kairos-io/enki/pkg/utils"
|
||||||
@ -21,7 +13,12 @@ import (
|
|||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"github.com/twpayne/go-vfs"
|
"github.com/twpayne/go-vfs"
|
||||||
|
"io"
|
||||||
|
"io/fs"
|
||||||
"k8s.io/mount-utils"
|
"k8s.io/mount-utils"
|
||||||
|
"os"
|
||||||
|
"reflect"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
var decodeHook = viper.DecodeHook(
|
var decodeHook = viper.DecodeHook(
|
||||||
@ -118,8 +115,6 @@ func ReadConfigBuild(configDir string, flags *pflag.FlagSet, mounter mount.Inter
|
|||||||
|
|
||||||
// Bind buildconfig flags
|
// Bind buildconfig flags
|
||||||
bindGivenFlags(viper.GetViper(), flags)
|
bindGivenFlags(viper.GetViper(), flags)
|
||||||
// merge environment variables on top for rootCmd
|
|
||||||
viperReadEnv(viper.GetViper(), "BUILD", constants.GetBuildKeyEnvMap())
|
|
||||||
|
|
||||||
// unmarshal all the vars into the config object
|
// unmarshal all the vars into the config object
|
||||||
err := viper.Unmarshal(cfg, setDecoder, decodeHook)
|
err := viper.Unmarshal(cfg, setDecoder, decodeHook)
|
||||||
@ -140,8 +135,6 @@ func ReadBuildISO(b *v1.BuildConfig, flags *pflag.FlagSet) (*v1.LiveISO, error)
|
|||||||
}
|
}
|
||||||
// Bind build-iso cmd flags
|
// Bind build-iso cmd flags
|
||||||
bindGivenFlags(vp, flags)
|
bindGivenFlags(vp, flags)
|
||||||
// Bind build-iso env vars
|
|
||||||
viperReadEnv(vp, "ISO", constants.GetISOKeyEnvMap())
|
|
||||||
|
|
||||||
err := vp.Unmarshal(iso, setDecoder, decodeHook)
|
err := vp.Unmarshal(iso, setDecoder, decodeHook)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -166,19 +159,6 @@ func NewBuildConfig(opts ...GenericOptions) *v1.BuildConfig {
|
|||||||
Config: *NewConfig(opts...),
|
Config: *NewConfig(opts...),
|
||||||
Name: constants.BuildImgName,
|
Name: constants.BuildImgName,
|
||||||
}
|
}
|
||||||
if len(b.Repos) == 0 {
|
|
||||||
repo := constants.LuetDefaultRepoURI
|
|
||||||
if b.Arch != constants.Archx86 {
|
|
||||||
repo = fmt.Sprintf("%s-%s", constants.LuetDefaultRepoURI, b.Arch)
|
|
||||||
}
|
|
||||||
b.Repos = []v1.Repository{{
|
|
||||||
Name: "cos",
|
|
||||||
Type: "docker",
|
|
||||||
URI: repo,
|
|
||||||
Arch: b.Arch,
|
|
||||||
Priority: constants.LuetDefaultRepoPrio,
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,11 +246,9 @@ func configLogger(log v1.Logger, vfs v1.FS) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v := version.Get()
|
log.Infof("Starting enki version %s", version.GetVersion())
|
||||||
if log.GetLevel() == logrus.DebugLevel {
|
if log.GetLevel() == logrus.DebugLevel {
|
||||||
log.Debugf("Starting enki version %s on commit %s", v.Version, v.GitCommit)
|
log.Debugf("%+v\n", version.Get())
|
||||||
} else {
|
|
||||||
log.Infof("Starting enki version %s", v.Version)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,22 +301,3 @@ func UnmarshalerHook() mapstructure.DecodeHookFunc {
|
|||||||
return to.Interface(), err
|
return to.Interface(), err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func viperReadEnv(vp *viper.Viper, prefix string, keyMap map[string]string) {
|
|
||||||
// If we expect to override complex keys in the config, i.e. configs
|
|
||||||
// that are nested, we probably need to manually do the env stuff
|
|
||||||
// ourselves, as this will only match keys in the config root
|
|
||||||
replacer := strings.NewReplacer("-", "_")
|
|
||||||
vp.SetEnvKeyReplacer(replacer)
|
|
||||||
|
|
||||||
if prefix == "" {
|
|
||||||
prefix = "ELEMENTAL"
|
|
||||||
} else {
|
|
||||||
prefix = fmt.Sprintf("ELEMENTAL_%s", prefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Manually bind keys to env variable if custom names are needed.
|
|
||||||
for k, v := range keyMap {
|
|
||||||
_ = vp.BindEnv(k, fmt.Sprintf("%s_%s", prefix, v))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -14,8 +14,6 @@ const (
|
|||||||
EfiFs = "vfat"
|
EfiFs = "vfat"
|
||||||
IsoRootFile = "rootfs.squashfs"
|
IsoRootFile = "rootfs.squashfs"
|
||||||
IsoEFIPath = "/boot/uefi.img"
|
IsoEFIPath = "/boot/uefi.img"
|
||||||
LuetDefaultRepoURI = "quay.io/costoolkit/releases-green"
|
|
||||||
LuetDefaultRepoPrio = 90
|
|
||||||
BuildImgName = "elemental"
|
BuildImgName = "elemental"
|
||||||
EfiBootPath = "/EFI/BOOT"
|
EfiBootPath = "/EFI/BOOT"
|
||||||
GrubEfiImagex86 = "/usr/share/grub2/x86_64-efi/grub.efi"
|
GrubEfiImagex86 = "/usr/share/grub2/x86_64-efi/grub.efi"
|
||||||
@ -124,16 +122,3 @@ func GetXorrisoBooloaderArgs(root string) []string {
|
|||||||
}
|
}
|
||||||
return args
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBuildKeyEnvMap returns environment variable bindings to BuildConfig data
|
|
||||||
func GetBuildKeyEnvMap() map[string]string {
|
|
||||||
return map[string]string{
|
|
||||||
"name": "NAME",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetISOKeyEnvMap returns environment variable bindings to LiveISO data
|
|
||||||
func GetISOKeyEnvMap() map[string]string {
|
|
||||||
// None for the time being
|
|
||||||
return map[string]string{}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user