Skip to content

feat: send logs using agent api v2 if available #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! eblog -> log
  • Loading branch information
johnstcn committed Jul 5, 2024
commit 847476e943c92f2f40a75c0d640cdde6f8e16219
12 changes: 6 additions & 6 deletions envbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1191,20 +1191,20 @@ func findDevcontainerJSON(options Options) (string, string, error) {

// maybeDeleteFilesystem wraps util.DeleteFilesystem with a guard to hopefully stop
// folks from unwittingly deleting their entire root directory.
func maybeDeleteFilesystem(log log.Func, force bool) error {
func maybeDeleteFilesystem(logger log.Func, force bool) error {
kanikoDir, ok := os.LookupEnv("KANIKO_DIR")
if !ok || strings.TrimSpace(kanikoDir) != MagicDir {
if force {
bailoutSecs := 10
log(log.LevelWarn, "WARNING! BYPASSING SAFETY CHECK! THIS WILL DELETE YOUR ROOT FILESYSTEM!")
log(log.LevelWarn, "You have %d seconds to bail out!", bailoutSecs)
logger(log.LevelWarn, "WARNING! BYPASSING SAFETY CHECK! THIS WILL DELETE YOUR ROOT FILESYSTEM!")
logger(log.LevelWarn, "You have %d seconds to bail out!", bailoutSecs)
for i := bailoutSecs; i > 0; i-- {
log(log.LevelWarn, "%d...", i)
logger(log.LevelWarn, "%d...", i)
<-time.After(time.Second)
}
} else {
log(log.LevelError, "KANIKO_DIR is not set to %s. Bailing!\n", MagicDir)
log(log.LevelError, "To bypass this check, set FORCE_SAFE=true.")
logger(log.LevelError, "KANIKO_DIR is not set to %s. Bailing!\n", MagicDir)
logger(log.LevelError, "To bypass this check, set FORCE_SAFE=true.")
return errors.New("safety check failed")
}
}
Expand Down
4 changes: 2 additions & 2 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ func ReadPrivateKey(path string) (gossh.Signer, error) {

// LogHostKeyCallback is a HostKeyCallback that just logs host keys
// and does nothing else.
func LogHostKeyCallback(log log.Func) gossh.HostKeyCallback {
func LogHostKeyCallback(logger log.Func) gossh.HostKeyCallback {
return func(hostname string, remote net.Addr, key gossh.PublicKey) error {
var sb strings.Builder
_ = knownhosts.WriteKnownHost(&sb, hostname, remote, key)
// skeema/knownhosts uses a fake public key to determine the host key
// algorithms. Ignore this one.
if s := sb.String(); !strings.Contains(s, "fake-public-key ZmFrZSBwdWJsaWMga2V5") {
log(log.LevelInfo, "#1: 🔑 Got host key: %s", strings.TrimSpace(s))
logger(log.LevelInfo, "#1: 🔑 Got host key: %s", strings.TrimSpace(s))
}
return nil
}
Expand Down