Skip to content

Commit

Permalink
Remove SSH connection test since Gitlab Runner provides this feature …
Browse files Browse the repository at this point in the history
…already

Gitlab Runner already provides this feature with the config option
runners.autoscaler.instance_ready_command. Let's remove it to have fewer
code an faster connections.

See https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersautoscaler-section
  • Loading branch information
baurmatt committed Dec 13, 2024
1 parent bc04acb commit 89adbfe
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions provider.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package fpoc

import (
"bytes"
"context"
"errors"
"fmt"
Expand All @@ -14,7 +13,6 @@ import (
"github.com/jinzhu/copier"
"github.com/sardinasystems/fleeting-plugin-openstack/internal/openstackclient"

"gitlab.com/gitlab-org/fleeting/fleeting/connector"
"gitlab.com/gitlab-org/fleeting/fleeting/provider"
)

Expand Down Expand Up @@ -320,28 +318,6 @@ func (g *InstanceGroup) ConnectInfo(ctx context.Context, instanceID string) (pro
info.Arch = "amd64"
}

// g.log.Debug("Info", "info", info)

inp := bytes.NewBuffer(nil)
combinedOut := bytes.NewBuffer(nil)

ropts := connector.ConnectorOptions{
DialOptions: connector.DialOptions{
// UseExternalAddr: true,
},
RunOptions: connector.RunOptions{
Command: `echo "ok"`,
Stdin: inp,
Stdout: combinedOut,
Stderr: combinedOut,
},
}
err = connector.Run(ctx, info, ropts)
if err != nil {
return provider.ConnectInfo{}, fmt.Errorf("Failed to test ssh: %w", err)
}
g.log.Debug("SSH test result", "out", combinedOut.String())

return info, nil
}

Expand Down

0 comments on commit 89adbfe

Please sign in to comment.