-
Notifications
You must be signed in to change notification settings - Fork 91
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
Update vendored renv
; update script to allow taking tagged versions
#683
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idle musing about the renv-updater script.
@@ -7,12 +12,29 @@ desc <- read.dcf("DESCRIPTION", all = TRUE) | |||
if (!identical(desc$Package, "packrat")) | |||
stop("script must be run from packrat root directory") | |||
|
|||
# determine which tag we're downloading, if any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you feel about requiring a ref? That could be a commit or a SHA, but would force us to always be explicit about what renv code we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel that strongly. I made this choice for two reasons:
- It looks like it's more complex to shallow clone a ref than a tag or branch
- The old TODO commend indicated that the author was thinking about branches ¯_(ツ)_/¯
Also
renv
has about one tag per commit onmain
, so it's functionally not too different
tools/tools-sync-renv.R
Outdated
system("git clone --depth 1 https://github.com/rstudio/renv") | ||
} else if (length(tag) == 1) { | ||
# check out the tagged version | ||
git_clone_cmd <- paste0("git clone --branch ", tag, " --depth 1 https://github.com/rstudio/renv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header comment indicates the current commit hash; should it also include the tag/ref (which may be a commit)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I'll include the argument that was used to clone a specific tag if one was provided
# This script updates the vendored version of renv. It must be run from the | ||
# Packrat root directory. By default, uses the current version of renv on main. | ||
# You can pass a single tag as an argument after --args to use that version. | ||
# R -f /tools/test.R --args 0.15.5-48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are renv tags ever overwritten? It appears as if @kevinushey generally bumps the version, but I don't know if that's true of every commit.
Should we suggest using commit references rather than tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see what it would be like to use commit references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do this would require changing the conditional flow to the following, and would only accept full shas, not abbreviations.
if (is.null(ref)) {
# check out the latest renv sources
system("git clone --depth 1 https://github.com/rstudio/renv")
twd <- setwd("renv")
} else if (length(ref) == 1) {
# check out the tagged version
dir.create("renv")
twd <- setwd("renv")
system("git init")
system("git remote add origin https://github.com/rstudio/renv")
system(paste("git fetch --depth 1 origin", ref))
system("git checkout FETCH_HEAD")
}
gitCommitHash <- system("git rev-parse HEAD", intern = TRUE)
setwd(twd)
I'm going to leave this here for now, and not make this change unless you feel strongly that this is better. I feel comfortable treating tags on renv
as reasonable ways to find commits, and as you wrote in another comment, the header comment in the resulting renv.R
file mentions the commit that was used, so… I don't think this causes too much of a problem.
@aronatkins I updated logic to remove one of the conditional statements by just capturing the command to use. Now the message at the top of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to adjust further. We can continue to iterate on the renv sync script as we take additional updates.
@@ -1,6 +1,6 @@ | |||
# | |||
# Auto-generated by 'tools/tools-sync-renv.R'. | |||
# Cloned from renv using tag: 0.15.5-48. | |||
# Auto-generated by 'tools/tools-sync-renv.R' at 2022-08-09 16:19:51 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel like the timestamp adds information and could do without it.
verified on packrat branch
|
This PR updates the embedded version of
renv
used by Packrat. Since the currentHEAD
on therenv
repo is not passing CI, I took the previous version. To do this, I modified thetools-sync-renv.R
script to allow passing a single argument, like so:If there are zero arguments, the script will proceed as before. If there is one argument, it uses that in a modified
git checkout
command. If there is more than one argument, it stops and emits a warning.QA notes
These are taken from the last "bump renv" PR.
We want to ensure that this change doesn't break dependency detection, which is currently the only place we use
renv
. One way to exercise this is to deploy a simple Shiny app to an RStudio Connect instance.After installing the version of Packrat in this PR, deploy the following Shiny app to a Connect instance and ensure that it runs.