Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define services and service schemas #224

Closed
cdcarter opened this issue Jan 30, 2017 · 3 comments
Closed

Define services and service schemas #224

cdcarter opened this issue Jan 30, 2017 · 3 comments

Comments

@cdcarter
Copy link
Contributor

cdcarter commented Jan 30, 2017

Intro

Right now, services are an adhoc dict that gets stored in the keychain based on whatever the cli is doing - but tasks expect services to:

  • exist,
  • be configured, &
  • have certain properties

Additionally, there is no way for users of the tool to add their own arbitrary services to the keychain (or add an additional attribute for a service).

Lastly, there is currently no way to determine which services a project may include tasks for.

I propose that the cumulusci.yml file add a services node at both the global and project level.

Configuration

services:
  github:
    description: Configure connection for github tasks, e.g. Create Release
    attributes:
      username: 
        description: The Github username to use for tasks
        required: True
      password:
        description:  Github password to use for tasks.  It is recommended to use a Github Application Token instead of password to allow bypassing 2fa.
         required: True
      email:
        description: The email address to used by Github tasks when an operation requires an email address.
        required: True

All tasks included in the core distribution that need a service should have their service defined in cumulusci/cumulusci.yml.

Projects may individually define additional services, or add additional attributes to global services in their project specific cumulusci.yml files.

CLI Usage

This proposal adds three new commands to the command line:

service connect SERVICE_NAME

(venv) ➜  supported-employment git:(release/2.0) ✗ cci service connect github
**Username: **
**Password: **
**Email: **

service show SERVICE_NAME

(venv) ➜  NPSP-Extension-Template git:(master) ✗ cci service show github
{
    "email": "[email protected]",
    "password": "fhdjsl4378hfjkds743hjfd74hjk1tw3o",
    "username": "cdcarter"
}

service list

(venv) ➜  NPSP-Extension-Template git:(master) ✗ cci service list
service      description                                                          is_configured
-----------  -------------------------------------------------------------------  -------------
github       Configure connection for github tasks, e.g. Create Release           *
mrbelvedere  Configure connection for mrbelvedere tasks, e.g. MrbelvederePublish
apextestsdb  Configure connection for ApexTestsDB tasks, e.g. ApextestsdbUpload   *
saucelabs    Configure connection for saucelabs tasks.

Task Usage

BaseProjectKeychain.get_service() is the current API for getting a service. This method should validate that all required attributes for that service live on the keychain, and throw an error if an attribute is missing.

rejected solution

A task could define a services property that lists its required services, like task_options. On init of task, validate that the services are complete.

Rejected in favor of keeping existing API for tasks and including specific exceptions for ServiceNotConfigured and ServiceMissingAttribute. ServiceNotConfigured is an existing exception, ServiceMissingAttribute would be new.

@cdcarter
Copy link
Contributor Author

this is a proposal and feedback before implementation is welcome 👍

@jlantz
Copy link
Contributor

jlantz commented Jan 31, 2017

We chatted about this in Slack but just to record my thoughts here... this looks great.

Down the road we could explore a better system for tasks to associate themselves with services. That would help with things like adding something to cci task info that calls out the dependency on the service.

@cdcarter
Copy link
Contributor Author

@jlantz - would you expect cci service list to list all configured services (current behavior) or all available services with a * for configured

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants