Skip to content

Commit 8036bb9

Browse files
authored
Upgrade to actions/cache@v4 (#728)
* Upgrade to actions/cache@v4 * Added option to update golangci-lint * Migrated golangci-lint configuration * Addressed linting issues * Use the latest of docker/setup-buildx-action@v3
1 parent 59e99a9 commit 8036bb9

14 files changed

+62
-26
lines changed

.github/workflows/validate-merge-queue-e2e-test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
cache-dependency-path: test/go.sum
3838
- name: Set up Docker Buildx
3939
uses: docker/setup-buildx-action@v3
40+
with:
41+
version: latest
4042
- name: Setup AWS credentials
4143
uses: aws-actions/configure-aws-credentials@v4
4244
with:

.github/workflows/validate-pull-request-presubmit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
go-version: ${{ env.GO_VERSION }}
2020
check-latest: true
21-
- uses: actions/cache@v3
21+
- uses: actions/cache@v4
2222
with:
2323
path: |
2424
~/.cache/go-build

.golangci.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1-
# https://golangci-lint.run/usage/configuration
1+
version: "2"
22
linters:
33
disable:
4-
- errcheck
4+
- errcheck
5+
exclusions:
6+
generated: lax
7+
presets:
8+
- comments
9+
- common-false-positives
10+
- legacy
11+
- std-error-handling
12+
paths:
13+
- third_party$
14+
- builtin$
15+
- examples$
16+
rules:
17+
- linters:
18+
- staticcheck
19+
text: "ST1012:"
20+
- linters:
21+
- staticcheck
22+
text: "QF1003:"
23+
- linters:
24+
- staticcheck
25+
text: "QF1001:"
26+
formatters:
27+
exclusions:
28+
generated: lax
29+
paths:
30+
- third_party$
31+
- builtin$
32+
- examples$

pkg/controllers/accesslogpolicy_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (r *accessLogPolicyReconciler) targetRefExists(ctx context.Context, alp *an
247247
grpcRoute := &gwv1.GRPCRoute{}
248248
err = r.client.Get(ctx, targetRefNamespacedName, grpcRoute)
249249
default:
250-
return false, fmt.Errorf("Access Log Policy targetRef is for unsupported Kind: %s", alp.Spec.TargetRef.Kind)
250+
return false, fmt.Errorf("access Log Policy targetRef is for unsupported Kind: %s", alp.Spec.TargetRef.Kind)
251251
}
252252

253253
if err != nil && !errors.IsNotFound(err) {
@@ -294,10 +294,10 @@ func (r *accessLogPolicyReconciler) updateAccessLogPolicyAnnotations(
294294
for _, als := range accessLogSubscriptions {
295295
if als.Spec.EventType != core.DeleteEvent {
296296
oldAlp := alp.DeepCopy()
297-
if alp.ObjectMeta.Annotations == nil {
298-
alp.ObjectMeta.Annotations = make(map[string]string)
297+
if alp.Annotations == nil {
298+
alp.Annotations = make(map[string]string)
299299
}
300-
alp.ObjectMeta.Annotations[anv1alpha1.AccessLogSubscriptionAnnotationKey] = als.Status.Arn
300+
alp.Annotations[anv1alpha1.AccessLogSubscriptionAnnotationKey] = als.Status.Arn
301301
if err := r.client.Patch(ctx, alp, client.MergeFrom(oldAlp)); err != nil {
302302
r.eventRecorder.Event(alp, corev1.EventTypeWarning, k8s.FailedReconcileEvent,
303303
"Failed to update annotation due to "+err.Error())

pkg/controllers/serviceexport_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (r *serviceExportReconciler) reconcile(ctx context.Context, req ctrl.Reques
121121
return client.IgnoreNotFound(err)
122122
}
123123

124-
if srvExport.ObjectMeta.Annotations["application-networking.k8s.aws/federation"] != "amazon-vpc-lattice" {
124+
if srvExport.Annotations["application-networking.k8s.aws/federation"] != "amazon-vpc-lattice" {
125125
return nil
126126
}
127127
r.log.Debugf(ctx, "Found matching service export %s-%s", srvExport.Name, srvExport.Namespace)

pkg/deploy/lattice/listener_manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (d *defaultListenerManager) create(ctx context.Context, latticeSvcId string
109109
resp, err := d.cloud.Lattice().CreateListenerWithContext(ctx, &listenerInput)
110110
if err != nil {
111111
return model.ListenerStatus{},
112-
fmt.Errorf("Failed CreateListener %s due to %s", aws.StringValue(listenerInput.Name), err)
112+
fmt.Errorf("failed CreateListener %s due to %s", aws.StringValue(listenerInput.Name), err)
113113
}
114114
d.log.Infof(ctx, "Success CreateListener %s, %s", aws.StringValue(resp.Name), aws.StringValue(resp.Id))
115115

@@ -280,7 +280,7 @@ func (d *defaultListenerManager) Delete(ctx context.Context, modelListener *mode
280280
d.log.Debugf(ctx, "Listener already deleted")
281281
return nil
282282
}
283-
return fmt.Errorf("Failed DeleteListener %s, %s due to %s", modelListener.Status.Id, modelListener.Status.ServiceId, err)
283+
return fmt.Errorf("failed DeleteListener %s, %s due to %s", modelListener.Status.Id, modelListener.Status.ServiceId, err)
284284
}
285285

286286
d.log.Infof(ctx, "Success DeleteListener %s, %s", modelListener.Status.Id, modelListener.Status.ServiceId)

pkg/deploy/lattice/rule_synthesizer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (r *ruleSynthesizer) createOrUpdateRules(ctx context.Context, rule *model.R
8787
}
8888
status, err := r.ruleManager.Upsert(ctx, rule, stackListener, stackSvc)
8989
if err != nil {
90-
return fmt.Errorf("Failed RuleManager.Upsert due to %s", err)
90+
return fmt.Errorf("failed RuleManager.Upsert due to %s", err)
9191
}
9292
rule.Status = &status
9393

pkg/deploy/lattice/target_group_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (s *defaultTargetGroupManager) create(ctx context.Context, modelTg *model.T
103103
resp, err := lattice.CreateTargetGroupWithContext(ctx, &createInput)
104104
if err != nil {
105105
return model.TargetGroupStatus{},
106-
fmt.Errorf("Failed CreateTargetGroup %s due to %s", latticeTgName, err)
106+
fmt.Errorf("failed CreateTargetGroup %s due to %s", latticeTgName, err)
107107
}
108108
s.log.Infof(ctx, "Success CreateTargetGroup %s", latticeTgName)
109109

pkg/deploy/lattice/target_group_synthesizer_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,16 @@ func Test_DoNotDeleteCases(t *testing.T) {
240240
},
241241
}
242242
svcExportModelTg := baseModelTg
243-
svcExportModelTg.Spec.TargetGroupTagFields.K8SSourceType = model.SourceTypeSvcExport
243+
svcExportModelTg.Spec.K8SSourceType = model.SourceTypeSvcExport
244244

245245
mockSvcExportTgBuilder.EXPECT().BuildTargetGroup(ctx, gomock.Any()).Return(&svcExportModelTg, nil)
246246

247247
stack := core.NewDefaultStack(core.StackID{Name: "foo", Namespace: "bar"})
248248
svcModelTg := baseModelTg
249249
svcModelTg.ResourceMeta = core.NewResourceMeta(stack, "AWS:VPCServiceNetwork::TargetGroup", "tg-id")
250-
svcModelTg.Spec.TargetGroupTagFields.K8SSourceType = model.SourceTypeHTTPRoute
251-
svcModelTg.Spec.TargetGroupTagFields.K8SRouteName = "route"
252-
svcModelTg.Spec.TargetGroupTagFields.K8SRouteNamespace = "route-ns"
250+
svcModelTg.Spec.K8SSourceType = model.SourceTypeHTTPRoute
251+
svcModelTg.Spec.K8SRouteName = "route"
252+
svcModelTg.Spec.K8SRouteNamespace = "route-ns"
253253
stack.AddResource(&svcModelTg)
254254

255255
mockTGManager.EXPECT().IsTargetGroupMatch(ctx, gomock.Any(), gomock.Any(), gomock.Any()).Return(true, nil)

pkg/deploy/lattice/targets_manager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ func (s *defaultTargetsManager) registerTargets(
119119
}
120120
resp, err := s.cloud.Lattice().RegisterTargetsWithContext(ctx, &registerTargetsInput)
121121
if err != nil {
122-
registerTargetsError = errors.Join(registerTargetsError, fmt.Errorf("Failed to register targets from VPC Lattice Target Group %s due to %s", modelTg.Status.Id, err))
122+
registerTargetsError = errors.Join(registerTargetsError, fmt.Errorf("failed to register targets from VPC Lattice Target Group %s due to %s", modelTg.Status.Id, err))
123123
}
124124
if len(resp.Unsuccessful) > 0 {
125-
registerTargetsError = errors.Join(registerTargetsError, fmt.Errorf("Failed to register targets from VPC Lattice Target Group %s for chunk %d/%d, unsuccessful targets %v",
125+
registerTargetsError = errors.Join(registerTargetsError, fmt.Errorf("failed to register targets from VPC Lattice Target Group %s for chunk %d/%d, unsuccessful targets %v",
126126
modelTg.Status.Id, i+1, len(chunks), resp.Unsuccessful))
127127
}
128128
s.log.Debugf(ctx, "Successfully registered %d targets from VPC Lattice Target Group %s for chunk %d/%d",
@@ -152,10 +152,10 @@ func (s *defaultTargetsManager) deregisterTargets(
152152
}
153153
resp, err := s.cloud.Lattice().DeregisterTargetsWithContext(ctx, &deregisterTargetsInput)
154154
if err != nil {
155-
deregisterTargetsError = errors.Join(deregisterTargetsError, fmt.Errorf("Failed to deregister targets from VPC Lattice Target Group %s due to %s", modelTg.Status.Id, err))
155+
deregisterTargetsError = errors.Join(deregisterTargetsError, fmt.Errorf("failed to deregister targets from VPC Lattice Target Group %s due to %s", modelTg.Status.Id, err))
156156
}
157157
if len(resp.Unsuccessful) > 0 {
158-
deregisterTargetsError = errors.Join(deregisterTargetsError, fmt.Errorf("Failed to deregister targets from VPC Lattice Target Group %s for chunk %d/%d, unsuccessful targets %v",
158+
deregisterTargetsError = errors.Join(deregisterTargetsError, fmt.Errorf("failed to deregister targets from VPC Lattice Target Group %s for chunk %d/%d, unsuccessful targets %v",
159159
modelTg.Status.Id, i+1, len(chunks), resp.Unsuccessful))
160160
}
161161
s.log.Debugf(ctx, "Successfully deregistered %d targets from VPC Lattice Target Group %s for chunk %d/%d", len(resp.Successful), modelTg.Status.Id, i+1, len(chunks))

0 commit comments

Comments
 (0)