GoogleCloudPlatform / GoogleCloudPlatform/google-cloud-eclipse
Consider safer pattern to retrieve deploy preferences during deploy
- Dominant language
- Java
- Stars
- 90
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
The `DeployPreferences()` class is for saving/loading (App Engine standard) deploy parameters (such as a GCP project, a Google account, etc) to/from user preferences. As long as we have an `IProject` ref, we can conveniently retrieve such deploy preferences anywhere at any point by `new DeployPreferences(IProject)`. We do call this constructor to get values during deploy in a couple places. We don't have any problem currently as we do things right, but the current implementation has a potential risk:
- At the language level, `DeployPreferences` is mutable; you might get a different value later if someone changes the value somehow (which isn't currently the case) in the process of deploying.
- Although this isn't currently the case, the implementation of `DeployPreferences` may change in the future in a way that getting values always returns most-up-to-date preferences values (e.g., users updated the preferences while a deploy is in progress) rather than the values at the time when the instance is constructed by `new DeployPreferences(IProject)`.
So, for future safety, I think it is better to explicitly take an immutable snapshot of the preferences before launching a deploy job and passing the snapshot.
Contributor guide
Assessment
This issue has not been assessed yet.