Skip to content

Commit

Permalink
Merge pull request #215 from covexo/mac-issues
Browse files Browse the repository at this point in the history
Mac issues
  • Loading branch information
FabianKramm authored Sep 17, 2018
2 parents 5906bab + b6ff7ff commit 6748c06
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 52 deletions.
16 changes: 8 additions & 8 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@
[[override]]
name = "github.com/sirupsen/logrus"
version = "v1.0.6"

[[override]]
name = "github.com/Nvveen/Gotty"
source = "https://github.com/ijc25/Gotty.git"
revision = "a8b993ba6abdb0e0c12b0125c603323a71c7790c"

[prune]
go-tests = true
Expand Down
94 changes: 50 additions & 44 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,11 @@ func (cmd *UpCmd) buildImages(buildFlagChanged bool) bool {
if randErr != nil {
log.Fatalf("Image building failed: %s", randErr.Error())
}
registryConf, registryErr := registry.GetRegistryConfig(imageConf)

if registryErr != nil {
log.Fatal(registryErr)
registryConf, err := registry.GetRegistryConfig(imageConf)
if err != nil {
log.Fatal(err)
}
var buildErr error

var imageBuilder builder.Interface

buildInfo := "Building image '%s' with engine '%s'"
Expand All @@ -332,70 +331,77 @@ func (cmd *UpCmd) buildImages(buildFlagChanged bool) bool {
if registryConf.Insecure != nil {
allowInsecurePush = *registryConf.Insecure
}
imageBuilder, buildErr = kaniko.NewBuilder(registryURL, *imageConf.Name, imageTag, buildNamespace, cmd.kubectl, allowInsecurePush)
imageBuilder, err = kaniko.NewBuilder(registryURL, *imageConf.Name, imageTag, buildNamespace, cmd.kubectl, allowInsecurePush)
if err != nil {
log.Fatalf("Error creating kaniko builder: %v", err)
}
} else {
engineName = "docker"
preferMinikube := true

if imageConf.Build.Engine.Docker.PreferMinikube != nil {
preferMinikube = *imageConf.Build.Engine.Docker.PreferMinikube
}
imageBuilder, buildErr = docker.NewBuilder(registryURL, *imageConf.Name, imageTag, preferMinikube)

imageBuilder, err = docker.NewBuilder(registryURL, *imageConf.Name, imageTag, preferMinikube)
if err != nil {
log.Fatalf("Error creating docker client: %v", err)
}
}

log.Infof(buildInfo, imageName, engineName)

if buildErr == nil {
username := ""
password := ""
registryURL := ""
username := ""
password := ""

if registryConf.URL != nil {
registryURL = *registryConf.URL
if registryConf.URL != nil {
registryURL = *registryConf.URL
}
if registryConf.Auth != nil {
if registryConf.Auth.Username != nil {
username = *registryConf.Auth.Username
}
if registryConf.Auth != nil {
if registryConf.Auth.Username != nil {
username = *registryConf.Auth.Username
}

if registryConf.Auth.Password != nil {
password = *registryConf.Auth.Password
}
if registryConf.Auth.Password != nil {
password = *registryConf.Auth.Password
}
log.StartWait("Authenticating (" + registryURL + ")")
_, buildErr = imageBuilder.Authenticate(username, password, len(username) == 0)
log.StopWait()

if buildErr == nil {
log.Done("Authentication successful (" + registryURL + ")")
buildOptions := &types.ImageBuildOptions{}

if imageConf.Build.Options != nil {
if imageConf.Build.Options.BuildArgs != nil {
buildOptions.BuildArgs = *imageConf.Build.Options.BuildArgs
}
}
buildErr = imageBuilder.BuildImage(contextPath, dockerfilePath, buildOptions)
}

if buildErr == nil {
buildErr = imageBuilder.PushImage()
log.StartWait("Authenticating (" + registryURL + ")")
_, err = imageBuilder.Authenticate(username, password, len(username) == 0)
log.StopWait()

if buildErr == nil {
log.Info("Image pushed to registry (" + registryURL + ")")
}
}
if err != nil {
log.Fatalf("Error during image registry authentication: %v", err)
}

log.Done("Authentication successful (" + registryURL + ")")

buildOptions := &types.ImageBuildOptions{}
if imageConf.Build.Options != nil {
if imageConf.Build.Options.BuildArgs != nil {
buildOptions.BuildArgs = *imageConf.Build.Options.BuildArgs
}
}

if buildErr != nil {
log.Fatalf("Image building failed: %s", buildErr.Error())
err = imageBuilder.BuildImage(contextPath, dockerfilePath, buildOptions)
if err != nil {
log.Fatalf("Error during image build: %v", err)
}
imageConf.Tag = &imageTag

err := configutil.SaveConfig()
err = imageBuilder.PushImage()
if err != nil {
log.Fatalf("Error during image push: %v", err)
}

log.Info("Image pushed to registry (" + registryURL + ")")
imageConf.Tag = &imageTag

err = configutil.SaveConfig()
if err != nil {
log.Fatalf("Config saving error: %s", err.Error())
}

log.Done("Done building and pushing image '" + imageName + "'")
} else {
log.Infof("Skip building image '%s'", imageName)
Expand Down

0 comments on commit 6748c06

Please sign in to comment.