You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-23 21:44:44 +02:00
Add godot linter to harmonitze toplevel comments (#3650)
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
// generateScriptPosix is a helper function that generates a step script
|
||||
// for a linux container using the given
|
||||
// for a linux container using the given.
|
||||
func generateScriptPosix(commands []string) string {
|
||||
var buf bytes.Buffer
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
backend "go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
|
||||
)
|
||||
|
||||
// BackendOptions defines all the advanced options for the kubernetes backend
|
||||
// BackendOptions defines all the advanced options for the kubernetes backend.
|
||||
type BackendOptions struct {
|
||||
Resources Resources `mapstructure:"resources"`
|
||||
RuntimeClassName *string `mapstructure:"runtimeClassName"`
|
||||
@@ -18,13 +18,13 @@ type BackendOptions struct {
|
||||
SecurityContext *SecurityContext `mapstructure:"securityContext"`
|
||||
}
|
||||
|
||||
// Resources defines two maps for kubernetes resource definitions
|
||||
// Resources defines two maps for kubernetes resource definitions.
|
||||
type Resources struct {
|
||||
Requests map[string]string `mapstructure:"requests"`
|
||||
Limits map[string]string `mapstructure:"limits"`
|
||||
}
|
||||
|
||||
// Toleration defines Kubernetes toleration
|
||||
// Toleration defines Kubernetes toleration.
|
||||
type Toleration struct {
|
||||
Key string `mapstructure:"key"`
|
||||
Operator TolerationOperator `mapstructure:"operator"`
|
||||
|
||||
@@ -32,8 +32,7 @@ import (
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
// To authenticate to GCP K8s clusters
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // To authenticate to GCP K8s clusters
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
|
||||
@@ -42,7 +41,7 @@ import (
|
||||
|
||||
const (
|
||||
EngineName = "kubernetes"
|
||||
// TODO 5 seconds is against best practice, k3s didn't work otherwise
|
||||
// TODO: 5 seconds is against best practice, k3s didn't work otherwise
|
||||
defaultResyncDuration = 5 * time.Second
|
||||
)
|
||||
|
||||
@@ -268,7 +267,7 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
|
||||
si.Start(stop)
|
||||
defer close(stop)
|
||||
|
||||
// TODO Cancel on ctx.Done
|
||||
// TODO: Cancel on ctx.Done
|
||||
<-finished
|
||||
|
||||
pod, err := e.client.CoreV1().Pods(e.config.Namespace).Get(ctx, podName, metav1.GetOptions{})
|
||||
|
||||
@@ -268,7 +268,7 @@ func containerPort(port types.Port) v1.ContainerPort {
|
||||
}
|
||||
}
|
||||
|
||||
// Here is the service IPs (placed in /etc/hosts in the Pod)
|
||||
// Here is the service IPs (placed in /etc/hosts in the Pod).
|
||||
func hostAliases(extraHosts []types.HostAlias) []v1.HostAlias {
|
||||
var hostAliases []v1.HostAlias
|
||||
for _, extraHost := range extraHosts {
|
||||
|
||||
@@ -65,7 +65,7 @@ func isImagePullBackOffState(pod *v1.Pod) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// getClientOutOfCluster returns a k8s clientset to the request from outside of cluster
|
||||
// getClientOutOfCluster returns a k8s clientset to the request from outside of cluster.
|
||||
func getClientOutOfCluster() (kubernetes.Interface, error) {
|
||||
kubeConfigPath := os.Getenv("KUBECONFIG")
|
||||
if kubeConfigPath == "" {
|
||||
@@ -81,7 +81,7 @@ func getClientOutOfCluster() (kubernetes.Interface, error) {
|
||||
return kubernetes.NewForConfig(config)
|
||||
}
|
||||
|
||||
// getClient returns a k8s clientset to the request from inside of cluster
|
||||
// getClient returns a k8s clientset to the request from inside of cluster.
|
||||
func getClientInsideOfCluster() (kubernetes.Interface, error) {
|
||||
config, err := rest.InClusterConfig()
|
||||
if err != nil {
|
||||
|
||||
@@ -30,13 +30,13 @@ import (
|
||||
"go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
|
||||
)
|
||||
|
||||
// checkGitCloneCap check if we have the git binary on hand
|
||||
// checkGitCloneCap check if we have the git binary on hand.
|
||||
func checkGitCloneCap() error {
|
||||
_, err := exec.LookPath("git")
|
||||
return err
|
||||
}
|
||||
|
||||
// loadClone on backend start determine if there is a global plugin-git binary
|
||||
// loadClone on backend start determine if there is a global plugin-git binary.
|
||||
func (e *local) loadClone() {
|
||||
binary, err := exec.LookPath("plugin-git")
|
||||
if err != nil || binary == "" {
|
||||
@@ -46,7 +46,7 @@ func (e *local) loadClone() {
|
||||
e.pluginGitBinary = binary
|
||||
}
|
||||
|
||||
// setupClone prepare the clone environment before exec
|
||||
// setupClone prepare the clone environment before exec.
|
||||
func (e *local) setupClone(state *workflowState) error {
|
||||
if e.pluginGitBinary != "" {
|
||||
state.pluginGitBinary = e.pluginGitBinary
|
||||
@@ -61,7 +61,7 @@ func (e *local) setupClone(state *workflowState) error {
|
||||
return e.downloadLatestGitPluginBinary(state.pluginGitBinary)
|
||||
}
|
||||
|
||||
// execClone executes a clone-step locally
|
||||
// execClone executes a clone-step locally.
|
||||
func (e *local) execClone(ctx context.Context, step *types.Step, state *workflowState, env []string) error {
|
||||
if scm := step.Environment["CI_REPO_SCM"]; scm != "git" {
|
||||
return fmt.Errorf("local backend can only clone from git repos, but this repo use '%s'", scm)
|
||||
@@ -113,7 +113,7 @@ func (e *local) execClone(ctx context.Context, step *types.Step, state *workflow
|
||||
return cmd.Start()
|
||||
}
|
||||
|
||||
// writeNetRC write a netrc file into the home dir of a given workflow state
|
||||
// writeNetRC write a netrc file into the home dir of a given workflow state.
|
||||
func (e *local) writeNetRC(step *types.Step, state *workflowState) (string, error) {
|
||||
if step.Environment["CI_NETRC_MACHINE"] == "" {
|
||||
log.Trace().Msg("no netrc to write")
|
||||
@@ -132,7 +132,7 @@ func (e *local) writeNetRC(step *types.Step, state *workflowState) (string, erro
|
||||
}
|
||||
|
||||
// downloadLatestGitPluginBinary download the latest plugin-git binary based on runtime OS and Arch
|
||||
// and saves it to dest
|
||||
// and saves it to dest.
|
||||
func (e *local) downloadLatestGitPluginBinary(dest string) error {
|
||||
type asset struct {
|
||||
Name string
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// notAllowedEnvVarOverwrites are all env vars that cannot be overwritten by step config
|
||||
// notAllowedEnvVarOverwrites are all env vars that cannot be overwritten by step config.
|
||||
var notAllowedEnvVarOverwrites = []string{
|
||||
"CI_NETRC_MACHINE",
|
||||
"CI_NETRC_USERNAME",
|
||||
|
||||
@@ -147,10 +147,10 @@ func (e *local) StartStep(ctx context.Context, step *types.Step, taskUUID string
|
||||
}
|
||||
}
|
||||
|
||||
// execCommands use step.Image as shell and run the commands in it
|
||||
// execCommands use step.Image as shell and run the commands in it.
|
||||
func (e *local) execCommands(ctx context.Context, step *types.Step, state *workflowState, env []string) error {
|
||||
// Prepare commands
|
||||
// TODO support `entrypoint` from pipeline config
|
||||
// TODO: support `entrypoint` from pipeline config
|
||||
args, err := e.genCmdByShell(step.Image, step.Commands)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not convert commands into args: %w", err)
|
||||
@@ -176,7 +176,7 @@ func (e *local) execCommands(ctx context.Context, step *types.Step, state *workf
|
||||
return cmd.Start()
|
||||
}
|
||||
|
||||
// execPlugin use step.Image as exec binary
|
||||
// execPlugin use step.Image as exec binary.
|
||||
func (e *local) execPlugin(ctx context.Context, step *types.Step, state *workflowState, env []string) error {
|
||||
binary, err := exec.LookPath(step.Image)
|
||||
if err != nil {
|
||||
|
||||
@@ -56,7 +56,7 @@ type Backend interface {
|
||||
DestroyWorkflow(ctx context.Context, conf *Config, taskUUID string) error
|
||||
}
|
||||
|
||||
// BackendInfo represents the reported information of a loaded backend
|
||||
// BackendInfo represents the reported information of a loaded backend.
|
||||
type BackendInfo struct {
|
||||
Platform string
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type Config struct {
|
||||
Secrets []*Secret `json:"secrets"` // secret definitions
|
||||
}
|
||||
|
||||
// CliContext is the context key to pass cli context to backends if needed
|
||||
// CliContext is the context key to pass cli context to backends if needed.
|
||||
var CliContext ContextKey
|
||||
|
||||
// ContextKey is just an empty struct. It exists so CliContext can be
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
package types
|
||||
|
||||
// Secret defines a runtime secret
|
||||
// Secret defines a runtime secret.
|
||||
type Secret struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
|
||||
@@ -49,7 +49,7 @@ type Step struct {
|
||||
BackendOptions map[string]any `json:"backend_options,omitempty"`
|
||||
}
|
||||
|
||||
// StepType identifies the type of step
|
||||
// StepType identifies the type of step.
|
||||
type StepType string
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user