leg100/otf

No way to create Team Tokens

Closed this issue · 6 comments

For building CI pipelines, it would be useful to have a Team Token.

These don't currently appear to be createable, at least via the UI.

Either that, or a way for a site-admin to create personal tokens for other people so we can create a user with limited permissions and do it that way.

leg100 commented

I suppose organization tokens don't fit your criteria?

I suppose organization tokens don't fit your criteria?

No, we need them to be able to trigger runs for our CI pipeline, which org tokens cannot. We'd also like to limit the permissions that the token has, which means either User or Team tokens.

I'm having a look at this, though no promises I can work it out :)

leg100 commented

I'm having a look at this, though no promises I can work it out :)

Give it a stab. Unfortunately there are quite a lot of things you need to do to introduce a new "feature":

  • Create/update relevant golang module: service endpoints, database layer code, web handlers, and the feature type itself.
  • Generate paths for navigating web links (make paths)
  • Create database migration
  • Write SQL queries and generate code from queries
  • Generate RBAC actions (make actions)
  • Unit tests (not probably necessary for this, as it is mostly boilerplate).
  • Browser-based integration test.
  • TFE API endpoints (optional, but it means people can script automation, and/or use the tfe provider to provision resources).
  • Hook up go-tfe API integration tests (these are maintained by Hashicorp).

Feel free to do as much as you can and I can make further contributions.

Got busy at work and didn't get much time to work on this.
Also spent a fair bit of time time in a version 1 that turned out to mostly just be me making a mess.

Decided to start from the TFE API and work inwards as then I don't need to worry about the UI for now :)

leg100 commented

Fixed by #624