Coder Social home page Coder Social logo

Confusing configuration file about hydrophone HOT 5 CLOSED

xrstf avatar xrstf commented on August 28, 2024
Confusing configuration file

from hydrophone.

Comments (5)

xrstf avatar xrstf commented on August 28, 2024 1

I feel uncomfortable hving the config file be auto-generated and then used on the next run. Suppose I run hydrophone --dry-run once, the flag gets remembered and on the next invocation it's automatically dry-run. After the first customized invocation of hydrophone, all subsequent runs of hydrophone --help would show potentially wrong default values.

IMHO the --config should be an explicit flag and additional flags would override what's loaded from the config (i.e. flags have higher precedence than the config file, if a config file is even given). The format and possible flags of the config file should be documented in the readme. There could also be an additional --save-config that, if --config is given, will write/create it with the values used for that hydrophone run.

from hydrophone.

rjsadow avatar rjsadow commented on August 28, 2024

I believe this is because of the way cobra creates the config on intiail run. We ran into this once before and I thought we were able to get around it.

@rakshitgondwal can you take a peek?

/assign @rakshitgondwal

from hydrophone.

rakshitgondwal avatar rakshitgondwal commented on August 28, 2024

Sure @rjsadow, will have a look later as I am a little short on bandwidth.

from hydrophone.

xrstf avatar xrstf commented on August 28, 2024

Tell me how we should change it and I can also take a stab at it. :-)

from hydrophone.

reetasingh avatar reetasingh commented on August 28, 2024

its because we are reading previous config file and if it already exists we do not overwrite it. see https://github.com/kubernetes-sigs/hydrophone/blob/main/cmd/root.go#L191-L199
if there is no need to read previous config file we can instead overwrite it every time.

err := viper.WriteConfig()
		if err != nil {
			log.Fatal("Error:", err)
		}

tried above code and works fine and sets the correct path

reeta@Reetas-MacBook-Pro hydrophone % mkdir ex1
reeta@Reetas-MacBook-Pro hydrophone % ../bin/hydrophone
zsh: no such file or directory: ../bin/hydrophone
reeta@Reetas-MacBook-Pro hydrophone % cd ex1           
reeta@Reetas-MacBook-Pro ex1 % ../bin/hydrophone
12:00:48 INF API endpoint: https://127.0.0.1:62613
12:00:48 INF Server version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.0", GitCommit:"4ce5a8954017644c5420bae81d72b09b735c21f0", GitTreeState:"clean", BuildDate:"2022-05-19T15:42:59Z", GoVersion:"go1.18.1", Compiler:"gc", Platform:"linux/arm64"}
12:00:48 INF Using namespace: conformance
12:00:48 INF Using conformance image: registry.k8s.io/conformance:v1.24.0
12:00:48 INF Using busybox image: registry.k8s.io/e2e-test-images/busybox:1.36.1-1
12:00:48 INF Test framework will start 1 thread(s) and use verbosity level 4.
12:00:48 INF Downloading e2e.log to /Users/reeta/git/hydrophone/ex1/e2e.log...
12:00:48 INF Downloading junit_01.xml to /Users/reeta/git/hydrophone/ex1/junit_01.xml...
12:00:48 ERR Failed to download results: download failed: command terminated with exit code 1 (stderr: cat: can't open '/tmp/results/junit_01.xml': No such file or directory
).
reeta@Reetas-MacBook-Pro ex1 % cd ..
reeta@Reetas-MacBook-Pro hydrophone % mkdir ex2
reeta@Reetas-MacBook-Pro hydrophone % cd ex2
reeta@Reetas-MacBook-Pro ex2 % ../bin/hydrophone
12:01:00 INF API endpoint: https://127.0.0.1:62613
12:01:00 INF Server version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.0", GitCommit:"4ce5a8954017644c5420bae81d72b09b735c21f0", GitTreeState:"clean", BuildDate:"2022-05-19T15:42:59Z", GoVersion:"go1.18.1", Compiler:"gc", Platform:"linux/arm64"}
12:01:00 INF Using namespace: conformance
12:01:00 INF Using conformance image: registry.k8s.io/conformance:v1.24.0
12:01:00 INF Using busybox image: registry.k8s.io/e2e-test-images/busybox:1.36.1-1
12:01:00 INF Test framework will start 1 thread(s) and use verbosity level 4.
12:01:00 INF Downloading e2e.log to /Users/reeta/git/hydrophone/ex2/e2e.log...
12:01:00 INF Downloading junit_01.xml to /Users/reeta/git/hydrophone/ex2/junit_01.xml...
12:01:00 ERR Failed to download results: download failed: command terminated with exit code 1 (stderr: cat: can't open '/tmp/results/junit_01.xml': No such file or directory
).
reeta@Reetas-MacBook-Pro ex2 % 

from hydrophone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.