Skip to content

Commit

Permalink
context moved to main
Browse files Browse the repository at this point in the history
Signed-off-by: David Fridrich <[email protected]>
  • Loading branch information
gauron99 committed Feb 10, 2025
1 parent 784d546 commit b581f13
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions hack/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package main

import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
)

func main() {
Expand All @@ -19,11 +22,26 @@ func main() {
fmt.Fprintf(os.Stderr, "expected exactly 1 argument: '%v'\n", args)
os.Exit(1)
}

// Set up context for possible signal inputs to not disrupt cleanup process.
// This is not gonna do much for workflows since they finish and shutdown
// but in case of local testing - dont leave left over resources on disk/RAM.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
go func() {
<-sigs
cancel()
<-sigs
os.Exit(130)
}()

switch args[0] {
case "update-builder":
updateBuilder()
err = updateBuilder(ctx)

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

too many arguments in call to updateBuilder

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / build / Build

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / build / Build

too many arguments in call to updateBuilder

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / Unit Test (21, ubuntu-latest)

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / Unit Test (21, ubuntu-latest)

too many arguments in call to updateBuilder

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / Unit Test (21, macos-latest)

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / Unit Test (21, macos-latest)

too many arguments in call to updateBuilder

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / analyze / Analyze CodeQL

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / analyze / Analyze CodeQL

too many arguments in call to updateBuilder

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

too many arguments in call to updateBuilder

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / style / Golang / Lint

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / style / Golang / Lint

too many arguments in call to updateBuilder

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / Podman Test (ubuntu-latest)

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / Podman Test (ubuntu-latest)

too many arguments in call to updateBuilder

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / Integration Test (ubuntu-latest)

updateBuilder(ctx) (no value) used as value

Check failure on line 42 in hack/main.go

View workflow job for this annotation

GitHub Actions / Integration Test (ubuntu-latest)

too many arguments in call to updateBuilder
case "update-components":
err = updateComponentVersions()
err = updateComponentVersions(ctx)

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

too many arguments in call to updateComponentVersions

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / build / Build

too many arguments in call to updateComponentVersions

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / Unit Test (21, ubuntu-latest)

too many arguments in call to updateComponentVersions

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / Unit Test (21, macos-latest)

too many arguments in call to updateComponentVersions

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / analyze / Analyze CodeQL

too many arguments in call to updateComponentVersions

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

too many arguments in call to updateComponentVersions

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / style / Golang / Lint

too many arguments in call to updateComponentVersions

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / Podman Test (ubuntu-latest)

too many arguments in call to updateComponentVersions

Check failure on line 44 in hack/main.go

View workflow job for this annotation

GitHub Actions / Integration Test (ubuntu-latest)

too many arguments in call to updateComponentVersions
default:
fmt.Fprintf(os.Stderr, "unknown argument '%s', don't know which hack/ script to run", args[0])
os.Exit(1)
Expand Down

0 comments on commit b581f13

Please sign in to comment.