mirror of
https://gitea.com/gitea/runner.git
synced 2026-08-28 06:47:45 +00:00
chore: update deps, adapt lint, use json v2 (#1185)
- Raised go to 1.27 - Adopted json v2 - Sync lint config from gitea - Fixed all issues Co-authored-by: silverwind <me@silverwind.io> Reviewed-on: https://gitea.com/gitea/runner/pulls/1185 Reviewed-by: bircni <bircni@icloud.com> Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -198,14 +198,15 @@ func (rc *RunContext) networkNameForGitea() (string, bool) {
|
||||
func getDockerDaemonSocketMountPath(daemonPath string) string {
|
||||
if before, after, ok := strings.Cut(daemonPath, "://"); ok {
|
||||
scheme := before
|
||||
if strings.EqualFold(scheme, "npipe") {
|
||||
switch {
|
||||
case strings.EqualFold(scheme, "npipe"):
|
||||
// linux container mount on windows, use the default socket path of the VM / wsl2
|
||||
return "/var/run/docker.sock"
|
||||
} else if strings.EqualFold(scheme, "unix") {
|
||||
case strings.EqualFold(scheme, "unix"):
|
||||
return after
|
||||
} else if strings.IndexFunc(scheme, func(r rune) bool {
|
||||
case strings.IndexFunc(scheme, func(r rune) bool {
|
||||
return (r < 'a' || r > 'z') && (r < 'A' || r > 'Z')
|
||||
}) == -1 {
|
||||
}) == -1:
|
||||
// unknown protocol use default
|
||||
return "/var/run/docker.sock"
|
||||
}
|
||||
@@ -550,7 +551,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
||||
AllocatePTY: rc.Config.AllocatePTY,
|
||||
})
|
||||
if rc.JobContainer == nil {
|
||||
return errors.New("Failed to create job container")
|
||||
return errors.New("failed to create job container")
|
||||
}
|
||||
|
||||
rc.jobNetworkName = networkName
|
||||
|
||||
Reference in New Issue
Block a user