Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for request key capture #10

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
test:
runs-on: ubuntu-latest
container:
image: golang:1.19-bullseye
image: golang:1.20-bullseye
needs: set-version
env:
SEMVER: ${{ needs.set-version.outputs.semVer }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
pr:
runs-on: ubuntu-latest
container:
image: golang:1.19-bullseye
image: golang:1.20-bullseye
needs: set-version
env:
REVISION: $GITHUB_SHA
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
release:
runs-on: ubuntu-latest
container:
image: golang:1.19-bullseye
image: golang:1.20-bullseye
env:
FOO: Bar
needs: set-version
Expand Down
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ bingen:
GOOS=$$os CGO_ENABLED=0 go build -mod=readonly -buildvcs=false $(LDFLAGS) -o dist/uiseeder-$$os ./cmd; \
done

bingen_darwin_arm:
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -mod=readonly -buildvcs=false $(LDFLAGS) -o dist/uiseeder-darwin-arm ./cmd;

build: clean install bingen

build_ci: clean install_ci bingen
Expand All @@ -40,11 +43,18 @@ release:
btr: build tag release
echo "ran build tag release"

# TEST
test: test_prereq
go test ./... -v -mod=readonly -race -coverprofile=.coverage/out | go-junit-report > .coverage/report-junit.xml && \
test_unit_run: test_prereq
go test ./... -timeout 30s -v -mod=readonly -race -coverprofile=.coverage/out > .coverage/test.out; exit 0

test_coverage:
gocov convert .coverage/out | gocov-xml > .coverage/report-cobertura.xml

test_unit_report:
go-junit-report -in .coverage/test.out > .coverage/report-junit.xml

# TEST
test: test_unit_run test_coverage test_unit_report

test_ci:
go test ./... -mod=readonly

Expand Down
16 changes: 15 additions & 1 deletion cmd/uistrategy/uistrategy.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"io"
"os"

"github.com/dnitsch/configmanager"
Expand All @@ -14,6 +15,7 @@ import (
var (
path string
verbose bool
output string
rootCmd = &cobra.Command{
Use: "uistrategy",
RunE: runActions,
Expand All @@ -32,6 +34,7 @@ func Execute() {
func init() {
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
rootCmd.PersistentFlags().StringVarP(&path, "input", "i", "", "Path to the input file containing the config definition for the UIStrategy")
rootCmd.PersistentFlags().StringVarP(&output, "ouput-path", "p", ".report/report.json", "Path to output if report ")
}

// runActions parses and executes the provided actions
Expand All @@ -47,7 +50,11 @@ func runActions(cmd *cobra.Command, args []string) error {
if err := cmdutil.YamlParseInput(conf, f, cm); err != nil {
return err
}
ui := uistrategy.New(conf.Setup).WithLogger(logger(verbose))
w, err := getWriter(output)
if err != nil {
return err
}
ui := uistrategy.New(conf.Setup).WithLogger(logger(verbose)).WithWriter(w)

return cmdutil.RunActions(ui, conf)
}
Expand All @@ -58,3 +65,10 @@ func logger(verbose bool) log.Logger {
}
return log.New(os.Stderr, log.ErrorLvl)
}

func getWriter(out string) (io.Writer, error) {
if out == "stdout" {
return os.Stdout, nil
}
return os.OpenFile(out, os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0644)
}
108 changes: 77 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,54 +1,100 @@
module github.com/dnitsch/uistrategy

go 1.19
go 1.21

require (
github.com/dnitsch/configmanager v1.13.0
github.com/dnitsch/simplelog v1.5.1
github.com/go-rod/rod v0.112.3
github.com/spf13/cobra v1.6.1
github.com/dnitsch/configmanager v1.19.1
github.com/dnitsch/simplelog v1.8.0
github.com/go-rod/rod v0.114.1
github.com/spf13/cobra v1.7.0
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.11.0 // indirect
cloud.google.com/go/compute v1.18.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.12.0 // indirect
cloud.google.com/go/secretmanager v1.10.0 // indirect
github.com/aws/aws-sdk-go v1.44.207 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/zerologr v1.2.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.4.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/awsutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/vault/api v1.9.0 // indirect
github.com/hashicorp/vault/api/auth/aws v0.4.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/spyzhov/ajson v0.7.2 // indirect
github.com/ysmood/fetchup v0.2.3 // indirect
github.com/ysmood/got v0.34.1 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/api v0.110.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.12.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.3 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.8 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.8 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 // indirect
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.18.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssm v1.35.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.12.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.19.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.28 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.27 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.35 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.29 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.36 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.29 // indirect
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.19.11 // indirect
github.com/aws/aws-sdk-go-v2/service/ssm v1.36.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.12.13 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.13 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.19.3 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/rs/zerolog v1.28.0 // indirect
github.com/rs/zerolog v1.29.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/ysmood/goob v0.4.0 // indirect
github.com/ysmood/gson v0.7.3 // indirect
github.com/ysmood/leakless v0.8.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// replace github.com/dnitsch/configmanager v1.10.0 => ../configmanager
Loading
Loading