mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-27 01:29:06 +00:00
parent
fd77b2e9d7
commit
70711ed9db
35 changed files with 106 additions and 106 deletions
|
@ -51,7 +51,7 @@ func (interceptor *AuthInterceptor) Unary() grpc.UnaryClientInterceptor {
|
|||
return func(
|
||||
ctx context.Context,
|
||||
method string,
|
||||
req, reply interface{},
|
||||
req, reply any,
|
||||
cc *grpc.ClientConn,
|
||||
invoker grpc.UnaryInvoker,
|
||||
opts ...grpc.CallOption,
|
||||
|
|
|
@ -213,7 +213,7 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
|
|||
|
||||
finished := make(chan bool)
|
||||
|
||||
podUpdated := func(old, new interface{}) {
|
||||
podUpdated := func(old, new any) {
|
||||
pod := new.(*v1.Pod)
|
||||
if pod.Name == podName {
|
||||
if isImagePullBackOffState(pod) {
|
||||
|
@ -273,7 +273,7 @@ func (e *kube) TailStep(ctx context.Context, step *types.Step, taskUUID string)
|
|||
|
||||
up := make(chan bool)
|
||||
|
||||
podUpdated := func(old, new interface{}) {
|
||||
podUpdated := func(old, new any) {
|
||||
pod := new.(*v1.Pod)
|
||||
if pod.Name == podName {
|
||||
switch pod.Status.Phase {
|
||||
|
|
|
@ -20,7 +20,7 @@ type PipelineError struct {
|
|||
Type PipelineErrorType `json:"type"`
|
||||
Message string `json:"message"`
|
||||
IsWarning bool `json:"is_warning"`
|
||||
Data interface{} `json:"data"`
|
||||
Data any `json:"data"`
|
||||
}
|
||||
|
||||
type LinterErrorData struct {
|
||||
|
|
|
@ -36,7 +36,7 @@ func (c *volumeCacher) Restore(repo, branch string, mounts []string) *yaml_types
|
|||
return &yaml_types.Container{
|
||||
Name: "rebuild_cache",
|
||||
Image: "plugins/volume-cache:1.0.0",
|
||||
Settings: map[string]interface{}{
|
||||
Settings: map[string]any{
|
||||
"mount": mounts,
|
||||
"path": "/cache",
|
||||
"restore": true,
|
||||
|
@ -59,7 +59,7 @@ func (c *volumeCacher) Rebuild(repo, branch string, mounts []string) *yaml_types
|
|||
return &yaml_types.Container{
|
||||
Name: "rebuild_cache",
|
||||
Image: "plugins/volume-cache:1.0.0",
|
||||
Settings: map[string]interface{}{
|
||||
Settings: map[string]any{
|
||||
"mount": mounts,
|
||||
"path": "/cache",
|
||||
"rebuild": true,
|
||||
|
@ -89,7 +89,7 @@ func (c *s3Cacher) Restore(_, _ string, mounts []string) *yaml_types.Container {
|
|||
return &yaml_types.Container{
|
||||
Name: "rebuild_cache",
|
||||
Image: "plugins/s3-cache:latest",
|
||||
Settings: map[string]interface{}{
|
||||
Settings: map[string]any{
|
||||
"mount": mounts,
|
||||
"access_key": c.access,
|
||||
"secret_key": c.secret,
|
||||
|
@ -104,7 +104,7 @@ func (c *s3Cacher) Rebuild(_, _ string, mounts []string) *yaml_types.Container {
|
|||
return &yaml_types.Container{
|
||||
Name: "rebuild_cache",
|
||||
Image: "plugins/s3-cache:latest",
|
||||
Settings: map[string]interface{}{
|
||||
Settings: map[string]any{
|
||||
"mount": mounts,
|
||||
"access_key": c.access,
|
||||
"secret_key": c.secret,
|
||||
|
|
|
@ -151,7 +151,7 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
|
|||
|
||||
// add default clone step
|
||||
if !c.local && len(conf.Clone.ContainerList) == 0 && !conf.SkipClone {
|
||||
cloneSettings := map[string]interface{}{"depth": "0"}
|
||||
cloneSettings := map[string]any{"depth": "0"}
|
||||
if c.metadata.Curr.Event == metadata.EventTag {
|
||||
cloneSettings["tags"] = "true"
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
|
||||
// ParamsToEnv uses reflection to convert a map[string]interface to a list
|
||||
// of environment variables.
|
||||
func ParamsToEnv(from map[string]interface{}, to, secrets map[string]string) (err error) {
|
||||
func ParamsToEnv(from map[string]any, to, secrets map[string]string) (err error) {
|
||||
if to == nil {
|
||||
return fmt.Errorf("no map to write to")
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ func isComplex(t reflect.Kind) bool {
|
|||
}
|
||||
|
||||
// sanitizeParamValue returns the value of a setting as string prepared to be injected as environment variable
|
||||
func sanitizeParamValue(v interface{}, secrets map[string]string) (string, error) {
|
||||
func sanitizeParamValue(v any, secrets map[string]string) (string, error) {
|
||||
t := reflect.TypeOf(v)
|
||||
vv := reflect.ValueOf(v)
|
||||
|
||||
|
@ -82,7 +82,7 @@ func sanitizeParamValue(v interface{}, secrets map[string]string) (string, error
|
|||
case reflect.Map:
|
||||
switch v := v.(type) {
|
||||
// gopkg.in/yaml.v3 only emits this map interface
|
||||
case map[string]interface{}:
|
||||
case map[string]any:
|
||||
// check if it's a secret and return value if it's the case
|
||||
value, isSecret, err := injectSecret(v, secrets)
|
||||
if err != nil {
|
||||
|
@ -139,7 +139,7 @@ func sanitizeParamValue(v interface{}, secrets map[string]string) (string, error
|
|||
}
|
||||
|
||||
// handleComplex uses yaml2json to get json strings as values for environment variables
|
||||
func handleComplex(v interface{}, secrets map[string]string) (string, error) {
|
||||
func handleComplex(v any, secrets map[string]string) (string, error) {
|
||||
v, err := injectSecretRecursive(v, secrets)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -159,7 +159,7 @@ func handleComplex(v interface{}, secrets map[string]string) (string, error) {
|
|||
// injectSecret probes if a map is a from_secret request.
|
||||
// If it's a from_secret request it either returns the secret value or an error if the secret was not found
|
||||
// else it just indicates to progress normally using the provided map as is
|
||||
func injectSecret(v map[string]interface{}, secrets map[string]string) (string, bool, error) {
|
||||
func injectSecret(v map[string]any, secrets map[string]string) (string, bool, error) {
|
||||
if secretNameI, ok := v["from_secret"]; ok {
|
||||
if secretName, ok := secretNameI.(string); ok {
|
||||
if secret, ok := secrets[strings.ToLower(secretName)]; ok {
|
||||
|
@ -174,7 +174,7 @@ func injectSecret(v map[string]interface{}, secrets map[string]string) (string,
|
|||
|
||||
// injectSecretRecursive iterates over all types and if they contain elements
|
||||
// it iterates recursively over them too, using injectSecret internally
|
||||
func injectSecretRecursive(v interface{}, secrets map[string]string) (interface{}, error) {
|
||||
func injectSecretRecursive(v any, secrets map[string]string) (any, error) {
|
||||
t := reflect.TypeOf(v)
|
||||
|
||||
if !isComplex(t.Kind()) {
|
||||
|
@ -185,7 +185,7 @@ func injectSecretRecursive(v interface{}, secrets map[string]string) (interface{
|
|||
case reflect.Map:
|
||||
switch v := v.(type) {
|
||||
// gopkg.in/yaml.v3 only emits this map interface
|
||||
case map[string]interface{}:
|
||||
case map[string]any:
|
||||
// handle secrets
|
||||
value, isSecret, err := injectSecret(v, secrets)
|
||||
if err != nil {
|
||||
|
@ -207,7 +207,7 @@ func injectSecretRecursive(v interface{}, secrets map[string]string) (interface{
|
|||
|
||||
case reflect.Array, reflect.Slice:
|
||||
vv := reflect.ValueOf(v)
|
||||
vl := make([]interface{}, vv.Len())
|
||||
vl := make([]any, vv.Len())
|
||||
|
||||
for i := 0; i < vv.Len(); i++ {
|
||||
v, err := injectSecretRecursive(vv.Index(i).Interface(), secrets)
|
||||
|
|
|
@ -22,21 +22,21 @@ import (
|
|||
)
|
||||
|
||||
func TestParamsToEnv(t *testing.T) {
|
||||
from := map[string]interface{}{
|
||||
from := map[string]any{
|
||||
"skip": nil,
|
||||
"string": "stringz",
|
||||
"int": 1,
|
||||
"float": 1.2,
|
||||
"bool": true,
|
||||
"slice": []int{1, 2, 3},
|
||||
"map": map[string]interface{}{"hello": "world"},
|
||||
"map": map[string]any{"hello": "world"},
|
||||
"complex": []struct{ Name string }{{"Jack"}, {"Jill"}},
|
||||
"complex2": struct{ Name string }{"Jack"},
|
||||
"from.address": "noreply@example.com",
|
||||
"tags": stringsToInterface("next", "latest"),
|
||||
"tag": stringsToInterface("next"),
|
||||
"my_secret": map[string]interface{}{"from_secret": "secret_token"},
|
||||
"UPPERCASE_SECRET": map[string]interface{}{"from_secret": "SECRET_TOKEN"},
|
||||
"my_secret": map[string]any{"from_secret": "secret_token"},
|
||||
"UPPERCASE_SECRET": map[string]any{"from_secret": "SECRET_TOKEN"},
|
||||
}
|
||||
want := map[string]string{
|
||||
"PLUGIN_STRING": "stringz",
|
||||
|
@ -62,7 +62,7 @@ func TestParamsToEnv(t *testing.T) {
|
|||
|
||||
// handle edge cases (#1609)
|
||||
got = map[string]string{}
|
||||
assert.NoError(t, ParamsToEnv(map[string]interface{}{"a": []interface{}{"a", nil}}, got, nil))
|
||||
assert.NoError(t, ParamsToEnv(map[string]any{"a": []any{"a", nil}}, got, nil))
|
||||
assert.EqualValues(t, map[string]string{"PLUGIN_A": "a,"}, got)
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ list.map:
|
|||
password:
|
||||
from_secret: cb_password
|
||||
`)
|
||||
var from map[string]interface{}
|
||||
var from map[string]any
|
||||
err := yaml.Unmarshal(fromYAML, &from)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
@ -122,7 +122,7 @@ func TestYAMLToParamsToEnvError(t *testing.T) {
|
|||
fromYAML := []byte(`my_secret:
|
||||
from_secret: not_a_secret
|
||||
`)
|
||||
var from map[string]interface{}
|
||||
var from map[string]any
|
||||
err := yaml.Unmarshal(fromYAML, &from)
|
||||
assert.NoError(t, err)
|
||||
secrets := map[string]string{
|
||||
|
@ -131,8 +131,8 @@ func TestYAMLToParamsToEnvError(t *testing.T) {
|
|||
assert.Error(t, ParamsToEnv(from, make(map[string]string), secrets))
|
||||
}
|
||||
|
||||
func stringsToInterface(val ...string) []interface{} {
|
||||
res := make([]interface{}, len(val))
|
||||
func stringsToInterface(val ...string) []any {
|
||||
res := make([]any, len(val))
|
||||
for i := range val {
|
||||
res[i] = val[i]
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ func (c *Map) Match(params map[string]string) bool {
|
|||
}
|
||||
|
||||
// UnmarshalYAML unmarshal the constraint map.
|
||||
func (c *Map) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
func (c *Map) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
out1 := struct {
|
||||
Include map[string]string
|
||||
Exclude map[string]string
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
type StringOrInt int64
|
||||
|
||||
// UnmarshalYAML implements the Unmarshaler interface.
|
||||
func (s *StringOrInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
func (s *StringOrInt) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
var intType int64
|
||||
if err := unmarshal(&intType); err == nil {
|
||||
*s = StringOrInt(intType)
|
||||
|
@ -50,7 +50,7 @@ func (s *StringOrInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
type MemStringOrInt int64
|
||||
|
||||
// UnmarshalYAML implements the Unmarshaler interface.
|
||||
func (s *MemStringOrInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
func (s *MemStringOrInt) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
var intType int64
|
||||
if err := unmarshal(&intType); err == nil {
|
||||
*s = MemStringOrInt(intType)
|
||||
|
|
|
@ -24,8 +24,8 @@ import (
|
|||
type SliceOrMap map[string]string
|
||||
|
||||
// UnmarshalYAML implements the Unmarshaler interface.
|
||||
func (s *SliceOrMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var sliceType []interface{}
|
||||
func (s *SliceOrMap) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
var sliceType []any
|
||||
if err := unmarshal(&sliceType); err == nil {
|
||||
parts := map[string]string{}
|
||||
for _, s := range sliceType {
|
||||
|
@ -47,7 +47,7 @@ func (s *SliceOrMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var mapType map[interface{}]interface{}
|
||||
var mapType map[any]any
|
||||
if err := unmarshal(&mapType); err == nil {
|
||||
parts := map[string]string{}
|
||||
for k, v := range mapType {
|
||||
|
|
|
@ -24,14 +24,14 @@ import (
|
|||
type StringOrSlice []string
|
||||
|
||||
// UnmarshalYAML implements the Unmarshaler interface.
|
||||
func (s *StringOrSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
func (s *StringOrSlice) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
var stringType string
|
||||
if err := unmarshal(&stringType); err == nil {
|
||||
*s = []string{stringType}
|
||||
return nil
|
||||
}
|
||||
|
||||
var sliceType []interface{}
|
||||
var sliceType []any
|
||||
if err := unmarshal(&sliceType); err == nil {
|
||||
parts, err := toStrings(sliceType)
|
||||
if err != nil {
|
||||
|
@ -44,7 +44,7 @@ func (s *StringOrSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
return errors.New("Failed to unmarshal StringOrSlice")
|
||||
}
|
||||
|
||||
func toStrings(s []interface{}) ([]string, error) {
|
||||
func toStrings(s []any) ([]string, error) {
|
||||
if len(s) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
@ -33,21 +33,21 @@ type (
|
|||
|
||||
// Container defines a container.
|
||||
Container struct {
|
||||
BackendOptions BackendOptions `yaml:"backend_options,omitempty"`
|
||||
Commands base.StringOrSlice `yaml:"commands,omitempty"`
|
||||
Detached bool `yaml:"detach,omitempty"`
|
||||
Directory string `yaml:"directory,omitempty"`
|
||||
Environment base.SliceOrMap `yaml:"environment,omitempty"`
|
||||
Failure string `yaml:"failure,omitempty"`
|
||||
Group string `yaml:"group,omitempty"`
|
||||
Image string `yaml:"image,omitempty"`
|
||||
Name string `yaml:"name,omitempty"`
|
||||
Pull bool `yaml:"pull,omitempty"`
|
||||
Secrets Secrets `yaml:"secrets,omitempty"`
|
||||
Settings map[string]interface{} `yaml:"settings"`
|
||||
Volumes Volumes `yaml:"volumes,omitempty"`
|
||||
When constraint.When `yaml:"when,omitempty"`
|
||||
Ports []base.StringOrInt `yaml:"ports,omitempty"`
|
||||
BackendOptions BackendOptions `yaml:"backend_options,omitempty"`
|
||||
Commands base.StringOrSlice `yaml:"commands,omitempty"`
|
||||
Detached bool `yaml:"detach,omitempty"`
|
||||
Directory string `yaml:"directory,omitempty"`
|
||||
Environment base.SliceOrMap `yaml:"environment,omitempty"`
|
||||
Failure string `yaml:"failure,omitempty"`
|
||||
Group string `yaml:"group,omitempty"`
|
||||
Image string `yaml:"image,omitempty"`
|
||||
Name string `yaml:"name,omitempty"`
|
||||
Pull bool `yaml:"pull,omitempty"`
|
||||
Secrets Secrets `yaml:"secrets,omitempty"`
|
||||
Settings map[string]any `yaml:"settings"`
|
||||
Volumes Volumes `yaml:"volumes,omitempty"`
|
||||
When constraint.When `yaml:"when,omitempty"`
|
||||
Ports []base.StringOrInt `yaml:"ports,omitempty"`
|
||||
|
||||
// Docker Specific
|
||||
Privileged bool `yaml:"privileged,omitempty"`
|
||||
|
|
|
@ -124,7 +124,7 @@ func TestUnmarshalContainer(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
Settings: map[string]interface{}{
|
||||
Settings: map[string]any{
|
||||
"foo": "bar",
|
||||
"baz": false,
|
||||
},
|
||||
|
@ -159,7 +159,7 @@ func TestUnmarshalContainers(t *testing.T) {
|
|||
{
|
||||
Name: "unit_test",
|
||||
Image: "node",
|
||||
Settings: map[string]interface{}{
|
||||
Settings: map[string]any{
|
||||
"normal_setting": true,
|
||||
},
|
||||
},
|
||||
|
@ -190,7 +190,7 @@ func TestUnmarshalContainers(t *testing.T) {
|
|||
Source: "docker_password",
|
||||
Target: "docker_password",
|
||||
}}},
|
||||
Settings: map[string]interface{}{
|
||||
Settings: map[string]any{
|
||||
"repo": "woodpeckerci/woodpecker-agent",
|
||||
"dockerfile": "docker/Dockerfile.agent",
|
||||
"tag": stringsToInterface("next", "latest"),
|
||||
|
@ -223,7 +223,7 @@ func TestUnmarshalContainers(t *testing.T) {
|
|||
Name: "publish-cli",
|
||||
Image: "print/env",
|
||||
Group: "docker",
|
||||
Settings: map[string]interface{}{
|
||||
Settings: map[string]any{
|
||||
"repo": "woodpeckerci/woodpecker-cli",
|
||||
"dockerfile": "docker/Dockerfile.cli",
|
||||
"tag": stringsToInterface("next"),
|
||||
|
@ -289,8 +289,8 @@ func TestUnmarshalContainersErr(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func stringsToInterface(val ...string) []interface{} {
|
||||
res := make([]interface{}, len(val))
|
||||
func stringsToInterface(val ...string) []any {
|
||||
res := make([]any, len(val))
|
||||
for i := range val {
|
||||
res[i] = val[i]
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ type Network struct {
|
|||
}
|
||||
|
||||
// MarshalYAML implements the Marshaller interface.
|
||||
func (n Networks) MarshalYAML() (interface{}, error) {
|
||||
func (n Networks) MarshalYAML() (any, error) {
|
||||
m := map[string]*Network{}
|
||||
for _, network := range n.Networks {
|
||||
m[network.Name] = network
|
||||
|
@ -43,8 +43,8 @@ func (n Networks) MarshalYAML() (interface{}, error) {
|
|||
}
|
||||
|
||||
// UnmarshalYAML implements the Unmarshaler interface.
|
||||
func (n *Networks) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var sliceType []interface{}
|
||||
func (n *Networks) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
var sliceType []any
|
||||
if err := unmarshal(&sliceType); err == nil {
|
||||
n.Networks = []*Network{}
|
||||
for _, network := range sliceType {
|
||||
|
@ -59,7 +59,7 @@ func (n *Networks) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var mapType map[interface{}]interface{}
|
||||
var mapType map[any]any
|
||||
if err := unmarshal(&mapType); err == nil {
|
||||
n.Networks = []*Network{}
|
||||
for mapKey, mapValue := range mapType {
|
||||
|
@ -79,21 +79,21 @@ func (n *Networks) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
return errors.New("Failed to unmarshal Networks")
|
||||
}
|
||||
|
||||
func handleNetwork(name string, value interface{}) (*Network, error) {
|
||||
func handleNetwork(name string, value any) (*Network, error) {
|
||||
if value == nil {
|
||||
return &Network{
|
||||
Name: name,
|
||||
}, nil
|
||||
}
|
||||
switch v := value.(type) {
|
||||
case map[string]interface{}:
|
||||
case map[string]any:
|
||||
network := &Network{
|
||||
Name: name,
|
||||
}
|
||||
for mapKey, mapValue := range v {
|
||||
switch mapKey {
|
||||
case "aliases":
|
||||
aliases, ok := mapValue.([]interface{})
|
||||
aliases, ok := mapValue.([]any)
|
||||
if !ok {
|
||||
return &Network{}, fmt.Errorf("Cannot unmarshal '%v' to type %T into a string value", aliases, aliases)
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ func (v *Volume) String() string {
|
|||
}
|
||||
|
||||
// MarshalYAML implements the Marshaller interface.
|
||||
func (v Volumes) MarshalYAML() (interface{}, error) {
|
||||
func (v Volumes) MarshalYAML() (any, error) {
|
||||
vs := []string{}
|
||||
for _, volume := range v.Volumes {
|
||||
vs = append(vs, volume.String())
|
||||
|
@ -57,8 +57,8 @@ func (v Volumes) MarshalYAML() (interface{}, error) {
|
|||
}
|
||||
|
||||
// UnmarshalYAML implements the Unmarshaler interface.
|
||||
func (v *Volumes) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var sliceType []interface{}
|
||||
func (v *Volumes) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
var sliceType []any
|
||||
if err := unmarshal(&sliceType); err == nil {
|
||||
v.Volumes = []*Volume{}
|
||||
for _, volume := range sliceType {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.24.4
|
||||
// source: woodpecker.proto
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ func (c *Client) GetRepoFiles(owner, name, revision, path string, page *string)
|
|||
return out, err
|
||||
}
|
||||
|
||||
func (c *Client) do(rawurl, method string, in, out interface{}) (*string, error) {
|
||||
func (c *Client) do(rawurl, method string, in, out any) (*string, error) {
|
||||
uri, err := url.Parse(rawurl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -38,7 +38,7 @@ func GetPipelineStatusContext(repo *model.Repo, pipeline *model.Pipeline, workfl
|
|||
return ""
|
||||
}
|
||||
var ctx bytes.Buffer
|
||||
err = tmpl.Execute(&ctx, map[string]interface{}{
|
||||
err = tmpl.Execute(&ctx, map[string]any{
|
||||
"context": server.Config.Server.StatusContext,
|
||||
"event": event,
|
||||
"workflow": workflow.Name,
|
||||
|
|
|
@ -125,7 +125,7 @@ func getUserRepos(c *gin.Context) {
|
|||
}
|
||||
|
||||
func getVersion(c *gin.Context) {
|
||||
c.JSON(200, map[string]interface{}{"version": "1.18.0"})
|
||||
c.JSON(200, map[string]any{"version": "1.18.0"})
|
||||
}
|
||||
|
||||
func getPRFiles(c *gin.Context) {
|
||||
|
|
|
@ -525,7 +525,7 @@ func (c *client) Activate(ctx context.Context, u *model.User, r *model.Repo, lin
|
|||
"pull_request",
|
||||
"deployment",
|
||||
},
|
||||
Config: map[string]interface{}{
|
||||
Config: map[string]any{
|
||||
"url": link,
|
||||
"content_type": "form",
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Code generated by mockery v2.36.0. DO NOT EDIT.
|
||||
// Code generated by mockery v2.36.1. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ func NewAuthorizer(jwtManager *JWTManager) *Authorizer {
|
|||
return &Authorizer{jwtManager: jwtManager}
|
||||
}
|
||||
|
||||
func (a *Authorizer) StreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
||||
func (a *Authorizer) StreamInterceptor(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
||||
_stream := newStreamContextWrapper(stream)
|
||||
|
||||
newCtx, err := a.authorize(stream.Context(), info.FullMethod)
|
||||
|
@ -71,7 +71,7 @@ func (a *Authorizer) StreamInterceptor(srv interface{}, stream grpc.ServerStream
|
|||
return handler(srv, _stream)
|
||||
}
|
||||
|
||||
func (a *Authorizer) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
|
||||
func (a *Authorizer) UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) {
|
||||
newCtx, err := a.authorize(ctx, info.FullMethod)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -65,7 +65,7 @@ func (manager *JWTManager) Verify(accessToken string) (*AgentTokenClaims, error)
|
|||
token, err := jwt.ParseWithClaims(
|
||||
accessToken,
|
||||
&AgentTokenClaims{},
|
||||
func(token *jwt.Token) (interface{}, error) {
|
||||
func(token *jwt.Token) (any, error) {
|
||||
_, ok := token.Method.(*jwt.SigningMethodHMAC)
|
||||
if !ok {
|
||||
return nil, errors.New("unexpected token signing method")
|
||||
|
|
|
@ -29,7 +29,7 @@ import (
|
|||
|
||||
// Send makes an http request to the given endpoint, writing the input
|
||||
// to the request body and un-marshaling the output from the response body.
|
||||
func Send(ctx context.Context, method, path string, privateKey crypto.PrivateKey, in, out interface{}) (int, error) {
|
||||
func Send(ctx context.Context, method, path string, privateKey crypto.PrivateKey, in, out any) (int, error) {
|
||||
uri, err := url.Parse(path)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
|
|
@ -42,7 +42,7 @@ func Logger(timeFormat string, utc bool) gin.HandlerFunc {
|
|||
end = end.UTC()
|
||||
}
|
||||
|
||||
entry := map[string]interface{}{
|
||||
entry := map[string]any{
|
||||
"status": c.Writer.Status(),
|
||||
"method": c.Request.Method,
|
||||
"path": path,
|
||||
|
|
|
@ -22,7 +22,7 @@ const key = "store"
|
|||
|
||||
// Setter defines a context that enables setting values.
|
||||
type Setter interface {
|
||||
Set(string, interface{})
|
||||
Set(string, any)
|
||||
}
|
||||
|
||||
// FromContext returns the Store associated with this context.
|
||||
|
|
|
@ -39,7 +39,7 @@ func testDriverConfig() (driver, config string) {
|
|||
// newTestStore creates a new database connection for testing purposes.
|
||||
// The database driver and connection string are provided by
|
||||
// environment variables, with fallback to in-memory sqlite.
|
||||
func newTestStore(t *testing.T, tables ...interface{}) (*storage, func()) {
|
||||
func newTestStore(t *testing.T, tables ...any) (*storage, func()) {
|
||||
engine, err := xorm.NewEngine(testDriverConfig())
|
||||
if !assert.NoError(t, err) {
|
||||
t.FailNow()
|
||||
|
|
|
@ -34,10 +34,10 @@ func (pipeline026) TableName() string {
|
|||
}
|
||||
|
||||
type PipelineError026 struct {
|
||||
Type string `json:"type"`
|
||||
Message string `json:"message"`
|
||||
IsWarning bool `json:"is_warning"`
|
||||
Data interface{} `json:"data"`
|
||||
Type string `json:"type"`
|
||||
Message string `json:"message"`
|
||||
IsWarning bool `json:"is_warning"`
|
||||
Data any `json:"data"`
|
||||
}
|
||||
|
||||
var convertToNewPipelineErrorFormat = task{
|
||||
|
|
|
@ -61,7 +61,7 @@ var migrationTasks = []*task{
|
|||
&convertToNewPipelineErrorFormat,
|
||||
}
|
||||
|
||||
var allBeans = []interface{}{
|
||||
var allBeans = []any{
|
||||
new(model.Agent),
|
||||
new(model.Pipeline),
|
||||
new(model.PipelineConfig),
|
||||
|
@ -220,7 +220,7 @@ func runTasks(e *xorm.Engine, tasks []*task) error {
|
|||
}
|
||||
|
||||
type syncEngine interface {
|
||||
Sync(beans ...interface{}) error
|
||||
Sync(beans ...any) error
|
||||
}
|
||||
|
||||
func syncAll(sess syncEngine) error {
|
||||
|
|
|
@ -37,56 +37,56 @@ type xormLogger struct {
|
|||
}
|
||||
|
||||
// Error implement ILogger
|
||||
func (x *xormLogger) Error(v ...interface{}) {
|
||||
func (x *xormLogger) Error(v ...any) {
|
||||
if x.level <= xlog.LOG_ERR {
|
||||
x.logger.Error().Msg(fmt.Sprintln(v...))
|
||||
}
|
||||
}
|
||||
|
||||
// Errorf implement ILogger
|
||||
func (x *xormLogger) Errorf(format string, v ...interface{}) {
|
||||
func (x *xormLogger) Errorf(format string, v ...any) {
|
||||
if x.level <= xlog.LOG_ERR {
|
||||
x.logger.Error().Msg(fmt.Sprintf(format, v...))
|
||||
}
|
||||
}
|
||||
|
||||
// Debug implement ILogger
|
||||
func (x *xormLogger) Debug(v ...interface{}) {
|
||||
func (x *xormLogger) Debug(v ...any) {
|
||||
if x.level <= xlog.LOG_DEBUG {
|
||||
x.logger.Debug().Msg(fmt.Sprintln(v...))
|
||||
}
|
||||
}
|
||||
|
||||
// Debugf implement ILogger
|
||||
func (x *xormLogger) Debugf(format string, v ...interface{}) {
|
||||
func (x *xormLogger) Debugf(format string, v ...any) {
|
||||
if x.level <= xlog.LOG_DEBUG {
|
||||
x.logger.Debug().Msg(fmt.Sprintf(format, v...))
|
||||
}
|
||||
}
|
||||
|
||||
// Info implement ILogger
|
||||
func (x *xormLogger) Info(v ...interface{}) {
|
||||
func (x *xormLogger) Info(v ...any) {
|
||||
if x.level <= xlog.LOG_INFO {
|
||||
x.logger.Info().Msg(fmt.Sprintln(v...))
|
||||
}
|
||||
}
|
||||
|
||||
// Infof implement ILogger
|
||||
func (x *xormLogger) Infof(format string, v ...interface{}) {
|
||||
func (x *xormLogger) Infof(format string, v ...any) {
|
||||
if x.level <= xlog.LOG_INFO {
|
||||
x.logger.Info().Msg(fmt.Sprintf(format, v...))
|
||||
}
|
||||
}
|
||||
|
||||
// Warn implement ILogger
|
||||
func (x *xormLogger) Warn(v ...interface{}) {
|
||||
func (x *xormLogger) Warn(v ...any) {
|
||||
if x.level <= xlog.LOG_WARNING {
|
||||
x.logger.Warn().Msg(fmt.Sprintln(v...))
|
||||
}
|
||||
}
|
||||
|
||||
// Warnf implement ILogger
|
||||
func (x *xormLogger) Warnf(format string, v ...interface{}) {
|
||||
func (x *xormLogger) Warnf(format string, v ...any) {
|
||||
if x.level <= xlog.LOG_WARNING {
|
||||
x.logger.Warn().Msg(fmt.Sprintf(format, v...))
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Code generated by mockery v2.36.0. DO NOT EDIT.
|
||||
// Code generated by mockery v2.36.1. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ func Config(c *gin.Context) {
|
|||
).Sign(user.Hash)
|
||||
}
|
||||
|
||||
configData := map[string]interface{}{
|
||||
configData := map[string]any{
|
||||
"user": user,
|
||||
"csrf": csrf,
|
||||
"version": version.String(),
|
||||
|
@ -50,7 +50,7 @@ func Config(c *gin.Context) {
|
|||
|
||||
// default func map with json parser.
|
||||
funcMap := template.FuncMap{
|
||||
"json": func(v interface{}) string {
|
||||
"json": func(v any) string {
|
||||
a, _ := json.Marshal(v)
|
||||
return string(a)
|
||||
},
|
||||
|
|
|
@ -126,7 +126,7 @@ func (t *Token) SignExpires(secret string, exp int64) (string, error) {
|
|||
}
|
||||
|
||||
func keyFunc(token *Token, fn SecretFunc) jwt.Keyfunc {
|
||||
return func(t *jwt.Token) (interface{}, error) {
|
||||
return func(t *jwt.Token) (any, error) {
|
||||
claims, ok := t.Claims.(jwt.MapClaims)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("token claim is not a MapClaims")
|
||||
|
|
|
@ -586,17 +586,17 @@ func (c *client) AgentTasksList(agentID int64) ([]*Task, error) {
|
|||
//
|
||||
|
||||
// helper function for making an http GET request.
|
||||
func (c *client) get(rawurl string, out interface{}) error {
|
||||
func (c *client) get(rawurl string, out any) error {
|
||||
return c.do(rawurl, http.MethodGet, nil, out)
|
||||
}
|
||||
|
||||
// helper function for making an http POST request.
|
||||
func (c *client) post(rawurl string, in, out interface{}) error {
|
||||
func (c *client) post(rawurl string, in, out any) error {
|
||||
return c.do(rawurl, http.MethodPost, in, out)
|
||||
}
|
||||
|
||||
// helper function for making an http PATCH request.
|
||||
func (c *client) patch(rawurl string, in, out interface{}) error {
|
||||
func (c *client) patch(rawurl string, in, out any) error {
|
||||
return c.do(rawurl, http.MethodPatch, in, out)
|
||||
}
|
||||
|
||||
|
@ -606,7 +606,7 @@ func (c *client) delete(rawurl string) error {
|
|||
}
|
||||
|
||||
// helper function to make an http request
|
||||
func (c *client) do(rawurl, method string, in, out interface{}) error {
|
||||
func (c *client) do(rawurl, method string, in, out any) error {
|
||||
body, err := c.open(rawurl, method, in)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -619,7 +619,7 @@ func (c *client) do(rawurl, method string, in, out interface{}) error {
|
|||
}
|
||||
|
||||
// helper function to open an http request
|
||||
func (c *client) open(rawurl, method string, in interface{}) (io.ReadCloser, error) {
|
||||
func (c *client) open(rawurl, method string, in any) (io.ReadCloser, error) {
|
||||
uri, err := url.Parse(rawurl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -61,10 +61,10 @@ type (
|
|||
}
|
||||
|
||||
PipelineError struct {
|
||||
Type string `json:"type"`
|
||||
Message string `json:"message"`
|
||||
IsWarning bool `json:"is_warning"`
|
||||
Data interface{} `json:"data"`
|
||||
Type string `json:"type"`
|
||||
Message string `json:"message"`
|
||||
IsWarning bool `json:"is_warning"`
|
||||
Data any `json:"data"`
|
||||
}
|
||||
|
||||
// Pipeline defines a pipeline object.
|
||||
|
|
Loading…
Reference in a new issue