Skip to content

Commit

Permalink
Fix chainlink ignoreFile flag being ignored (#1933)
Browse files Browse the repository at this point in the history
## Type of change
Fix a bug in chainlink

### What should this PR do?
Chainlink's ignoreFile flag value is currently used before being parsed,
ignoring whatever flag value was passed in and always using default.
This PR moves ignoreFile parsing after flag parsing so parsing comes
before usage.

### Why are we making this change?
Discovered a bunch of "localhost" urls being flagged in an
images-private run

https://github.com/chainguard-images/images-private/actions/runs/12058742634/job/33626025490?pr=6270
although it is in the specified ignoreFile

https://github.com/chainguard-images/images-private/blob/main/chainlink-ignore.json
investigated and landed here

### What are the acceptance criteria? 
This fixes a bug.

### How should this PR be tested?
```
cd /tools/chainlink
go run . -method GET -checkAll -hostname edu.chainguard.dev -ignoreFile /<code_location>/images-private/chainlink-ignore.json -contentDir /<code_location>/images-private/images/harbor/ -resultsFile ./res.json
```
  • Loading branch information
julienv3 authored Nov 28, 2024
1 parent 8370016 commit 731ba04
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/chainlink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ func init() {
// won't match anything like `../` or `./` or non-leading `/` URLs
// unmatched urls will go into the unchecked result accumulator
correctURLregex = regexp.MustCompile(`^(http|https|\/).+`)
}

func main() {
flag.Parse()

if err := ignores.read(); err != nil {
log.Fatalf("error loading ignores json: %v\n", err)
}
if err := ignores.compile(); err != nil {
log.Fatalf("error compiling ignores json: %v\n", err)
}
}

func main() {
flag.Parse()

err := processContentDir()
if err != nil {
Expand Down

0 comments on commit 731ba04

Please sign in to comment.