Skip to content

Commit

Permalink
Merge pull request #287 from knabben/knabben/fix-gh-action
Browse files Browse the repository at this point in the history
Fixing branches filter for github actions
  • Loading branch information
knabben authored Jan 17, 2024
2 parents 552b42c + fc103c4 commit fc15b42
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
tags:
- v*
branches:
- main
- 'master'
- '*'
pull_request:
permissions:
contents: read
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
tags:
- v*
branches:
- main
- 'master'
- '*'
pull_request:
permissions:
contents: read
Expand All @@ -23,4 +24,4 @@ jobs:
pushd experiments/swdt
make test
make build
popd
popd
2 changes: 1 addition & 1 deletion experiments/swdt/cmd/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func RunKubernetes(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
defer runner.CloseConnection() //nolint
defer runner.CloseConnection() // nolint

return runner.Inner.InstallProvisioners(nodeConfig.Spec.Kubernetes.Provisioners)
}
2 changes: 1 addition & 1 deletion experiments/swdt/cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func RunSetup(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
defer runner.CloseConnection() //nolint
defer runner.CloseConnection() // nolint

// Install choco binary
if err = runner.Inner.InstallChoco(); err != nil {
Expand Down
22 changes: 14 additions & 8 deletions experiments/swdt/pkg/connections/tests/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tests
import (
"fmt"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
"log"
"net"
)
Expand Down Expand Up @@ -54,8 +54,11 @@ KaT3SUfkvAKQEAAAAOYWtuYWJiZW5AaG9ydXMBAgMEBQ==
)

func NewServer(hostname, expected string) {
var err error
config := &ssh.ServerConfig{PasswordCallback: passwordCallback}
parsePrivateKey(config, privateKey)
if err = parsePrivateKey(config, privateKey); err != nil {
log.Fatal(err)
}

listener, err := net.Listen("tcp", hostname)
if err != nil {
Expand Down Expand Up @@ -84,10 +87,13 @@ func acceptConnection(listener net.Listener, config *ssh.ServerConfig, result st

go handleRequest(requests, channel)

term := terminal.NewTerminal(channel, "")
term.Write([]byte(result))
term.ReadLine()
channel.Close()
t := term.NewTerminal(channel, "")
_, err = t.Write([]byte(result))
if err != nil {
log.Fatalf("error writing channel: %v", err)
}
t.ReadLine() // nolint
channel.Close() // nolint
}
}
}
Expand All @@ -96,9 +102,9 @@ func handleRequest(in <-chan *ssh.Request, channel ssh.Channel) {
for req := range in {
switch req.Type {
case "exec":
channel.SendRequest("exit-status", false, []byte{0, 0, 0, 0})
channel.SendRequest("exit-status", false, []byte{0, 0, 0, 0}) // nolint
}
req.Reply(req.Type == "exec", nil)
req.Reply(req.Type == "exec", nil) // nolint
}
}

Expand Down
6 changes: 4 additions & 2 deletions experiments/swdt/pkg/pwsh/executor/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ func TestMultipleExecutors(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, kubeRunner.Inner)
assert.IsType(t, kubernetes.KubernetesRunner{}, *kubeRunner.Inner)
kubeRunner.CloseConnection()
err = kubeRunner.CloseConnection()
assert.Nil(t, err)

setupRunner, err := NewRunner(createNodeConfig(hostname), &setup.SetupRunner{})
assert.Nil(t, err)
assert.NotNil(t, setupRunner.Inner)
assert.IsType(t, setup.SetupRunner{}, *setupRunner.Inner)
setupRunner.CloseConnection()
err = setupRunner.CloseConnection()
assert.Nil(t, err)
}

func createNodeConfig(hostname string) *v1alpha1.Node {
Expand Down
2 changes: 1 addition & 1 deletion experiments/swdt/pkg/pwsh/kubernetes/provisioners.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package kubernetes
import (
"fmt"
"github.com/fatih/color"
"k8s.io/klog/v2"
klog "k8s.io/klog/v2"
"swdt/apis/config/v1alpha1"
"swdt/pkg/connections"
)
Expand Down
1 change: 0 additions & 1 deletion experiments/swdt/pkg/pwsh/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
var (
mainc = color.New(color.FgHiBlack).Add(color.Underline)
resc = color.New(color.FgHiGreen).Add(color.Bold)
errc = color.New(color.FgHiRed)
)

const (
Expand Down

0 comments on commit fc15b42

Please sign in to comment.