Skip to content

Commit a81ffe5

Browse files
committed
fix: resolve CI failures by normalizing line endings (LF), fixing path separators, and adding DCO sign-off
Signed-off-by: pittu sharma <pittusharma47@gmail.com>
1 parent d9baaff commit a81ffe5

5 files changed

Lines changed: 41 additions & 22 deletions

File tree

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
* text=auto eol=lf
2+
*.go text eol=lf
3+
*.md text eol=lf
4+
*.sh text eol=lf
5+
*.prom text eol=lf
6+
*.out text eol=lf
7+
*.txt text eol=lf
8+
*.yml text eol=lf
9+
*.yaml text eol=lf
10+
Makefile text eol=lf
11+
VERSION text eol=lf
12+
ttar text eol=lf

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ update_fixtures:
116116

117117
.PHONY: tools
118118
tools:
119-
@rm ./tools/tools >/dev/null 2>&1 || true
120-
@$(GO) build -o tools ./tools/...
119+
@rm -f ./tools/tools
120+
@$(GO) build -o tools/tools ./tools/main.go
121121

122122
.PHONY: test-e2e
123123
test-e2e: build collector/fixtures/sys/.unpacked collector/fixtures/udev/.unpacked tools

collector/textfile.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (c *textFileCollector) exportMTimes(mtimes map[string]time.Time, ch chan<-
175175
if c.mtime != nil {
176176
mtime = *c.mtime
177177
}
178-
ch <- prometheus.MustNewConstMetric(mtimeDesc, prometheus.GaugeValue, mtime, path)
178+
ch <- prometheus.MustNewConstMetric(mtimeDesc, prometheus.GaugeValue, mtime, filepath.ToSlash(path))
179179
}
180180
}
181181

@@ -208,12 +208,11 @@ func (c *textFileCollector) Update(ch chan<- prometheus.Metric) error {
208208
}
209209

210210
for _, f := range files {
211-
metricsFilePath := filepath.Join(path, f.Name())
212211
if !strings.HasSuffix(f.Name(), ".prom") {
213212
continue
214213
}
215-
216214
mtime, families, err := c.processFile(path, f.Name(), ch)
215+
metricsFilePath := filepath.ToSlash(filepath.Join(path, f.Name()))
217216

218217
for _, mf := range families {
219218
// Check for metrics with inconsistent help texts and take the first help text occurrence.

docs/METRICS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Node Exporter Metrics
1+
# Node Exporter Metrics
22

33
This file is auto-generated by `tools/doc_generator/main.go`.
44

@@ -248,7 +248,7 @@ This file is auto-generated by `tools/doc_generator/main.go`.
248248
| node_nfsd_read_ahead_cache_size_blocks | How large the read ahead cache is in blocks. | nfsd |
249249
| node_nfsd_reply_cache_hits_total | Total number of NFSd Reply Cache hits (client lost server response). | nfsd |
250250
| node_nfsd_reply_cache_misses_total | Total number of NFSd Reply Cache an operation that requires caching (idempotent). | nfsd |
251-
| node_nfsd_reply_cache_nocache_total | Total number of NFSd Reply Cache non-idempotent operations (rename/delete/…). | nfsd |
251+
| node_nfsd_reply_cache_nocache_total | Total number of NFSd Reply Cache non-idempotent operations (rename/delete/). | nfsd |
252252
| node_nfsd_requests_total | Total number NFSd Requests by method and protocol. | nfsd |
253253
| node_nfsd_rpc_errors_total | Total number of NFSd RPC errors by error type. | nfsd |
254254
| node_nfsd_server_rpcs_total | Total number of NFSd RPCs. | nfsd |
@@ -456,7 +456,7 @@ This file is auto-generated by `tools/doc_generator/main.go`.
456456
| node_wifi_station_transmit_failed_total | The total number of times a station has failed to send a packet. | wifi |
457457
| node_wifi_station_transmit_retries_total | The total number of times a station has had to retry while sending a packet. | wifi |
458458
| node_wifi_station_transmitted_packets_total | The total number of packets transmitted by a station. | wifi |
459-
| node_xfrm_acquire_error_packets_total | State hasnΓÇÖt been fully acquired before use | xfrm |
459+
| node_xfrm_acquire_error_packets_total | State hasn’t been fully acquired before use | xfrm |
460460
| node_xfrm_fwd_hdr_error_packets_total | Forward routing of a packet is not allowed | xfrm |
461461
| node_xfrm_in_buffer_error_packets_total | No buffer is left | xfrm |
462462
| node_xfrm_in_error_packets_total | All errors not matched by other | xfrm |

tools/doc_generator/main.go

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ type metric struct {
3333
}
3434

3535
type collectorInfo struct {
36-
name string
37-
files []string
38-
metrics []metric
39-
flags []flagInfo
40-
dataSources []string
41-
platforms []string
36+
name string
37+
files []string
38+
metrics []metric
39+
flags []flagInfo
40+
dataSources []string
41+
platforms []string
4242
}
4343

4444
type flagInfo struct {
@@ -246,11 +246,19 @@ func main() {
246246
}
247247

248248
// Output global METRICS.md
249-
fmt.Println("# Node Exporter Metrics")
250-
fmt.Println("\nThis file is auto-generated by `tools/doc_generator/main.go`.")
251-
fmt.Println("\n| Metric | Description | Collector |")
252-
fmt.Println("| --- | --- | --- |")
253-
249+
metricsFile := filepath.Join("docs", "METRICS.md")
250+
mf, err := os.Create(metricsFile)
251+
if err != nil {
252+
fmt.Fprintf(os.Stderr, "Error creating %s: %v\n", metricsFile, err)
253+
os.Exit(1)
254+
}
255+
defer mf.Close()
256+
257+
fmt.Fprintln(mf, "# Node Exporter Metrics")
258+
fmt.Fprintln(mf, "\nThis file is auto-generated by `tools/doc_generator/main.go`.")
259+
fmt.Fprintln(mf, "\n| Metric | Description | Collector |")
260+
fmt.Fprintln(mf, "| --- | --- | --- |")
261+
254262
keys := make([]string, 0, len(collectors))
255263
for k := range collectors {
256264
keys = append(keys, k)
@@ -260,7 +268,7 @@ func main() {
260268
for _, k := range keys {
261269
c := collectors[k]
262270
for _, m := range c.metrics {
263-
fmt.Printf("| %s | %s | %s |\n", m.name, m.help, c.name)
271+
fmt.Fprintf(mf, "| %s | %s | %s |\n", m.name, m.help, c.name)
264272
}
265273
}
266274

@@ -276,7 +284,7 @@ func main() {
276284
fmt.Fprintf(os.Stderr, "Error creating %s: %v\n", filename, err)
277285
continue
278286
}
279-
287+
280288
fmt.Fprintf(f, "# %s collector\n\n", c.name)
281289
fmt.Fprintf(f, "The %s collector exposes metrics about %s.\n\n", c.name, c.name)
282290

@@ -306,7 +314,7 @@ func main() {
306314
fmt.Fprintf(f, "| %s | %s | %s |\n", m.name, m.help, labels)
307315
}
308316
}
309-
317+
310318
f.Close()
311319
}
312320
}

0 commit comments

Comments
 (0)