Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
  • v1.0.0
  • v1.0.1
  • v1.1.0
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.11.0
  • v1.12.0
  • v1.12.1
  • v1.12.2
  • v1.12.3
  • v1.12.4
  • v1.12.5
  • v1.12.6
  • v1.12.7
  • v1.12.8
  • v1.13.0
  • v1.13.1
  • v1.13.2
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.15.10
  • v1.15.11
  • v1.15.12
  • v1.15.13
  • v1.15.14
  • v1.15.15
  • v1.15.16
  • v1.15.17
  • v1.15.2
  • v1.15.3
  • v1.15.4
  • v1.15.5
  • v1.15.6
  • v1.15.7
  • v1.15.8
  • v1.15.9
  • v1.16.0
  • v1.16.1
  • v1.17.0
  • v1.18.0
  • v1.18.1
  • v1.18.2
  • v1.19.0
  • v1.19.1
  • v1.19.2
  • v1.19.3
  • v1.19.4
  • v1.2.0
  • v1.20.0
  • v1.20.1
  • v1.20.2
  • v1.20.3
  • v1.21.0
  • v1.21.1
  • v1.22.0
  • v1.23.0
  • v1.23.1
  • v1.23.2
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.4.0
  • v1.5.0
  • v1.5.1
  • v1.6.0
  • v1.6.1
  • v1.7.0
  • v1.7.1
  • v1.7.2
  • v1.7.3
  • v1.8.0
  • v1.8.1
  • v1.9.0
76 results

Target

Select target project
  • oss/libraries/go/services/job-queues
1 result
Select Git revision
  • master
  • v1.0.0
  • v1.0.1
  • v1.1.0
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.11.0
  • v1.12.0
  • v1.12.1
  • v1.12.2
  • v1.12.3
  • v1.12.4
  • v1.12.5
  • v1.12.6
  • v1.12.7
  • v1.12.8
  • v1.13.0
  • v1.13.1
  • v1.13.2
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.15.10
  • v1.15.11
  • v1.15.12
  • v1.15.13
  • v1.15.14
  • v1.15.15
  • v1.15.16
  • v1.15.17
  • v1.15.2
  • v1.15.3
  • v1.15.4
  • v1.15.5
  • v1.15.6
  • v1.15.7
  • v1.15.8
  • v1.15.9
  • v1.16.0
  • v1.16.1
  • v1.17.0
  • v1.18.0
  • v1.18.1
  • v1.18.2
  • v1.19.0
  • v1.19.1
  • v1.19.2
  • v1.19.3
  • v1.19.4
  • v1.2.0
  • v1.20.0
  • v1.20.1
  • v1.20.2
  • v1.20.3
  • v1.21.0
  • v1.21.1
  • v1.22.0
  • v1.23.0
  • v1.23.1
  • v1.23.2
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.4.0
  • v1.5.0
  • v1.5.1
  • v1.6.0
  • v1.6.1
  • v1.7.0
  • v1.7.1
  • v1.7.2
  • v1.7.3
  • v1.8.0
  • v1.8.1
  • v1.9.0
