Skip to content

Commit 55b301f

Browse files
committed
fix: using new timeout option of bingo to make sure the build won't fail during the hot days
1 parent 662416e commit 55b301f

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.ci.openshift.org/openshift/release:golang-1.19 as builder
1+
FROM registry.ci.openshift.org/openshift/release:golang-1.20 as builder
22

33
WORKDIR /work
44

@@ -23,4 +23,4 @@ COPY --from=builder /work/bin/obsctl-reloader-rules-checker /usr/bin/
2323

2424
WORKDIR /work
2525
COPY .yamllint /
26-
ENTRYPOINT ["/usr/bin/obsctl-reloader-rules-checker"]
26+
ENTRYPOINT ["/usr/bin/obsctl-reloader-rules-checker"]

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Once again, the `-h` / `--help` flag is pretty explicit about those checks. Here
120120
- You have to checkout the code.
121121
- The following tools must be present on your computer:
122122
- `make`
123-
- `go` (version 1.19 or later)
123+
- `go` (version 1.20 or later)
124124

125125
To build the binary you just have to run:
126126
```
@@ -155,7 +155,7 @@ Local development is not just about building the code. It is also about making s
155155
- You have to checkout the code.
156156
- The following tools must be present on your computer:
157157
- `make`
158-
- `go` (version 1.19 or later)
158+
- `go` (version 1.20 or later)
159159
- a container engine: either `docker` or `podman`
160160
- [`yamllint`](https://github.com/adrienverge/yamllint) (eventually run `make yamllint-tool` to install the tool)
161161
- [`golangci-lint`](https://golangci-lint.run/usage/install/)

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/observatorium/obsctl-reloader-rules-checker
22

3-
go 1.19
3+
go 1.20
44

55
require (
66
github.com/go-git/go-git/v5 v5.7.0

hack/install-go-tools.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ cd "$(dirname $BASH_SOURCE)/.."
1111

1212
go install -mod=readonly github.com/bwplotka/bingo@latest
1313

14-
# The following PR has been merged in bingo:
15-
# https://github.com/bwplotka/bingo/pull/142
16-
# Once the new bingo version is released, make sure to append '-t 0' in below commands
1714
unset GOFLAGS
18-
bingo get -v -l github.com/prometheus/prometheus/cmd/promtool@v0.46.0
19-
bingo get -v -l github.com/cloudflare/pint/cmd/pint@v0.44.1
15+
bingo get -v -l -t 0 github.com/prometheus/prometheus/cmd/promtool@v0.46.0
16+
bingo get -v -l -t 0 github.com/cloudflare/pint/cmd/pint@v0.44.1

main.go

+14-7
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,10 @@ func runTests(testsDirPath, rulesDirPath string) {
525525
return fmt.Errorf("unable to create a temporary directory: %w", err)
526526
}
527527

528-
defer os.RemoveAll(tempDirPath)
528+
//defer os.RemoveAll(tempDirPath)
529+
log.Println(tempDirPath)
530+
531+
var allRulesObj ruleGroupsObj
529532

530533
for _, ruleFileRelPath := range testObj.RuleFiles {
531534
if !isNamedAsARuleFile(ruleFileRelPath) {
@@ -544,20 +547,24 @@ func runTests(testsDirPath, rulesDirPath string) {
544547
return fmt.Errorf("unexpected error: %w", err)
545548
}
546549

547-
ruleFileTempPath := filepath.Join(tempDirPath, ruleFileRelPath)
550+
var ruleGroupsObj ruleGroupsObj
548551

549-
if err := os.MkdirAll(filepath.Dir(ruleFileTempPath), 0700); err != nil {
552+
if err := ruleObj.Spec.Decode(&ruleGroupsObj); err != nil {
550553
return fmt.Errorf("unexpected error: %w", err)
551554
}
552555

553-
if err := storeAsYaml(&ruleObj.Spec, ruleFileTempPath); err != nil {
554-
return fmt.Errorf("unexpected error: %w", err)
555-
}
556+
allRulesObj.Groups = append(allRulesObj.Groups, ruleGroupsObj.Groups...)
556557
}
557558

559+
if err := storeAsYaml(&allRulesObj, filepath.Join(tempDirPath, "rules.yaml")); err != nil {
560+
return fmt.Errorf("unexpected error: %w", err)
561+
}
562+
563+
testObj.RuleFiles = []string{"rules.yaml"}
564+
558565
testTempPath := filepath.Join(tempDirPath, filepath.Base(testPath))
559566

560-
if err := os.WriteFile(testTempPath, testContent, 0600); err != nil {
567+
if err := storeAsYaml(&testObj, testTempPath); err != nil {
561568
return fmt.Errorf("unexpected error: %w", err)
562569
}
563570

0 commit comments

Comments
 (0)