fabric8-services / fabric8-jenkins-idler

OpenShift.io service to idle resp.unidle Jenkins instances
Apache License 2.0
4 stars 15 forks source link

WIP: Single user Idler v for test/debug purpose #284

Open aslakknutsen opened 6 years ago

aslakknutsen commented 6 years ago

Input: Namespace Basename, OSIO User UUID, CLuster URL and OS User Token

Watches builds and deployments in a single namespace relying only on a User token (require admin/edit of -jenkins ns to perform Idle/Unidle)

See cmd/fabric8-jenkins-idler-test/main.go for "var"s required.

Run on cli

go install -ldflags="-X github.com/fabric8-services/fabric8-jenkins-idler/internal/version.version=c931081" ./cmd/fabric8-jenkins-idler-test && fabric8-jenkins-idler-test

Or run/debug the test TestSingleIdler in cmd/fabric8-jenkins-idler-test/main_test.go

Currently uses a copied and modified v of idler.go. The changes are only related to passing in the namespace and switch between calling the 'WatchNamespaceXXX' Openshift Client to watch the Cluster or a given Client. (Trying to avoid changing the original code as much as possible during debugging)

aslakknutsen commented 6 years ago

In addition to this, it would be nice to maybe flip the 'ShouldIdle' toggle or introduce another toggle to 'IgnoreUser' in prod. That way you could temporarily disable the prod idler for a given user while you run a local debug session to not have it interfere.