-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(wip): allow finch to build on Linux without Lima Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix Makefile Signed-off-by: Justin Alvarez <alvajus@amazon.com> * refactor lima_cmd_creator => nerdctl_cmd_creator Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix some refactoring/renaming misses Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix unit tests Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix linting Signed-off-by: Justin Alvarez <alvajus@amazon.com> * remove unnecessary mockgen call Signed-off-by: Justin Alvarez <alvajus@amazon.com> * remove unused code Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix windows unit tests Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix linux linting errors Signed-off-by: Justin Alvarez <alvajus@amazon.com> * refactor to use standard Linux config path Signed-off-by: Justin Alvarez <alvajus@amazon.com> * update docs Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix shared settings not being inlined Signed-off-by: Justin Alvarez <alvajus@amazon.com> * refactor support bundles to only export files that would be relevant on Linux Signed-off-by: Justin Alvarez <alvajus@amazon.com> * update build guards Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix FinchRootDir Signed-off-by: Justin Alvarez <alvajus@amazon.com> * refactor cmd/nerdctl for Linux Signed-off-by: Justin Alvarez <alvajus@amazon.com> * refactor nerdctl to use custom paths for buildkit socket and nerdctl.toml Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix linting Signed-off-by: Justin Alvarez <alvajus@amazon.com> * automatically set the NATIVE_BUILD parameter if using Linux since that's the only supported config Signed-off-by: Justin Alvarez <alvajus@amazon.com> * allow GITCOMMIT to be overwritten to make RPM builds easier Signed-off-by: Justin Alvarez <alvajus@amazon.com> * finch-general => finch-all Signed-off-by: Justin Alvarez <alvajus@amazon.com> * main_local.go => main_native.go Signed-off-by: Justin Alvarez <alvajus@amazon.com> * remove ensureCredentials check in native mode Signed-off-by: Justin Alvarez <alvajus@amazon.com> * virtual_machine_local.go => virtual_machine_native.go Signed-off-by: Justin Alvarez <alvajus@amazon.com> * ensure all remote only tests have _remote suffix Signed-off-by: Justin Alvarez <alvajus@amazon.com> * prepend path to vended buildkit binaries for Fedora-based systems Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix Makefile not handling default case for NATIVE_BUILD not on Linux Signed-off-by: Justin Alvarez <alvajus@amazon.com> * simplify makefile Signed-off-by: Justin Alvarez <alvajus@amazon.com> * rename variable Signed-off-by: Justin Alvarez <alvajus@amazon.com> * add native build tag Signed-off-by: Justin Alvarez <alvajus@amazon.com> * update NerdctlCmdCreator comment Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix Makefile for non-native builds Signed-off-by: Justin Alvarez <alvajus@amazon.com> * remove native build tag and simplify platform separation Signed-off-by: Justin Alvarez <alvajus@amazon.com> * remove unnecessary remote in names Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix unit tests Signed-off-by: Justin Alvarez <alvajus@amazon.com> * fix BuildkitSocketPath Signed-off-by: Justin Alvarez <alvajus@amazon.com> --------- Signed-off-by: Justin Alvarez <alvajus@amazon.com>
- Loading branch information
Showing
103 changed files
with
2,625 additions
and
2,328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build linux | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
|
||
"github.com/spf13/afero" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/runfinch/finch/pkg/command" | ||
"github.com/runfinch/finch/pkg/config" | ||
"github.com/runfinch/finch/pkg/flog" | ||
"github.com/runfinch/finch/pkg/lima/wrapper" | ||
"github.com/runfinch/finch/pkg/path" | ||
"github.com/runfinch/finch/pkg/support" | ||
"github.com/runfinch/finch/pkg/system" | ||
"github.com/runfinch/finch/pkg/version" | ||
) | ||
|
||
var newApp = func( | ||
logger flog.Logger, | ||
fp path.Finch, | ||
fs afero.Fs, | ||
fc *config.Finch, | ||
stdOut io.Writer, | ||
_, | ||
finchRootPath string, | ||
ecc command.Creator, | ||
) *cobra.Command { | ||
usage := fmt.Sprintf("%v <command>", finchRootCmd) | ||
rootCmd := &cobra.Command{ | ||
Use: usage, | ||
Short: "Finch: open-source container development tool", | ||
SilenceUsage: true, | ||
SilenceErrors: true, | ||
Version: version.Version, | ||
} | ||
// TODO: Decide when to forward --debug to the dependencies | ||
// (e.g. nerdctl for container commands and limactl for VM commands). | ||
rootCmd.PersistentFlags().Bool("debug", false, "running under debug mode") | ||
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, _ []string) error { | ||
// running commands under debug mode will print out debug logs | ||
debugMode, _ := cmd.Flags().GetBool("debug") | ||
if debugMode { | ||
logger.SetLevel(flog.Debug) | ||
} | ||
return nil | ||
} | ||
|
||
ncc := command.NewNerdctlCmdCreator(ecc, | ||
logger, | ||
fp.NerdctlConfigFilePath(finchRootPath), | ||
fp.BuildkitSocketPath(), | ||
fp.FinchDependencyBinDir(), | ||
system.NewStdLib(), | ||
) | ||
lima := wrapper.NewLimaWrapper() | ||
supportBundleBuilder := support.NewBundleBuilder( | ||
logger, | ||
fs, | ||
support.NewBundleConfig(fp, finchRootPath), | ||
fp, | ||
ecc, | ||
ncc, | ||
lima, | ||
) | ||
|
||
// append nerdctl commands | ||
allCommands := initializeNerdctlCommands(ncc, ecc, logger, fs, fc) | ||
// append finch specific commands | ||
allCommands = append(allCommands, | ||
newVersionCommand(ncc, logger, stdOut), | ||
newSupportBundleCommand(logger, supportBundleBuilder, ncc), | ||
newGenDocsCommand(rootCmd, logger, fs, system.NewStdLib()), | ||
) | ||
|
||
rootCmd.AddCommand(allCommands...) | ||
|
||
return rootCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build darwin || windows | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
|
||
"github.com/spf13/afero" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/runfinch/finch/pkg/command" | ||
"github.com/runfinch/finch/pkg/config" | ||
"github.com/runfinch/finch/pkg/flog" | ||
"github.com/runfinch/finch/pkg/lima/wrapper" | ||
"github.com/runfinch/finch/pkg/path" | ||
"github.com/runfinch/finch/pkg/support" | ||
"github.com/runfinch/finch/pkg/system" | ||
"github.com/runfinch/finch/pkg/version" | ||
) | ||
|
||
var newApp = func( | ||
logger flog.Logger, | ||
fp path.Finch, | ||
fs afero.Fs, | ||
fc *config.Finch, | ||
stdOut io.Writer, | ||
home, | ||
finchRootPath string, | ||
ecc command.Creator, | ||
) *cobra.Command { | ||
usage := fmt.Sprintf("%v <command>", finchRootCmd) | ||
rootCmd := &cobra.Command{ | ||
Use: usage, | ||
Short: "Finch: open-source container development tool", | ||
SilenceUsage: true, | ||
SilenceErrors: true, | ||
Version: version.Version, | ||
} | ||
// TODO: Decide when to forward --debug to the dependencies | ||
// (e.g. nerdctl for container commands and limactl for VM commands). | ||
rootCmd.PersistentFlags().Bool("debug", false, "running under debug mode") | ||
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, _ []string) error { | ||
// running commands under debug mode will print out debug logs | ||
debugMode, _ := cmd.Flags().GetBool("debug") | ||
if debugMode { | ||
logger.SetLevel(flog.Debug) | ||
} | ||
return nil | ||
} | ||
|
||
ncc := command.NewNerdctlCmdCreator(ecc, | ||
logger, | ||
fp.LimaHomePath(), | ||
fp.LimactlPath(), | ||
fp.QEMUBinDir(), | ||
system.NewStdLib(), | ||
) | ||
lima := wrapper.NewLimaWrapper() | ||
supportBundleBuilder := support.NewBundleBuilder( | ||
logger, | ||
fs, | ||
support.NewBundleConfig(fp, finchRootPath), | ||
fp, | ||
ecc, | ||
ncc, | ||
lima, | ||
) | ||
|
||
// append nerdctl commands | ||
allCommands := initializeNerdctlCommands(ncc, ecc, logger, fs, fc) | ||
// append finch specific commands | ||
allCommands = append(allCommands, | ||
newVersionCommand(ncc, logger, stdOut), | ||
virtualMachineCommands(logger, fp, ncc, ecc, fs, fc, home, finchRootPath), | ||
newSupportBundleCommand(logger, supportBundleBuilder, ncc), | ||
newGenDocsCommand(rootCmd, logger, fs, system.NewStdLib()), | ||
) | ||
|
||
rootCmd.AddCommand(allCommands...) | ||
|
||
return rootCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.