Skip to content

Commit

Permalink
fix: Reference the related GitHub issue in linter suppresions
Browse files Browse the repository at this point in the history
Co-authored-by: Balazs Nadasdi <[email protected]>
  • Loading branch information
yiannistri and yitsushi committed Jul 4, 2023
1 parent 7f67152 commit a8f791b
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion cmd/gitops/beta/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ func runCommandInnerProcess(cmd *cobra.Command, args []string) error {
podErr error
)

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if pollErr := wait.PollImmediate(2*time.Second, flags.Timeout, func() (bool, error) {
pod, podErr = run.GetPodFromResourceDescription(thisCtx, kubeClient, namespacedName, specMap.Kind, nil)
if pod != nil && podErr == nil {
Expand Down
4 changes: 2 additions & 2 deletions core/clustersmngr/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (cf *clustersManager) watchClusters(ctx context.Context) {

cf.initialClustersLoad <- true

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.PollImmediateInfinite(watchClustersFrequency, func() (bool, error) {
if err := cf.UpdateClusters(ctx); err != nil {
cf.log.Error(err, "Failed to update clusters")
Expand Down Expand Up @@ -313,7 +313,7 @@ func (cf *clustersManager) watchNamespaces(ctx context.Context) {
// waits the first load of cluster to start watching namespaces
<-cf.initialClustersLoad

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.PollImmediateInfinite(watchNamespaceFrequency, func() (bool, error) {
if err := cf.UpdateNamespaces(ctx); err != nil {
if merr, ok := err.(*multierror.Error); ok {
Expand Down
4 changes: 2 additions & 2 deletions core/fluxsync/fluxsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ func RequestReconciliation(ctx context.Context, k client.Client, name client.Obj

// WaitForSync polls the k8s API until the resources is sync'd, and times out eventually.
func WaitForSync(ctx context.Context, c client.Client, key client.ObjectKey, obj Reconcilable) error {
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.PollImmediate(
k8sPollInterval,
k8sTimeout,
checkResourceSync(ctx, c, key, obj, obj.GetLastHandledReconcileRequest()),
); err != nil {
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if errors.Is(err, wait.ErrWaitTimeout) {
return errors.New("sync request timed out. The sync operation may still be in progress")
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/run/install/install_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func ReconcileDashboard(ctx context.Context, kubeClient client.Client, dashboard

var sourceRequestedAt string

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(interval, timeout, func() (bool, error) {
var err error
sourceRequestedAt, err = run.RequestReconciliation(ctx, kubeClient,
Expand All @@ -218,7 +218,7 @@ func ReconcileDashboard(ctx context.Context, kubeClient client.Client, dashboard
}

// wait for the reconciliation of dashboard to be done
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(interval, timeout, func() (bool, error) {
dashboard := &sourcev1.HelmChart{}
if err := kubeClient.Get(ctx, types.NamespacedName{
Expand All @@ -234,7 +234,7 @@ func ReconcileDashboard(ctx context.Context, kubeClient client.Client, dashboard
}

// wait for dashboard to be ready
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(interval, timeout, func() (bool, error) {
namespacedName := types.NamespacedName{Namespace: namespace, Name: podName}

Expand Down
2 changes: 1 addition & 1 deletion pkg/run/install/install_fluent_bit.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func InstallFluentBit(ctx context.Context, log logger.Logger, kubeClient client.

log.Actionf("waiting for HelmRelease %s/%s to be ready", helmRelease.Namespace, helmRelease.Name)

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(2*time.Second, 5*time.Minute, func() (bool, error) {
instance := appsv1.DaemonSet{}
if err := kubeClient.Get(
Expand Down
2 changes: 1 addition & 1 deletion pkg/run/install/install_vcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func installVCluster(kubeClient client.Client, name, namespace, fluxNamespace st
}
}

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(2*time.Second, 5*time.Minute, func() (bool, error) {
instance := appsv1.StatefulSet{}
if err := kubeClient.Get(
Expand Down
8 changes: 4 additions & 4 deletions pkg/run/session/connect/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (conn *Connection) waitForVCluster(vKubeConfig api.Config, errorChan chan e
return err
}

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
err = wait.PollImmediate(time.Millisecond*200, time.Minute*3, func() (bool, error) {
select {
case err := <-errorChan:
Expand All @@ -336,7 +336,7 @@ func (conn *Connection) getVClusterKubeConfig(vclusterName string, command []str
var err error
podName := conn.PodName
if podName == "" {
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
waitErr := wait.PollImmediate(time.Second, time.Second*6, func() (bool, error) {
// get vcluster pod name
var pods *corev1.PodList
Expand Down Expand Up @@ -456,7 +456,7 @@ func (conn *Connection) getVClusterKubeConfig(vclusterName string, command []str

func (conn *Connection) setServerIfExposed(vClusterName string, vClusterConfig *api.Config) error {
printedWaiting := false
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
err := wait.PollImmediate(time.Second*2, time.Minute*5, func() (done bool, err error) {
service, err := conn.kubeClient.CoreV1().Services(conn.Namespace).Get(context.TODO(), vClusterName, metav1.GetOptions{})
if err != nil {
Expand Down Expand Up @@ -605,7 +605,7 @@ func (conn *Connection) createServiceAccountToken(vKubeConfig api.Config) (strin
}
token := ""
conn.Log.Actionf("Create service account token for %s/%s", serviceAccountNamespace, serviceAccount)
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
err = wait.Poll(time.Second, time.Minute*3, func() (bool, error) {
// check if namespace exists
_, err := vKubeClient.CoreV1().Namespaces().Get(context.TODO(), serviceAccountNamespace, metav1.GetOptions{})
Expand Down
2 changes: 1 addition & 1 deletion pkg/run/session/connect/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func GetKubeConfig(ctx context.Context, kubeClient *kubernetes.Clientset, vclust
var kubeConfig *api.Config

printedWaiting := false
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
err := wait.PollImmediate(time.Second, time.Minute*10, func() (done bool, err error) {
podList, err := kubeClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{
LabelSelector: "app=vcluster,release=" + vclusterName,
Expand Down
10 changes: 5 additions & 5 deletions pkg/run/session/localkubernetes/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func minikubeProxy(vClusterName, vClusterNamespace string, rawConfig, vRawConfig
}

// test local connection
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
waitErr := wait.PollImmediate(time.Second, timeout, func() (bool, error) {
err = testConnectionWithServer(testvConfig, server)
if err != nil {
Expand Down Expand Up @@ -189,7 +189,7 @@ func directConnection(vRawConfig *clientcmdapi.Config, service *corev1.Service,

server := fmt.Sprintf("https://127.0.0.1:%v", service.Spec.Ports[0].NodePort)
var err error
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
waitErr := wait.PollImmediate(time.Second, timeout, func() (bool, error) {
err = testConnectionWithServer(vRawConfig, server)
if err != nil {
Expand Down Expand Up @@ -233,7 +233,7 @@ func createProxyContainer(vClusterName, vClusterNamespace string, rawConfig, vRa
}

server := fmt.Sprintf("https://127.0.0.1:%v", localPort)
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
waitErr := wait.PollImmediate(time.Second, timeout, func() (bool, error) {
err = testConnectionWithServer(vRawConfig, server)
if err != nil {
Expand Down Expand Up @@ -303,7 +303,7 @@ func CreateBackgroundProxyContainer(vClusterName, vClusterNamespace string, rawC
return "", errors.Errorf("error starting background proxy : %s %v", string(out), err)
}
server := fmt.Sprintf("https://127.0.0.1:%v", localPort)
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
waitErr := wait.PollImmediate(time.Second, time.Second*60, func() (bool, error) {
err = testConnectionWithServer(vRawConfig, server)
if err != nil {
Expand Down Expand Up @@ -370,7 +370,7 @@ func getServerFromExistingProxyContainer(vClusterName, vClusterNamespace string,
localPort, err := strconv.Atoi(strings.TrimSpace(string(out)))
if err == nil && localPort != 0 {
server := fmt.Sprintf("https://127.0.0.1:%v", localPort)
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
waitErr := wait.PollImmediate(time.Second, time.Second*5, func() (bool, error) {
err = testConnectionWithServer(vRawConfig, server)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/run/session/portforward/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func StartPortForwardingWithRestart(config *rest.Config, address, pod, namespace
log.Actionf("Restarting port forwarding")

// wait for loft pod to start
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
err := wait.PollImmediate(time.Second, time.Minute*10, func() (done bool, err error) {
pod, err := kubeClient.CoreV1().Pods(namespace).Get(context.Background(), pod, metav1.GetOptions{})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/run/session/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Remove(kubeClient client.Client, session *InternalSession) error {
result = multierror.Append(result, err)
}

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(2*time.Second, 5*time.Minute, func() (bool, error) {
instance := appsv1.StatefulSet{}
if err := kubeClient.Get(
Expand All @@ -62,7 +62,7 @@ func Remove(kubeClient client.Client, session *InternalSession) error {
result = multierror.Append(result, err)
}

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(2*time.Second, 5*time.Minute, func() (bool, error) {
pvc := corev1.PersistentVolumeClaim{}
if err := kubeClient.Get(
Expand Down
8 changes: 4 additions & 4 deletions pkg/run/watch/setup_dev_ks.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func ReconcileDevBucketSourceAndKS(ctx context.Context, log logger.Logger, kubeC
}

// wait for the reconciliation of dev-bucket to be done
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(interval, timeout, func() (bool, error) {
devBucket := &sourcev1.Bucket{}
if err := kubeClient.Get(ctx, types.NamespacedName{
Expand All @@ -444,7 +444,7 @@ func ReconcileDevBucketSourceAndKS(ctx context.Context, log logger.Logger, kubeC
}

// wait for devBucket to be ready
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(interval, timeout, func() (bool, error) {
devBucket := &sourcev1.Bucket{}
if err := kubeClient.Get(ctx, types.NamespacedName{
Expand Down Expand Up @@ -472,7 +472,7 @@ func ReconcileDevBucketSourceAndKS(ctx context.Context, log logger.Logger, kubeC
return err
}

//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.Poll(interval, timeout, func() (bool, error) {
devKs := &kustomizev1.Kustomization{}
if err := kubeClient.Get(ctx, types.NamespacedName{
Expand All @@ -488,7 +488,7 @@ func ReconcileDevBucketSourceAndKS(ctx context.Context, log logger.Logger, kubeC
}

devKs := &kustomizev1.Kustomization{}
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
devKsErr := wait.Poll(interval, timeout, func() (bool, error) {
if err := kubeClient.Get(ctx, types.NamespacedName{
Name: constants.RunDevKsName,
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/crd/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type defaultFetcher struct {
}

func (s *defaultFetcher) watchCRDs() {
//nolint:staticcheck
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
_ = wait.PollImmediateInfinite(watchCRDsFrequency, func() (bool, error) {
s.UpdateCRDList()

Expand Down

0 comments on commit a8f791b

Please sign in to comment.