-
Notifications
You must be signed in to change notification settings - Fork 17
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
add tool for config file validation and envvar replacement #94
Conversation
Opening this even though I don't like the solution to the schema needing to not be a parent of the go file solution it uses of requiring use of a Makefile. But since there wasn't a meeting this week and I haven't gotten any responses on slack I figured I'd just open the existing solution and go from there with restructuring. So I haven't bothered adding the github actions tests and publishing releases stuff. |
e42cbff
to
2e8a5e4
Compare
I marked this as ready for review because maybe that is why it wasn't getting any reviews... I still don't like it though. I think the structure is wrong but wanted feedback, esp from Go users, on how to better structure it. But also in general if it would be ok that the code was just interspersed with the rest of the repo (as in, put |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing some tooling, looking to use it.
According to the spec, environment variable substitution should not be recursive.
2e8a5e4
to
649dee3
Compare
Update: I wasn't properly supporting types as the library was turning stuff like |
I think issues with substitution have been resolved. Only thing is it now prefixes substituted values with the tag in yaml:
|
When this is accepted as the path forward I can add github action based publishing of cli binaries and docker image. |
I think this is a reasonable direction. We can always iterate on the technologies used under the covers since they are abstracted away behind the docker interface. This provides a useful capability for end users and SDK implementations alike. |
ac33cef
to
b2b7c83
Compare
@jack-berg ok, I've added binary and docker publish support to the github actions. Docker images are published to ghcr. Binary releases are built on tags with a tool called Open questions:
|
@tsloughter can we go through these in person at the next config SIG meeting on 8/5? Not sure if you can make it, but seems like it'd be easier than working through these questions async. |
@jack-berg yes, and agreed. I can do my best to make the meeting on Monday. Likely can only do half the meeting, but won't know which half until closer to start time... |
In the case of yaml we can have an unquoted environment variable that when replaced keeps the appropriate type. Like ${IM_TRUE} becomes `true` and not `"true"` as it would be in the case of json where the string would be quoted `"${IM_TURE}"` in the first place.
854033d
to
cb25f5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be useful to use the same tools as the collector uses for shipping binaries of the collector? goreleaser has worked pretty well and does simplify the github action configuration needed
You can see an example of the configuration https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/.github/workflows/base-ci-goreleaser.yaml
I would also be happy to help move to that tool if its deemed useful
@jack-berg I finally updated to accept a schema as an option to the cli. Also broke the version from versioning with the schema and added a prefix Something I'd like to add, but can be added after a merge, is a command to print the schema version that is embedded in the tool. But it doesn't seem the version is anywhere in the schema itself? A version of the schema is based solely on the git tag it is associated with? That makes it tough.. I was hoping it was just a field I could read from |
@codeboten I'm fine with whatever. I used cargo-dist because I had previous experience with it from another project and really liked it, then used it again on a Go project so knew it worked for those. I take it there is a Pro plan that could be used, since most features are behind the Pro plan (ones being used here with cargo-dist)? At least looks like it? https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/.github/workflows/base-ci-goreleaser.yaml#L69 |
Right, we use the pro version for the collector releases. I don't have a strong preference other than that i'm more familiar with goreleaser 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few small lingering questions but this seems like a great start.
Co-authored-by: jack-berg <[email protected]>
f35c3b7
to
9f210cb
Compare
@jack-berg I updated the Dockerfile to build in the binary and the shelltests to be able to use a bin from anywhere (not just |
To support this change the runner now copies the built cli from the builder stage of the main Dockerfile and the Dockerfile.shelltest was removed. To support running in both local environments and Docker the shelltests depend on the cli being in the path and the Docker image adds `/` to the PATH, where it copes the binary from the first stage, and the makefile run of the otel_config_validator on the examples will add the validator dir to the path at the end so it is only used if `/otel_config_validator` isn't in the PATH.
9f210cb
to
c3b2f7c
Compare
No description provided.