Allow setting OPA_VERSION_CHECK_SERVICE_URL=false#8411
Allow setting OPA_VERSION_CHECK_SERVICE_URL=false#8411folliehiyuki wants to merge 1 commit intoopen-policy-agent:mainfrom
Conversation
✅ Deploy Preview for openpolicyagent ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
a0fcf5a to
3316895
Compare
…on check Signed-off-by: Hoang Nguyen <folliekazetani@protonmail.com>
3316895 to
afabd8e
Compare
|
The rationale makes sense to me. I think I'd prefer it if we used a (new) boolean property for the on/off toggle, but I don't think I even saw this code before, so I'll wait to see what others think here 😅 |
|
Thanks for contributing. I've got a couple of questions:
Thank you! |
I am interested by this, there is no auto update logic, just notification of newer versions. This can be disabled with Please also note that while we do allow OPA to be packaged, the only officially supported means of installation on Linux is from our release binaries and container images. (https://www.openpolicyagent.org/docs?current-os=linux#1-download-opa) |
|
Since we allow pointing the URL somewhere else than that officially supported location, I find it hard to see why it shouldn’t be possible to disable entirely. |
|
@srenatus this already involves a build tag, no? The distro would not need to set any env var but just build with that flag set to modify the URL (or whatever) stored in the package level var. |
Builds tags != ldflags. I think yeah, you should be able to override the URL via ldflags, and perhaps have a check that sees if the URL is valid, and disables the lookup if it is. |
|
I think something like regal has would make sense, like a build tag (actual tag), On a related note, I like tools that report how they were installed in |
|
Thinking about it, we should make a certain |
|
@srenatus build tag or build flag matters little compared to build time vs runtime, which my message was in response to:
Unless the submitter answers your questions, I don’t think there’s much to do but close here though. |
At the moment, we simply inject an invalid HTTP endpoint into the
Yes, I'm the maintainer of opa package for Alpine Linux. I also use NixOS, so if this PR lands in a way or another, I can send an update to open-policy-agent package in Nixpkgs as well.
I'd like the version check to happen only when a user runs
I assume every distribution does this (Alpine Linux does for a lot of Go packages). Injecting these specific information at build time is a also way to tell users of those packages to send bug reports / update notifications to us package maintainers first instead of the upstream code base on GitHub.
👍 Please note that each distribution builds the same Go package differently. For example, in Alpine Linux, all Go packages are built with
I'm fine with any approaches, but I prefer that the mechanism can be utilized by both the users at runtime and the package providers at build time. With that said, I can go back to this PR this weekend. Until then, feel free to provide more info and point me to a right direction for the final implementation. |
|
@folliehiyuki, thanks for taking the time to respond here in such detail. Let's get this working in a way that works for you. It seems that package repos build things their own way E.g.
So I think a build tag might be the best foundation for this, but we might also add a make target for this option in case the list of things we need to do in future grows beyond a single build tag. What about |
👏 I think it's great that there's an opa package in aports. Thanks a bunch for your work on this 🎉 |
Seems fine to me. I don't have an idea how to implement the build tag approach at the moment, so let me look into it a bit more next week. From @anderseknert 's note, should I also add an environment variable, that the user can utilize with the default release? Would |
Why the changes in this PR are needed?
This PR provides a simple way to disable version check entirely. It's useful for downstream distribution of the
opabinary (e.g. Linux distros). We don't want users to go download the newer version on GitHub into their system PATH like/usr/binwhen being noticed of an update.Notes to assist PR review:
With this commit,
opa version -ccommand errors out, andopa runfails the check silently in the background. I don't know whether the approach is appropriate, but it produces the simplest patch.