-
Notifications
You must be signed in to change notification settings - Fork 26
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
Use license file for integration tests #228
Conversation
This works locally for me: I can run the same docker-compose command to start Connect, having set the RSC_VERSION and RSC_LICENSE_FILE env vars appropriately, and when I hit the ping endpoint I get a 200 response and not 402. For some reason the license file isn't being picked up correctly in CI, and I'm not sure how to get more insight into what's happening in the container. Need to step away and poke at this some more later. @aronatkins lmk if you notice any gotchas I'm missing. |
@@ -15,6 +15,7 @@ jobs: | |||
RSC_VERSION: 2022.09.0 | |||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |||
RSC_LICENSE: ${{ secrets.RSC_LICENSE }} |
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 updated this secret in GH so that it is now a file path where a license file can be expected, not a license key.
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.
In other contexts (Connect testing), we use CONNECT_LICENSE
for a key and CONNECT_LICENSE_FILE
for the file. That lets us understand if we should license-manager activate
or copy the file to the landing place.
The Connect Docker images uses RSC_LICENSE
for a key and RSC_LICENSE_FILE_PATH
for file. That's probably what inspired this workflow. https://github.com/rstudio/rstudio-docker-products/blob/d075a3c0a7bd8efc6b679ae33eceaa905234c30b/connect/startup.sh#L32-L40
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.
Yeah I was going to rename a bunch of things once I got it working, I agree it's not ideal as it is.
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.
Looks fine based on my understanding, but I don't have any history with this part of the CI configuration.
Later: The compose files may want to shift to using an OS other than Ubuntu Bionic.
@@ -15,6 +15,7 @@ jobs: | |||
RSC_VERSION: 2022.09.0 | |||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |||
RSC_LICENSE: ${{ secrets.RSC_LICENSE }} |
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.
In other contexts (Connect testing), we use CONNECT_LICENSE
for a key and CONNECT_LICENSE_FILE
for the file. That lets us understand if we should license-manager activate
or copy the file to the landing place.
The Connect Docker images uses RSC_LICENSE
for a key and RSC_LICENSE_FILE_PATH
for file. That's probably what inspired this workflow. https://github.com/rstudio/rstudio-docker-products/blob/d075a3c0a7bd8efc6b679ae33eceaa905234c30b/connect/startup.sh#L32-L40
.github/workflows/pkgdown.yaml
Outdated
@@ -42,6 +43,9 @@ jobs: | |||
remotes::install_github("r-lib/lifecycle") | |||
shell: Rscript {0} | |||
|
|||
- name: Set up license file | |||
run: echo ${CONNECT_LICENSE_FILE} > $RSC_LICENSE |
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.
Permissions are unlikely to matter in this context, but in case you want to see what we recommend: https://docs.posit.co/connect/admin/licensing/#license-file
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 file permissions look to be the same as what I have locally, which works. IDK about the user.
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.
After a bunch of attempts, it turns out I needed echo "$CONNECT_LICENSE_FILE"
with quotes in order to correctly handle the newlines in the license file-in-env-var. This is working now.
@@ -60,8 +62,7 @@ compose_start <- function(connect_license = Sys.getenv("RSC_LICENSE"), rsc_versi | |||
compose_path <- find_compose() | |||
|
|||
license_details <- determine_license_env(connect_license) | |||
compose_file <- switch( | |||
license_details$type, | |||
compose_file <- switch(license_details$type, | |||
"file" = "ci/test-connect-lic.yml", |
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.
Future: We should squash these compose files into one (or remove them entirely) and simply provide the correct bind mounts and environment variables to the container as it starts.
Remaining CI failures are unrelated. I'll explore them separately. |
Fixes #227
It took a bit of trial and error to get the secret passed in correctly, and among the things I upgraded along the way:
docker-compose
todocker compose
processx
dependency in utils-ci.R. and other simplification in that scriptFollowups: