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

Export teacher applications to gdrive #43476

Merged
merged 4 commits into from
Nov 11, 2021
Merged

Export teacher applications to gdrive #43476

merged 4 commits into from
Nov 11, 2021

Conversation

megcrenshaw
Copy link
Contributor

@megcrenshaw megcrenshaw commented Nov 9, 2021

Updates the existing export file to use a new gsheet. I followed the process detailed in #39120, which references #32597.

Screen Shot 2021-11-11 at 7 57 30 AM

Testing story

Tested end-to-end locally with development secrets configured in Secret Manager. I added the configuration needed in development.yml.erb for local testing––to overwrite values in the Secrets Manager, put in locals.yml.

Things to check:

  • The Secrets Manager has the correct applications_2022_2023_gsheet_key for the file in different environments. The key in the development environment is different for testing.
  • The cdo-gdrive-export-prod account has write access to the file. Note that if you're testing locally, you need the staging equivalent account for write access to the file, unless you have prod credentials set up in your locals.yml file.

image

If you are wanting to put credentials into your locals.yml file, it should look something like

gdrive_export_secret:
  type: "service_account"
  project_id: ""
  private_key_id: ""
  private_key: "-----BEGIN PRIVATE KEY-----\n       \n-----END PRIVATE KEY-----\n"
  client_email: ""
  client_id: ""
  auth_uri: ""
  token_uri: ""
  auth_provider_x509_cert_url: ""
  client_x509_cert_url: ""

Let me know if you're wanting to test locally and running into trouble.

Deployment strategy

Follow-up work

Privacy

Security

All secrets are in the AWS Secrets Manager.

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@megcrenshaw megcrenshaw marked this pull request as draft November 9, 2021 18:46
@megcrenshaw megcrenshaw requested review from a team and breville November 11, 2021 13:43
@megcrenshaw megcrenshaw marked this pull request as ready for review November 11, 2021 13:44
enrollments_summer_2020_gsheet_key:
# Used for exporting the workshop data to a gsheet
applications_2022_2023_gsheet_key: !Secret
gdrive_export_secret: !Secret
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this gdrive_export_secret secret used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It authorizes the gdrive session when running the script so that the account can then go to the file and write to it (if the file gives the account permission)

enrollments_summer_2020_gsheet_key:
# Used for exporting the workshop data to a gsheet
applications_2022_2023_gsheet_key: !Secret
gdrive_export_secret: !Secret

javabuilder_private_key: !Secret
javabuilder_key_password: !Secret
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit off-topic, but this reminds me that there may be some secret keys in our developer setup process that could be added in this way, so that we don't have to manually add them to locals.yml. properties_encryption_key comes to mind for me:

# Code.org engineers should obtain this from AWS Secrets Manager at:
# https://console.aws.amazon.com/secretsmanager/home?region=us-east-1#/secret?name=development%2Fcdo%2Fproperties_encryption_key
# Contributors should ask a Code.org engineer for this if needed.
#properties_encryption_key: ''

@megcrenshaw , are there any other shared keys which come to mind for you from your recent setup experience?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. properties_encryption_key: is the only key in my locals file right now, and it's already part of Secrets Manager. Shall I go ahead and add it to the development yml file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please, that would be great!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could please also change the lines in locals.yml.default from

 # Code.org engineers should obtain this from AWS Secrets Manager at: 
 # https://console.aws.amazon.com/secretsmanager/home?region=us-east-1#/secret?name=development%2Fcdo%2Fproperties_encryption_key 

to something like this?

 # Code.org engineers with AWS credentials should get this automatically via AWS Secrets Manager.

the note about Contributors should probably stay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

Copy link
Member

@davidsbailey davidsbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Meg!

@megcrenshaw megcrenshaw merged commit e114ff4 into staging Nov 11, 2021
@megcrenshaw megcrenshaw deleted the teacher-app-export branch November 11, 2021 21:41
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

Successfully merging this pull request may close these issues.

None yet

3 participants