oathkeeper icon indicating copy to clipboard operation
oathkeeper copied to clipboard

wip: update to the recent x version

Open dadrus opened this issue 3 years ago • 4 comments

@zepatrik: This the work in progress PR, you helped me today with.

Related issue(s)

None I'm aware of.

Checklist

  • [x] I have read the contributing guidelines.
  • [x] I have referenced an issue containing the design document if my change introduces a new feature.
  • [x] I am following the contributing code guidelines.
  • [x] I have read the security policy.
  • [x] I confirm that this pull request does not address a security vulnerability. If this pull request addresses a security. vulnerability, I confirm that I got green light (please contact [email protected]) from the maintainers to push the changes.
  • [ ] I have added tests that prove my fix is effective or that my feature works.
  • [ ] I have added or changed the documentation.

Further Comments

Work in progress. ;)

Current status: Does not compile as following needs still to be fixed:

github.com/ory/oathkeeper/driver/health
../driver/health/event_manager_default.go:64:27: cannot use listener.Validate (type func() error) as type healthx.ReadyChecker in assignment

github.com/ory/oathkeeper/driver/configuration
../driver/configuration/provider_viper.go:332:28: undefined: wiperx

dadrus avatar Feb 16 '22 19:02 dadrus

@zepatrik: It would be great if you could take a look at event_manager_default.go:64:27. I'll try to resolve the other one by myself

dadrus avatar Feb 16 '22 19:02 dadrus

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

:white_check_mark: dadrus
:white_check_mark: zepatrik
:x: phaus
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Mar 10 '22 10:03 CLAassistant

Even the updated code compiles, there is an issue with the updated golang version (required by the current x version and also for making use the embed directive). Starting with go 1.13 a change in the "flag" package has been introduced, which makes flags.Parse panic if a flag was already defined. This means also that flag.Parse is not allowed to be used in the Init function. Unfortunately a couple of oathkeeper (indirect) dependencies (even in the latest version) do that. This results in a panic saying that the v flag is redefined

goroutine 1 [running]:
flag.(*FlagSet).Var(0xc00007c180, {0x1c912c8, 0xc000268ee0}, {0x1827032, 0x1}, {0x18312f8, 0x9})
	/opt/golang-v1.17.5/src/flag/flag.go:879 +0x2f4
flag.(*FlagSet).IntVar(...)
	/opt/golang-v1.17.5/src/flag/flag.go:658
flag.(*FlagSet).Int(0xc0008094c0, {0x1827032, 0x1}, 0x0, {0x18312f8, 0x9})
	/opt/golang-v1.17.5/src/flag/flag.go:671 +0x7e
flag.Int(...)
	/opt/golang-v1.17.5/src/flag/flag.go:678
github.com/google/martian/v3.init()
	/home/dimi/go/pkg/mod/github.com/google/martian/[email protected]/init.go:24 +0x65

when trying to start any of the tests or trying to start the compiled oathkeeper binary. The above panic relates to https://github.com/google/martian/issues/309. Other dependencies, which have the same issue are github.com/Azure/go-autorest/autorest/adal and github.com/Azure/go-autorest/autorest.

An approach recommended at many places, like having a separate file in the main module with following contents

package main

import (
	"github.com/google/martian/v3"
)

var _ = func() bool {
	martian.Init()
	return true
}()

doesn't resolve the issue, as we then run into

goroutine 1 [running]:
flag.(*FlagSet).Var(0xc00007c2a0, {0x1c91790, 0x28b40e8}, {0x182702a, 0x1}, {0x1844519, 0x14})
	/opt/golang-v1.17.5/src/flag/flag.go:879 +0x2f4
flag.Var(...)
	/opt/golang-v1.17.5/src/flag/flag.go:894
github.com/golang/glog.init.0()
	/home/dimi/go/pkg/mod/github.com/golang/[email protected]/glog.go:401 +0xc5

which doesn't call flag.Parse in its init function, but does also define the v flag and the panic message is again about the redefinition of the v flag. Applying the same pattern as above is not possible due to the private level of the init function in glog. The glog, as well as the martian dependencies are indirect

I really appreciate if somebody knows how to resolve this

dadrus avatar Mar 10 '22 14:03 dadrus

Sorry for replying so late. This is the root cause of the problem: https://github.com/dgraph-io/ristretto/pull/292

I fixed this with this rewrite:

replace github.com/dgraph-io/ristretto => github.com/ory/ristretto fix-log

aeneasr avatar Mar 25 '22 10:03 aeneasr

Superseded by #999

aeneasr avatar Sep 07 '22 08:09 aeneasr