Skip to content

Automation Variables

To run the automation locally, several environment variables must be set. These variables must contain JSON data, which is validated by Pydantic.

Configuring the Automations

Note

Because of when in the chain of automation this validation occurs, nearly every variable in this list must be set. Pydantic will crab at you for anything which is missing.

To simplify, we suggest creating a .env file at the root of this repository and sourcing its contents into your preferred shell. For example:

1
2
export JIRA_CONFIG='{"username": "jira_user", "password": "jira_user_password", "server": "https://jira.example.com/"}'
export CC_HOURS_SUMMARY_CONFIG='{"base_confluence_url": "https://openedx.atlassian.net/wiki/", "cc_page_id": 3156344833, "organization_name": "OpenCraft", "commitment_level": 20, "filter_id": 14904}'

This can then be brought into your current environment like so:

1
source .env

Note

The json-based variable examples provided have inline comments, which are not valid JSON. You may need to remove them for this to work.

CC_HOURS_SUMMARY_CONFIG

Used by: CC Summary

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
{
  // The URL of the Atlassian Confluence installation that hosts the CC wiki page.
  "base_confluence_url": "https://openedx.atlassian.net/wiki/",
  // The page ID of the confluence page where the CC listing lives.
  "cc_page_id": 3156344833,
  // Our company name, used for the lookup on the CC listing page.
  "organization_name": "OpenCraft",
  // The per-month commitment level the CC program currently requires.
  "commitment_level": 20,
  // The ID of the filter in JIRA to use to find CC worklog hours.
  // The Jira login credentials must be able to access this filter, and
  // if you need to update it, you can log in to Jira with them to
  // update it.
  "filter_id": 14906,
  // Topic ID on Discourse for posting the summary. If omitted, the report
  // will be run without posting anything. A copy is always printed to console
  // either way.
  "discourse_topic_id": 1955,
  // IDs of tempo account categories which are billable.
  "billable_category_type_ids": [1]
}

DEBUG

Used by: Zoom Migrations

1
export DEBUG=True
[Optional] Setting this to true would allow you to download and upload videos without deleting them from zoom.

DISCOURSE_CONFIG

Used by: CC Summary, Zoom Migrations

Discourse api url, key, username and topic_ids for use in the sprint retrospective recording posts.

1
2
3
4
5
6
{
  "api_url": "https://forum.opencraft.com/",
  "api_key": "Xxx",
  "username": "Xxx",
  "topic_ids": {"cell_name": 1, "cell_name2": 2}
}

DRIVE_FOLDER_IDS

Used by: Zoom Migrations

Map of IDs of the folders in drive to be used as base directory. All folders will be created inside this directory. Please share these directories with the service account.

1
2
3
4
{
    "general_base_dir_id": "xxxx", // directory used for general zoom meetings
    "retro_base_dir_id": "Xsaddx" // directory used for retrospective zoom meetings
}

EMAIL_SETTINGS

Used by: Zoom Migrations

Configuration for sending emails.

1
2
3
4
5
6
7
8
{
  "use_tls": true,
  "port": 1025,
  "host": "xxxxxxxxx",
  "host_user": "xxx",
  "host_password": "xxx",
  "from_email": "xxxxxxxx@xxxxxxx.xxx"
}

GOOGLE_API_CREDENTIALS

Used by: Zoom Migrations

Copy the contents of token_json from this store and set it as value of creds_or_token environment variable as shown below. If you want to use a different google account, you can create new credentials for a desktop application by following this document. If the script fails with invalid credentials error, copy contents of credentials_json and set it as value of creds_or_token env and run python -m automation.libs.google locally to get updated token.

Production Values

This structure should be used in CI/Prod:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  // set value of token in CI/prod.
  "creds_or_token": {
    "token": "...",
    "refresh_token": "...",
    "token_uri": "...",
    "client_id": "...",
    "client_secret": "...",
    "scopes": [
      "..."
    ],
    "expiry": "..."
  }
}

