Skip to content

Commit 6361f02

Browse files
authored
update dependencies and go version (#656)
1 parent 9d2050b commit 6361f02

9 files changed

Lines changed: 537 additions & 508 deletions

File tree

.github/workflows/e2e-info.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Go
1717
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
1818
with:
19-
go-version: '1.24'
19+
go-version: '1.25'
2020
- name: make
2121
run: make
2222
- name: Validate JSON

.github/workflows/integration-json.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Go
1717
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
1818
with:
19-
go-version: '1.24'
19+
go-version: '1.25'
2020
- name: make
2121
run: make
2222
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Set up Go
1414
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
1515
with:
16-
go-version: '1.24'
16+
go-version: '1.25'
1717
- name: make
1818
run: make
1919
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
@@ -34,7 +34,7 @@ jobs:
3434
- name: Set up Go
3535
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
3636
with:
37-
go-version: '1.24'
37+
go-version: '1.25'
3838
- name: make
3939
run: make
4040
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0

.github/workflows/release-and-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Set up Go
3939
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
4040
with:
41-
go-version: '1.24'
41+
go-version: '1.25'
4242
# Check if the newest tag already exists
4343
- name: Check if tag exist
4444
uses: mukunku/tag-exists-action@5c39604fe8aef7e65acb6fbcf96ec580f7680313 # v1.7.0

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
- name: Set up Go
1212
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
1313
with:
14-
go-version: '1.24'
14+
go-version: '1.25'
1515
- name: make
1616
run: make run-unit-tests

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24-alpine
1+
FROM golang:1.25-alpine
22

33
WORKDIR /draft
44

go.mod

Lines changed: 139 additions & 116 deletions
Large diffs are not rendered by default.

go.sum

Lines changed: 369 additions & 384 deletions
Large diffs are not rendered by default.

pkg/safeguards/helpers.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"helm.sh/helm/v3/pkg/chartutil"
1313

14+
apiconstraints "github.com/open-policy-agent/frameworks/constraint/pkg/apis/constraints"
1415
constraintclient "github.com/open-policy-agent/frameworks/constraint/pkg/client"
1516
"github.com/open-policy-agent/frameworks/constraint/pkg/client/drivers/rego"
1617
"github.com/open-policy-agent/frameworks/constraint/pkg/core/templates"
@@ -112,7 +113,11 @@ func getConstraintClient() (*constraintclient.Client, error) {
112113
return nil, fmt.Errorf("could not create rego driver: %w", err)
113114
}
114115

115-
c, err := constraintclient.NewClient(constraintclient.Targets(&target.K8sValidationTarget{}), constraintclient.Driver(driver))
116+
c, err := constraintclient.NewClient(
117+
constraintclient.Targets(&target.K8sValidationTarget{}),
118+
constraintclient.Driver(driver),
119+
constraintclient.EnforcementPoints(apiconstraints.WebhookEnforcementPoint),
120+
)
116121
if err != nil {
117122
return nil, fmt.Errorf("could not create constraint client: %w", err)
118123
}
@@ -140,6 +145,10 @@ func AddSafeguardCRIP() {
140145

141146
// loads constraint templates, constraints into constraint client
142147
func loadConstraintTemplates(ctx context.Context, c *constraintclient.Client, constraintTemplates []*templates.ConstraintTemplate) error {
148+
if c == nil {
149+
return fmt.Errorf("constraint client is nil")
150+
}
151+
143152
// AddTemplate adds the template source code to OPA and registers the CRD with the client for
144153
// schema validation on calls to AddConstraint. On error, the responses return value
145154
// will still be populated so that partial results can be analyzed.
@@ -154,6 +163,10 @@ func loadConstraintTemplates(ctx context.Context, c *constraintclient.Client, co
154163
}
155164

156165
func loadConstraints(ctx context.Context, c *constraintclient.Client, constraints []*unstructured.Unstructured) error {
166+
if c == nil {
167+
return fmt.Errorf("constraint client is nil")
168+
}
169+
157170
// AddConstraint validates the constraint and, if valid, inserts it into OPA.
158171
// On error, the responses return value will still be populated so that
159172
// partial results can be analyzed.
@@ -168,6 +181,10 @@ func loadConstraints(ctx context.Context, c *constraintclient.Client, constraint
168181
}
169182

170183
func loadManifestObjects(ctx context.Context, c *constraintclient.Client, objects []*unstructured.Unstructured) error {
184+
if c == nil {
185+
return fmt.Errorf("constraint client is nil")
186+
}
187+
171188
// AddData inserts the provided data into OPA for every target that can handle the data.
172189
// On error, the responses return value will still be populated so that
173190
// partial results can be analyzed.
@@ -198,6 +215,10 @@ func IsYAML(path string) bool {
198215

199216
// getObjectViolations executes validation on manifests based on loaded constraint templates and returns a map of manifest name to list of objectViolations
200217
func getObjectViolations(ctx context.Context, c *constraintclient.Client, objects []*unstructured.Unstructured) (map[string][]string, error) {
218+
if c == nil {
219+
return nil, fmt.Errorf("constraint client is nil")
220+
}
221+
201222
// Review makes sure the provided object satisfies all stored constraints.
202223
// On error, the responses return value will still be populated so that
203224
// partial results can be analyzed.

0 commit comments

Comments
 (0)