paws-r / paws

Paws, a package for Amazon Web Services in R
https://www.paws-r-sdk.com
Other
309 stars 37 forks source link

Simplify `set_os_env_cache()` cache to work on Posit Workbench #707

Closed fh-mthomson closed 8 months ago

fh-mthomson commented 8 months ago

Closes #706

Introduced in https://github.com/paws-r/paws/pull/693

fh-mthomson commented 8 months ago

@DyfanJones I don't know enough about the use case for this cache functionality to test in depth, but I was able to confirm:

  1. On both Mac and Posit Workbench (jammy image), I could (a) load the package from this branch and (b) install via devtools::install_github("fh-mthomson/paws/paws.common@mthomson/os_env_vars")
  2. Cache in package:paws.common looks ~similar across branches

Before (Mac):

image

After (Mac):

image
codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (33de2e8) 85.18% compared to head (1b44ae5) 85.32%.

:exclamation: Current head 1b44ae5 differs from pull request most recent head 13007dc. Consider uploading reports for the commit 13007dc to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #707 +/- ## ========================================== + Coverage 85.18% 85.32% +0.13% ========================================== Files 68 204 +136 Lines 4861 14599 +9738 ========================================== + Hits 4141 12456 +8315 - Misses 720 2143 +1423 ``` [see 138 files with indirect coverage changes](https://app.codecov.io/gh/paws-r/paws/pull/707/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paws-r)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

DyfanJones commented 8 months ago

@fh-mthomson can you check if this installs correctly please :)

remotes::install_github("fh-mthomson/paws/paws.common@mthomson/os_env_vars", force = T)

Also when you have initialised paws.common can you check the environmental cache to make sure it is picking it up as expected :)

Here is an example of me assigning "AWS_DUMMY" to an environmental variable:

library(paws.common)
paws.common:::os_env_cache |> as.list()
#> $AWS_DUMMY
#> [1] "Hello World"
fh-mthomson commented 8 months ago

Confirmed! Adding AWS_TEST to my ~/.Renvirion then reloading:

> library(paws.common)
> 
> paws.common:::os_env_cache |> as.list()
$AWS_TEST
[1] "yes"

Then, if I run a command to initialize temporary AWS creds, I see these as well:

> detach("package:paws.storage", unload = TRUE)
> detach("package:paws.common", unload = TRUE)
> library(paws.common)
> paws.common:::os_env_cache |> as.list() %>% names()
[1] "AWS_CREDENTIAL_EXPIRATION" "AWS_TEST"                  "AWS_ACCESS_KEY_ID"         "AWS_SESSION_TOKEN"        
[5] "AWS_SECRET_ACCESS_KEY"  
DyfanJones commented 8 months ago

I will release this in the next couple of days as it is stopping people from installing paws.common on linux (which is not good :P)

fh-mthomson commented 8 months ago

Thank you for your quick resolution, as always @DyfanJones !