Skip to content

Commit

Permalink
Sanity check after failed build
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelgrzeda committed Jul 9, 2020
1 parent d6612bf commit 26d6b53
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions backend/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ var (
defaultEC2ImageSelectorType = "env"
defaultEC2SSHUserName = "travis"
defaultEC2ExecCmd = "bash ~/build.sh"
defaultEC2SubnetID = ""
defaultEC2InstanceType = "t2.micro"
defaultEC2Image = "ami-02790d1ebf3b5181d"
defaultEC2SecurityGroupIDs = "default"
defaultEC2EBSOptimized = false
defaultEC2DiskSize = int64(8)
Expand Down Expand Up @@ -124,7 +122,7 @@ func newEC2Provider(cfg *config.ProviderConfig) (Provider, error) {
}
sshDialTimeout = sd
}
customTags := make(map[string]string, 0)
customTags := make(map[string]string)
if cfg.IsSet("CUSTOM_TAGS") {
items := strings.Split(cfg.Get("CUSTOM_TAGS"), ",")
for _, tag := range items {
Expand Down Expand Up @@ -612,28 +610,6 @@ func (i *ec2Instance) UploadScript(ctx gocontext.Context, script []byte) error {
//return i.uploadScriptAttempt(ctx, script)
}

func (i *ec2Instance) waitForSSH(port, timeout int) error {

host := *i.instance.PrivateIpAddress
if i.provider.publicIPConnect {
host = *i.instance.PublicIpAddress
}

iter := 0
for {
_, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", host, port), 1*time.Second)
if err == nil {
break
}
iter = iter + 1
if iter > timeout {
return err
}
time.Sleep(500 * time.Millisecond)
}
return nil
}

func (i *ec2Instance) uploadScriptAttempt(ctx gocontext.Context, script []byte) error {
return i.uploadScriptSCP(ctx, script)
}
Expand Down

0 comments on commit 26d6b53

Please sign in to comment.