orbitalci / orbital

Orbital is a self-hosted CI system for solo/small consulting dev teams. Written in Rust.
GNU General Public License v3.0
29 stars 2 forks source link

Cannot re-add polling rule after deleting existing rule - null value in column "credentials_id" violates not-null constraint #215

Closed tjtelan closed 5 years ago

tjtelan commented 5 years ago

I'm not sure if it is an important detail that this was for an existing watched repo...

We used to have a polling rule for this repo ui-gg. In an attempt to update the rule to watch another branch, it was deleted with ocelot poll delete.

Upon trying to re-add, we're met with this error:

$ ocelot poll -cron "* * * * *" -branches "master,demo" -acct-repo level11consulting/ui-gg
Flag -vcs-type not set, detecting from git origin url
Detected vcs type of BITBUCKET
unable to set up vcs polling for repo ui-gg/level11consulting! error: rpc error: code = Unavailable desc = unable to insert poll into storage: pq: null value in column "credentials_id" violates not-null constraint

One thing to notice is that the reported account/repo is reversed to ui-gg/level11consulting. Since there is no account for ui-gg, it makes sense that the column would have ended up being null.

My planned workaround is going to be manually add the rule into the polling_repos database. I need to look in the code to see it this is going to be enough...

tjtelan commented 5 years ago

Adding output with the undocumented DEBUGGIT env var...

$ DEBUGGIT=1 ocelot poll -cron "* * * * *" -branches "master,demo" -acct-repo "level11consulting/ui-gg"
Flag -vcs-type not set, detecting from git origin url
Detected vcs type of BITBUCKET
DEBUGGIT -- splitting and setting acct repo
DEBUGGIT -- &commandhelper.OcyHelper{Hash:"", AcctRepo:"level11consulting/ui-gg", Repo:"ui-gg", Account:"level11consulting", VcsTypeStr:"ERROR", VcsType:1, SuppressUI:false}
DEBUGGIT -- checking connection of ocy-admin-grpc.metaverse.l11.com:443
DEBUGGIT -- &pb.PollRequest{Account:"level11consulting", Repo:"ui-gg", Cron:"* * * * *", Branches:"master,demo", Type:1, LastCronTime:(*timestamp.Timestamp)(nil), LastHashes:map[string]string(nil), XXX_NoUnkeyedLiteral:struct {}{}, XXX_unrecognized:[]uint8(nil), XXX_sizecache:0}
unable to set up vcs polling for repo ui-gg/level11consulting! error: rpc error: code = Unavailable desc = unable to insert poll into storage: pq: null value in column "credentials_id" violates not-null constraint
tjtelan commented 5 years ago

I was able to get the rule updated manually.

I originally left the last_cron_time column null, but then all of ocelot poll list stopped working. This is unexpected for me, considering that field is nullable.

tjtelan commented 5 years ago

In https://github.com/tjtelan/orbitalci/tree/worker_exploration, I've been removing these columns and references in the codebase just to get a successful build. Since we are redesigning subscribe builds I am going to close this.