Drop uneeded stuff

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
Itxaka 2023-07-19 14:03:37 +02:00
parent a296b96af5
commit 3938a66c56
4 changed files with 8 additions and 78 deletions

View File

@ -15,7 +15,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: earthly/actions/setup-earthly@v1
- uses: earthly/actions-setup@v1.0.7
- name: Checkout code
uses: actions/checkout@v3
with:

View File

@ -82,13 +82,6 @@ func (b *BuildISOAction) ISORun() (err error) {
}
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...)
if err != nil {
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...")
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...)
if err != nil {
b.cfg.Logger.Errorf("Failed installing ISO image packages: %v", err)

View File

@ -1,14 +1,6 @@
package config
import (
"fmt"
"io"
"io/fs"
"os"
"reflect"
"runtime"
"strings"
"github.com/kairos-io/enki/internal/version"
"github.com/kairos-io/enki/pkg/constants"
"github.com/kairos-io/enki/pkg/utils"
@ -21,7 +13,12 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"
"github.com/twpayne/go-vfs"
"io"
"io/fs"
"k8s.io/mount-utils"
"os"
"reflect"
"runtime"
)
var decodeHook = viper.DecodeHook(
@ -118,8 +115,6 @@ func ReadConfigBuild(configDir string, flags *pflag.FlagSet, mounter mount.Inter
// Bind buildconfig 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
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
bindGivenFlags(vp, flags)
// Bind build-iso env vars
viperReadEnv(vp, "ISO", constants.GetISOKeyEnvMap())
err := vp.Unmarshal(iso, setDecoder, decodeHook)
if err != nil {
@ -166,19 +159,6 @@ func NewBuildConfig(opts ...GenericOptions) *v1.BuildConfig {
Config: *NewConfig(opts...),
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
}
@ -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 {
log.Debugf("Starting enki version %s on commit %s", v.Version, v.GitCommit)
} else {
log.Infof("Starting enki version %s", v.Version)
log.Debugf("%+v\n", version.Get())
}
}
@ -323,22 +301,3 @@ func UnmarshalerHook() mapstructure.DecodeHookFunc {
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))
}
}

View File

@ -14,8 +14,6 @@ const (
EfiFs = "vfat"
IsoRootFile = "rootfs.squashfs"
IsoEFIPath = "/boot/uefi.img"
LuetDefaultRepoURI = "quay.io/costoolkit/releases-green"
LuetDefaultRepoPrio = 90
BuildImgName = "elemental"
EfiBootPath = "/EFI/BOOT"
GrubEfiImagex86 = "/usr/share/grub2/x86_64-efi/grub.efi"
@ -124,16 +122,3 @@ func GetXorrisoBooloaderArgs(root string) []string {
}
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{}
}