Local Testing Values

This structure should be used when testing locally:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
{
  // set value of credentials_json locally to get updated token and replace it.
  "creds_or_token": {
    "installed": {
      "client_id": "...",
      "project_id": "...",
      "auth_uri": "...",
      "token_uri": "...",
      "auth_provider_x509_cert_url": "...",
      "client_secret": "...",
      "redirect_uris": [
        "http://localhost"
      ]
    }
  },
  "scopes": [
    "https://www.googleapis.com/auth/drive.file",
    "https://www.googleapis.com/auth/drive.metadata"
  ],
}

HANDBOOK_SUMMARY_NO_OF_DAYS

Used by: Handbook Summary

The number of days back that we should scan for merge requests to this repository when posting a summary.

1
export HANDBOOK_SUMMARY_NO_OF_DAYS=14

HANDBOOK_SUMMARY_POST_FORUM_ID

Used by: Handbook Summary

The forum topic ID to post handbook summaries to.

1
export HANDBOOK_SUMMARY_POST_FORUM_ID=1334

JIRA_CONFIG

Used by: CC Summary

The JIRA config contains basic authentication details for a Jira user with access to Tempo time reports, and a filter which returns issues tagged with the CoreContributor label. Note that filters have their own permissions, so you may need to create this filter under the user whose login details you are providing.

1
2
3
4
5
6
7
8
{
  // The username of the Jira account.
  "username": "jira_user",
  // The password of the Jira user pulling the reports.
  "password": "jira_user_password",
  // Your JIRA server.
  "server": "https://jira.example.com/"
}

RETROSPECTIVE_CONFIG

Used by: Zoom Migrations

Configuration specifically for migrating sprint retrospective meetings.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
  // Text to be used for generating forum post message
  "message_body":"**{sprint_name} Sprint Retrospective Meeting**\n\n <iframe src=\"https://drive.google.com/file/d/{file_id}/preview\" width=\"640\" height=\"360\" frameborder=\"0\" allowfullscreen></iframe>",
  "zoom_account":
      {
          "client_id": "xxxxxxxxxxxxxxxxxxxxxx",
          "client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
          "account_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
          "user_id": "example@example.com",
          "recipients": [],
          "last_n_days": 7,
          "pattern": "(?P<cell_name>.*) - synchronous sprint retrospective$"
      },
  // api url to fetch sprint names from
  "sprint_name_url":"https://some-host/sprint_names/?active_sprint=true",
  // auth header for sprint_name_url
  "headers": {
      "Content-Type": "application/json",
      "Authorization": "Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  },
  "dummy_sprint_names": {"bebop": "BB.278", "serenity": "SE.278"} // Optional: to be used for testing purpose only
}

ZOOM_ACCOUNTS

Used by: Zoom Migrations

Create a variable with list of Zoom accounts in the below format. You can optionally set start, end date and pattern to filter recordings. Credentials (client_id, client_secret and account_id) can be generated by creating an OAuth app in Zoom marketplace. The steps can be found here.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[
  // Zoom account 1
  {
      "client_id": "xxxxxxxxxxxxxxxxxxxxxx",
      "client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "account_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "user_id": "me", // optional: zoom user id
      // recipients will recieve a notification email about successful and failed videos
      "recipients": ["xxxxx@xxxxxxxxx.xxx"],
      "drive_folder_name": "xxxxxxxxxxxxxx",
      "start": "2022-07-01 00:00:00", // optional
      "end": "2022-07-08 00:00:00", // optional
      "pattern": "^.* - sprint retrospective$" // optional
  },
  // Zoom account 2
  {
      "client_id": "xxxxxxxxxxxxxxxxxxxxxx",
      "client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "account_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "recipients": ["xxxxx@xxxxxxxxx.com"],
      "drive_folder_name": "xxxxxxxxxxxxxx",
      "last_n_days": 7 // Download videos from last 7 days
  }
]