76 results
Show changes
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -31,6 +31,10 @@ func (c *CounterResult) GetResult() string { ...@@ -31,6 +31,10 @@ func (c *CounterResult) GetResult() string {
return fmt.Sprintf("Count: %d", c.Count) return fmt.Sprintf("Count: %d", c.Count)
} }
func (c *CounterResult) GetError() (string, int) {
return "", 0
}
// CounterRunnable is a runnable that counts // CounterRunnable is a runnable that counts
type CounterRunnable struct { type CounterRunnable struct {
Count int `json:"count" yaml:"count"` Count int `json:"count" yaml:"count"`
......
...@@ -41,6 +41,13 @@ func (f *FileOperationResult) GetResult() string { ...@@ -41,6 +41,13 @@ func (f *FileOperationResult) GetResult() string {
return f.Content return f.Content
} }
func (f *FileOperationResult) GetError() (string, int) {
if f.Success == false {
return "FileOperationResult failed", 1
}
return "", 0
}
const ( const (
FileOperationRead = "read" FileOperationRead = "read"
FileOperationWrite = "write" FileOperationWrite = "write"
......
...@@ -42,6 +42,10 @@ func (d *DBResult) GetResult() string { ...@@ -42,6 +42,10 @@ func (d *DBResult) GetResult() string {
return fmt.Sprintf("RowsAffected: %d", d.RowsAffected) return fmt.Sprintf("RowsAffected: %d", d.RowsAffected)
} }
func (d *DBResult) GetError() (string, int) {
return "", 0
}
type DBRunnable struct { type DBRunnable struct {
Type string Type string
DSN string DSN string
...@@ -72,17 +76,24 @@ func (d *DBRunnable) Run(ctx context.Context) (RunResult[DBResult], error) { ...@@ -72,17 +76,24 @@ func (d *DBRunnable) Run(ctx context.Context) (RunResult[DBResult], error) {
case "mysql": case "mysql":
db, err = gorm.Open(mysql.Open(d.DSN), &gorm.Config{}) db, err = gorm.Open(mysql.Open(d.DSN), &gorm.Config{})
default: default:
return RunResult[DBResult]{Status: ResultStatusFailed}, ErrUnsupportedDatabaseType return RunResult[DBResult]{Status: ResultStatusFailed,
Data: DBResult{},
}, ErrUnsupportedDatabaseType
} }
if err != nil { if err != nil {
return RunResult[DBResult]{Status: ResultStatusFailed}, err return RunResult[DBResult]{Status: ResultStatusFailed,
Data: DBResult{},
},
err
} }
} }
result := db.Exec(d.Query) result := db.Exec(d.Query)
if result.Error != nil { if result.Error != nil {
return RunResult[DBResult]{Status: ResultStatusFailed}, result.Error return RunResult[DBResult]{Status: ResultStatusFailed,
Data: DBResult{},
}, result.Error
} }
return RunResult[DBResult]{ return RunResult[DBResult]{
......
...@@ -50,6 +50,13 @@ func (h *HTTPResult) GetResult() string { ...@@ -50,6 +50,13 @@ func (h *HTTPResult) GetResult() string {
return fmt.Sprintf("StatusCode: %d\n\n%s", h.StatusCode, h.Body) return fmt.Sprintf("StatusCode: %d\n\n%s", h.StatusCode, h.Body)
} }
func (h *HTTPResult) GetError() (string, int) {
if h.StatusCode >= 400 {
return fmt.Sprintf("StatusCode: %d\n\n%s", h.StatusCode, h.Body), h.StatusCode
}
return "", 0
}
type HTTPRunnable struct { type HTTPRunnable struct {
URL string URL string
Method string Method string
......
...@@ -79,6 +79,13 @@ func (m *MailResult) GetResult() string { ...@@ -79,6 +79,13 @@ func (m *MailResult) GetResult() string {
return fmt.Sprintf("Sent: %t\n\nServerReply: %s\n\nSmtpStatusCode: %d", m.Sent, m.ServerReply, m.SmtpStatusCode) return fmt.Sprintf("Sent: %t\n\nServerReply: %s\n\nSmtpStatusCode: %d", m.Sent, m.ServerReply, m.SmtpStatusCode)
} }
func (m *MailResult) GetError() (string, int) {
if !m.Sent {
return fmt.Sprintf("Sent: %t\n\nServerReply: %s\n\nSmtpStatusCode: %d", m.Sent, m.ServerReply, m.SmtpStatusCode), 1
}
return "", 0
}
type MailRunnable struct { type MailRunnable struct {
To string To string
From string From string
......
...@@ -86,6 +86,10 @@ func (s *SFTPResult) GetResult() string { ...@@ -86,6 +86,10 @@ func (s *SFTPResult) GetResult() string {
return fmt.Sprintf("FilesCopied: %v", s.FilesCopied) return fmt.Sprintf("FilesCopied: %v", s.FilesCopied)
} }
func (s *SFTPResult) GetError() (string, int) {
return "", 0
}
const ( const (
CredentialTypePassword = "password" CredentialTypePassword = "password"
CredentialTypeKey = "key" CredentialTypeKey = "key"
...@@ -122,11 +126,14 @@ func (s *SFTPRunnable) Run(_ context.Context) (RunResult[SFTPResult], error) { ...@@ -122,11 +126,14 @@ func (s *SFTPRunnable) Run(_ context.Context) (RunResult[SFTPResult], error) {
case CredentialTypeKey: case CredentialTypeKey:
key, err := ssh.ParsePrivateKey([]byte(s.Credential)) key, err := ssh.ParsePrivateKey([]byte(s.Credential))
if err != nil { if err != nil {
return RunResult[SFTPResult]{Status: ResultStatusFailed}, err return RunResult[SFTPResult]{Status: ResultStatusFailed,
Data: SFTPResult{},
}, err
} }
authMethod = ssh.PublicKeys(key) authMethod = ssh.PublicKeys(key)
default: default:
return RunResult[SFTPResult]{Status: ResultStatusFailed}, ErrUnsupportedCredentialType return RunResult[SFTPResult]{Status: ResultStatusFailed,
Data: SFTPResult{}}, ErrUnsupportedCredentialType
} }
var hkCallback ssh.HostKeyCallback var hkCallback ssh.HostKeyCallback
...@@ -136,7 +143,9 @@ func (s *SFTPRunnable) Run(_ context.Context) (RunResult[SFTPResult], error) { ...@@ -136,7 +143,9 @@ func (s *SFTPRunnable) Run(_ context.Context) (RunResult[SFTPResult], error) {
hostkeyBytes := []byte(s.HostKey) hostkeyBytes := []byte(s.HostKey)
hostKey, err := ssh.ParsePublicKey(hostkeyBytes) hostKey, err := ssh.ParsePublicKey(hostkeyBytes)
if err != nil { if err != nil {
return RunResult[SFTPResult]{Status: ResultStatusFailed}, err return RunResult[SFTPResult]{Status: ResultStatusFailed,
Data: SFTPResult{},
}, err
} }
hkCallback = ssh.FixedHostKey(hostKey) hkCallback = ssh.FixedHostKey(hostKey)
...@@ -159,13 +168,17 @@ func (s *SFTPRunnable) Run(_ context.Context) (RunResult[SFTPResult], error) { ...@@ -159,13 +168,17 @@ func (s *SFTPRunnable) Run(_ context.Context) (RunResult[SFTPResult], error) {
client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", s.Host, s.Port), config) client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", s.Host, s.Port), config)
if err != nil { if err != nil {
return RunResult[SFTPResult]{Status: ResultStatusFailed}, err return RunResult[SFTPResult]{Status: ResultStatusFailed,
Data: SFTPResult{},
}, err
} }
defer client.Close() defer client.Close()
sftpClient, err := sftp.NewClient(client) sftpClient, err := sftp.NewClient(client)
if err != nil { if err != nil {
return RunResult[SFTPResult]{Status: ResultStatusFailed}, err return RunResult[SFTPResult]{Status: ResultStatusFailed,
Data: SFTPResult{},
}, err
} }
defer sftpClient.Close() defer sftpClient.Close()
...@@ -177,7 +190,9 @@ func (s *SFTPRunnable) Run(_ context.Context) (RunResult[SFTPResult], error) { ...@@ -177,7 +190,9 @@ func (s *SFTPRunnable) Run(_ context.Context) (RunResult[SFTPResult], error) {
case RemoteToLocal: case RemoteToLocal:
filesCopied, err = s.copyRemoteToLocal(sftpClient) filesCopied, err = s.copyRemoteToLocal(sftpClient)
default: default:
return RunResult[SFTPResult]{Status: ResultStatusFailed}, ErrUnsupportedTransferDirection return RunResult[SFTPResult]{Status: ResultStatusFailed,
Data: SFTPResult{},
}, ErrUnsupportedTransferDirection
} }
if err != nil { if err != nil {
......
...@@ -41,6 +41,13 @@ func (s *ShellResult) GetResult() string { ...@@ -41,6 +41,13 @@ func (s *ShellResult) GetResult() string {
return s.Output return s.Output
} }
func (s *ShellResult) GetError() (string, int) {
if s.ExitCode != 0 {
return s.Error, s.ExitCode
}
return "", 0
}
type ShellRunnable struct { type ShellRunnable struct {
ScriptPath string ScriptPath string
Script string Script string
......