Skip to content

Commit

Permalink
add version information for backfill-redis
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Nov 4, 2022
1 parent 9175f7d commit 57e7bc1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ jobs:

- name: container
run: |
make ko-local 2>&1 | tee output.txt
docker run --rm $(tail -1 output.txt) version
make ko-local
docker run --rm $(cat rekorImagerefs) version
docker run --rm $(cat cliImagerefs) version
docker run --rm $(cat redisImagerefs) --version
e2e:
runs-on: ubuntu-20.04
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ rekorServerImagerefs
rekorCliImagerefs
trillianServerImagerefs
trillianSignerImagerefs
rekorImagerefs
cliImagerefs
redisImagerefs
cosign.*
signature
rekor.pub
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,17 @@ sign-keyless-ci: ko
ko-local:
LDFLAGS="$(SERVER_LDFLAGS)" GIT_HASH=$(GIT_HASH) GIT_VERSION=$(GIT_VERSION) \
ko publish --base-import-paths \
--tags $(GIT_VERSION) --tags $(GIT_HASH) --local \
--tags $(GIT_VERSION) --tags $(GIT_HASH) --local --image-refs rekorImagerefs \
github.com/sigstore/rekor/cmd/rekor-server

LDFLAGS="$(CLI_LDFLAGS)" GIT_HASH=$(GIT_HASH) GIT_VERSION=$(GIT_VERSION) \
ko publish --base-import-paths \
--tags $(GIT_VERSION) --tags $(GIT_HASH) --local \
--tags $(GIT_VERSION) --tags $(GIT_HASH) --local --image-refs cliImagerefs \
github.com/sigstore/rekor/cmd/rekor-cli

LDFLAGS="$(SERVER_LDFLAGS)" GIT_HASH=$(GIT_HASH) GIT_VERSION=$(GIT_VERSION) \
ko publish --base-import-paths \
--tags $(GIT_VERSION) --tags $(GIT_HASH) --local \
--tags $(GIT_VERSION) --tags $(GIT_HASH) --local --image-refs redisImagerefs \
github.com/sigstore/rekor/cmd/backfill-redis

# This builds the trillian containers we rely on using ko for cross platform support
Expand Down
12 changes: 12 additions & 0 deletions cmd/backfill-redis/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ import (
"flag"
"fmt"
"log"
"os"

"github.com/go-openapi/runtime"
radix "github.com/mediocregopher/radix/v4"
"sigs.k8s.io/release-utils/version"

"github.com/sigstore/rekor/pkg/client"
"github.com/sigstore/rekor/pkg/generated/client/entries"
"github.com/sigstore/rekor/pkg/generated/models"
Expand Down Expand Up @@ -63,11 +66,18 @@ var (
startIndex = flag.Int("start", -1, "First index to backfill")
endIndex = flag.Int("end", -1, "Last index to backfill")
rekorAddress = flag.String("rekor-address", "", "Address for Rekor, e.g. https://rekor.sigstore.dev")
versionFlag = flag.Bool("version", false, "Print the current version of Backfill Redis")
)

func main() {
flag.Parse()

versionInfo := version.GetVersionInfo()
if *versionFlag {
fmt.Println(versionInfo.String())
os.Exit(0)
}

if *redisHostname == "" {
log.Fatal("address must be set")
}
Expand All @@ -84,6 +94,8 @@ func main() {
log.Fatal("rekor-address must be set")
}

log.Printf("running backfill redis Version: %s GitCommit: %s BuildDate: %s", versionInfo.GitVersion, versionInfo.GitCommit, versionInfo.BuildDate)

cfg := radix.PoolConfig{}
redisClient, err := cfg.New(context.Background(), "tcp", fmt.Sprintf("%s:%s", *redisHostname, *redisPort))
if err != nil {
Expand Down

0 comments on commit 57e7bc1

Please sign in to comment.