Skip to content

Investigate using organisation secret for Stata License key #139

@Jongmassey

Description

@Jongmassey

Timebox: 1/2 day

We currently require read permission to the opensafely/server-instructions repo such that OpenSAFELY CLI can contact it to get the Stata license key.

"repositories": {
"opensafely/server-instructions": {
"permissions": {
"contents": "read"

This was added in order to enable Stata actions to be run locally within a codespace/interactive Stata development via opensafely exec. On starting a new codespace, this configuration causes a users to be prompted to authorise access to this permission request. This has caused some confusion with new users, particularly those going through the Getting Started Guide. There is a troubleshooting codespaces entry for this prompt in the docs, but it's not front-and-centre.

It would be nice if we could remove this permission and corresponding prompt.

job-runner (which is vendored into the CLI) looks for a environment variable containing the key, and if this is not set it will try to contact the github repo in question.

https://github.com/opensafely-core/job-runner/blob/a4e9cb4a1ff57f9751b970c4f6530d95755ff6bd/jobrunner/cli/local_run.py#L336-L340

There is an opensafely organisation GitHub Action Secret (thanks, @lucyb ) which contains the stata license key which is used to enable running of Stata actions in CI.

Also available are GitHub Codespace Secrets - if we were to set an opensafely organisation codespace STATA_LICENSE secret, this would set this as an env var for all codespaces started from repos in the opensafely organisation. By setting this env var, I believe we would no longer need the cross-repository permission to be configured here.

HOWEVER

Note: Organization-level secrets and variables are not accessible by private repositories for GitHub Free. For more information about upgrading your GitHub subscription

we might not be on the right plan for this I've been informed we have Github Team not Free so this should be OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions