From 15f7576681c9ad27943f82b5dc9ab70a103f50d2 Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 16:57:21 -0400 Subject: [PATCH 01/11] diagnostics --- R/utils-ci.R | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/R/utils-ci.R b/R/utils-ci.R index 1b0974ed..e77d6e1f 100644 --- a/R/utils-ci.R +++ b/R/utils-ci.R @@ -162,12 +162,16 @@ build_test_env <- function( # this is a regex so it will match either hosts <- compose_find_hosts(prefix = "ci.connect") - wait_for_connect_ready <- function(host, timeout = 120) { + wait_for_connect_ready <- function(host, timeout = 120, container_name = NULL) { client <- HackyConnect$new(server = host, api_key = NULL) start_time <- Sys.time() last_msg <- start_time + last_health_check <- start_time ping_url <- client$server_url("__ping__") + # Give Connect a few seconds to start before first ping attempt + Sys.sleep(3) + while ( as.numeric(difftime(Sys.time(), start_time, units = "secs")) < timeout ) { @@ -175,7 +179,8 @@ build_test_env <- function( { res <- client$GET(url = client$server_url("__ping__"), parser = NULL) httr::status_code(res) == 200 - } + }, + silent = TRUE ) if (isTRUE(ok)) { return(invisible(TRUE)) @@ -184,13 +189,45 @@ build_test_env <- function( cat_line(glue::glue("waiting for {ping_url} ...")) last_msg <- Sys.time() } + # Every 30 seconds, check if container is still running + if (!is.null(container_name) && + difftime(Sys.time(), last_health_check, units = "secs") >= 30) { + status <- try(system2("docker", c("ps", "-f", paste0("name=", container_name), + "--format", "{{.Status}}"), + stdout = TRUE, stderr = TRUE), silent = TRUE) + if (!inherits(status, "try-error") && length(status) > 0) { + cat_line(glue::glue("Container {container_name} status: {status}")) + } else { + cat_line(glue::glue("WARNING: Container {container_name} may not be running!")) + } + last_health_check <- Sys.time() + } Sys.sleep(1) } + + # Before failing, capture diagnostics + cat_line("Connect did not become ready in time. Capturing diagnostics...") + if (!is.null(container_name)) { + cat_line(glue::glue("=== Docker logs for {container_name} ===")) + logs <- try(system2("docker", c("logs", "--tail", "100", container_name), + stdout = TRUE, stderr = TRUE), silent = TRUE) + if (!inherits(logs, "try-error")) { + cat(logs, sep = "\n") + } + + cat_line(glue::glue("=== Docker inspect for {container_name} ===")) + inspect <- try(system2("docker", c("inspect", container_name), + stdout = TRUE, stderr = TRUE), silent = TRUE) + if (!inherits(inspect, "try-error")) { + cat(inspect, sep = "\n") + } + } + stop("Connect did not become ready in time: ", ping_url) } - wait_for_connect_ready(hosts[1]) - wait_for_connect_ready(hosts[2]) + wait_for_connect_ready(hosts[1], container_name = "ci-connect-1") + wait_for_connect_ready(hosts[2], container_name = "ci-connect-2") cat_line("connect: creating first admin...") a1 <- create_first_admin( From af293ed262bcc5639ba1fe49116579acc26fc62b Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 17:14:46 -0400 Subject: [PATCH 02/11] use license file instead of license key --- .github/workflows/integration-tests.yaml | 5 +++-- .github/workflows/pkgdown.yaml | 5 +++-- .github/workflows/pr-commands.yaml | 5 +++-- .github/workflows/test-coverage.yaml | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index cfbd9390..0c84241c 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -28,7 +28,6 @@ jobs: env: CONNECT_VERSION: ${{ matrix.version }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - RSC_LICENSE: ${{ secrets.RSC_LICENSE }} CONNECT_LICENSE_FILE: ${{ secrets.CONNECT_LICENSE_FILE }} CONNECTAPI_INTEGRATED: true @@ -54,7 +53,9 @@ jobs: shell: Rscript {0} - name: Set up license file - run: echo "$CONNECT_LICENSE_FILE" > $RSC_LICENSE + run: | + echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic + echo "RSC_LICENSE=/tmp/connect.lic" >> $GITHUB_ENV - name: Setup test environment run: | diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 669c7b99..21c7028f 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -19,7 +19,6 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} CONNECT_VERSION: 2024.03.0 - RSC_LICENSE: ${{ secrets.RSC_LICENSE }} CONNECT_LICENSE_FILE: ${{ secrets.CONNECT_LICENSE_FILE }} steps: @@ -37,7 +36,9 @@ jobs: needs: website - name: Set up license file - run: echo "$CONNECT_LICENSE_FILE" > $RSC_LICENSE + run: | + echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic + echo "RSC_LICENSE=/tmp/connect.lic" >> $GITHUB_ENV - name: Start Connect run: | diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index 2d3f44aa..f51f98e3 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -14,7 +14,6 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} CONNECT_VERSION: 2024.03.0 - RSC_LICENSE: ${{ secrets.RSC_LICENSE }} CONNECT_LICENSE_FILE: ${{ secrets.CONNECT_LICENSE_FILE }} CONNECTAPI_INTEGRATED: true steps: @@ -32,7 +31,9 @@ jobs: needs: coverage - name: Set up license file - run: echo "$CONNECT_LICENSE_FILE" > $RSC_LICENSE + run: | + echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic + echo "RSC_LICENSE=/tmp/connect.lic" >> $GITHUB_ENV - name: Setup test environment run: | diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 54bda942..0cbb9a29 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -14,7 +14,6 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} CONNECT_VERSION: 2024.03.0 - RSC_LICENSE: ${{ secrets.RSC_LICENSE }} CONNECT_LICENSE_FILE: ${{ secrets.CONNECT_LICENSE_FILE }} CONNECTAPI_INTEGRATED: true @@ -34,7 +33,9 @@ jobs: needs: coverage - name: Set up license file - run: echo "$CONNECT_LICENSE_FILE" > $RSC_LICENSE + run: | + echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic + echo "RSC_LICENSE=/tmp/connect.lic" >> $GITHUB_ENV - name: Setup test environment run: | From de237141de00ba4116717a9cf2ea9983dc487992 Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 17:29:24 -0400 Subject: [PATCH 03/11] remove some diagnostics --- R/utils-ci.R | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/R/utils-ci.R b/R/utils-ci.R index e77d6e1f..8814e872 100644 --- a/R/utils-ci.R +++ b/R/utils-ci.R @@ -166,7 +166,6 @@ build_test_env <- function( client <- HackyConnect$new(server = host, api_key = NULL) start_time <- Sys.time() last_msg <- start_time - last_health_check <- start_time ping_url <- client$server_url("__ping__") # Give Connect a few seconds to start before first ping attempt @@ -189,19 +188,6 @@ build_test_env <- function( cat_line(glue::glue("waiting for {ping_url} ...")) last_msg <- Sys.time() } - # Every 30 seconds, check if container is still running - if (!is.null(container_name) && - difftime(Sys.time(), last_health_check, units = "secs") >= 30) { - status <- try(system2("docker", c("ps", "-f", paste0("name=", container_name), - "--format", "{{.Status}}"), - stdout = TRUE, stderr = TRUE), silent = TRUE) - if (!inherits(status, "try-error") && length(status) > 0) { - cat_line(glue::glue("Container {container_name} status: {status}")) - } else { - cat_line(glue::glue("WARNING: Container {container_name} may not be running!")) - } - last_health_check <- Sys.time() - } Sys.sleep(1) } From 7f7539a315d75813e8bef4c5bbb48c7f500b7da8 Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 17:31:13 -0400 Subject: [PATCH 04/11] remove extra sleep --- R/utils-ci.R | 3 --- 1 file changed, 3 deletions(-) diff --git a/R/utils-ci.R b/R/utils-ci.R index 8814e872..f665e7e6 100644 --- a/R/utils-ci.R +++ b/R/utils-ci.R @@ -168,9 +168,6 @@ build_test_env <- function( last_msg <- start_time ping_url <- client$server_url("__ping__") - # Give Connect a few seconds to start before first ping attempt - Sys.sleep(3) - while ( as.numeric(difftime(Sys.time(), start_time, units = "secs")) < timeout ) { From 3387cb1f1cdb4b97d064d8fe5261ab8acbc3afe6 Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 17:34:04 -0400 Subject: [PATCH 05/11] update wait_for_connect_ready --- R/utils-ci.R | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/R/utils-ci.R b/R/utils-ci.R index f665e7e6..28c531a3 100644 --- a/R/utils-ci.R +++ b/R/utils-ci.R @@ -162,7 +162,7 @@ build_test_env <- function( # this is a regex so it will match either hosts <- compose_find_hosts(prefix = "ci.connect") - wait_for_connect_ready <- function(host, timeout = 120, container_name = NULL) { + wait_for_connect_ready <- function(host, container_name, timeout = 120) { client <- HackyConnect$new(server = host, api_key = NULL) start_time <- Sys.time() last_msg <- start_time @@ -190,20 +190,32 @@ build_test_env <- function( # Before failing, capture diagnostics cat_line("Connect did not become ready in time. Capturing diagnostics...") - if (!is.null(container_name)) { - cat_line(glue::glue("=== Docker logs for {container_name} ===")) - logs <- try(system2("docker", c("logs", "--tail", "100", container_name), - stdout = TRUE, stderr = TRUE), silent = TRUE) - if (!inherits(logs, "try-error")) { - cat(logs, sep = "\n") - } + cat_line(glue::glue("=== Docker logs for {container_name} ===")) + logs <- try( + system2( + "docker", + c("logs", "--tail", "100", container_name), + stdout = TRUE, + stderr = TRUE + ), + silent = TRUE + ) + if (!inherits(logs, "try-error")) { + cat(logs, sep = "\n") + } - cat_line(glue::glue("=== Docker inspect for {container_name} ===")) - inspect <- try(system2("docker", c("inspect", container_name), - stdout = TRUE, stderr = TRUE), silent = TRUE) - if (!inherits(inspect, "try-error")) { - cat(inspect, sep = "\n") - } + cat_line(glue::glue("=== Docker inspect for {container_name} ===")) + inspect <- try( + system2( + "docker", + c("inspect", container_name), + stdout = TRUE, + stderr = TRUE + ), + silent = TRUE + ) + if (!inherits(inspect, "try-error")) { + cat(inspect, sep = "\n") } stop("Connect did not become ready in time: ", ping_url) From 8e691f7190cda197acbfc91b3dc123c00b54995f Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 18:43:13 -0400 Subject: [PATCH 06/11] remove license paths; only allow license files --- .github/workflows/integration-tests.yaml | 6 +-- .github/workflows/pkgdown.yaml | 6 +-- .github/workflows/pr-commands.yaml | 6 +-- .github/workflows/test-coverage.yaml | 6 +-- R/utils-ci.R | 48 +++++------------------- inst/ci/test-connect.yml | 17 --------- 6 files changed, 17 insertions(+), 72 deletions(-) delete mode 100644 inst/ci/test-connect.yml diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index 0c84241c..42c2e1c4 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -53,13 +53,11 @@ jobs: shell: Rscript {0} - name: Set up license file - run: | - echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic - echo "RSC_LICENSE=/tmp/connect.lic" >> $GITHUB_ENV + run: echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic - name: Setup test environment run: | - connectapi:::build_test_env() + connectapi:::build_test_env(connect_license_path = "/tmp/connect.lic") shell: Rscript {0} - uses: r-lib/actions/check-r-package@v2 diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 21c7028f..a7b7bb50 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -36,13 +36,11 @@ jobs: needs: website - name: Set up license file - run: | - echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic - echo "RSC_LICENSE=/tmp/connect.lic" >> $GITHUB_ENV + run: echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic - name: Start Connect run: | - Rscript -e 'connectapi:::build_test_env()' + Rscript -e 'connectapi:::build_test_env(connect_license_path = "/tmp/connect.lic")' - name: Build site run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index f51f98e3..1cbe1626 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -31,13 +31,11 @@ jobs: needs: coverage - name: Set up license file - run: | - echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic - echo "RSC_LICENSE=/tmp/connect.lic" >> $GITHUB_ENV + run: echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic - name: Setup test environment run: | - connectapi:::build_test_env() + connectapi:::build_test_env(connect_license_path = "/tmp/connect.lic") shell: Rscript {0} - uses: r-lib/actions/check-r-package@v2 diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 0cbb9a29..42fc3ce7 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -33,13 +33,11 @@ jobs: needs: coverage - name: Set up license file - run: | - echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic - echo "RSC_LICENSE=/tmp/connect.lic" >> $GITHUB_ENV + run: echo "$CONNECT_LICENSE_FILE" > /tmp/connect.lic - name: Setup test environment run: | - connectapi:::build_test_env() + connectapi:::build_test_env(connect_license_path = "/tmp/connect.lic") shell: Rscript {0} - name: Test coverage diff --git a/R/utils-ci.R b/R/utils-ci.R index 28c531a3..72bc5148 100644 --- a/R/utils-ci.R +++ b/R/utils-ci.R @@ -1,33 +1,5 @@ # nocov start -# TODO: A nicer way to execute these system commands... -# - debug output... better error handling... etc. - -determine_license_env <- function(license) { - if (fs::file_exists(license) && fs::path_ext(license) == "lic") { - # Docker needs this to be an absolute path - license <- fs::path_abs(license) - cat_line("determine_license: looks like a license file") - return(list( - type = "file", - cmd_params = c( - "-v", - paste0(license, ":/var/lib/rstudio-connect/license.lic") - ), - env_params = c(RSC_LICENSE_FILE = license) - )) - } else { - cat_line("determine_license: looks like a license key") - return(list( - type = "key", - cmd_params = c(), - env_params = c( - RSC_LICENSE = license - ) - )) - } -} - version_to_docker_tag <- function(version) { # Prior to 2022.09.0, the plain version number was the tag # After, it's "-" @@ -49,27 +21,25 @@ version_to_docker_tag <- function(version) { } compose_start <- function( - connect_license = Sys.getenv("RSC_LICENSE"), + connect_license_path, connect_version, clean = TRUE ) { warn_dire("compose_start") scoped_dire_silence() - stopifnot(nchar(connect_license) > 0) + stopifnot(fs::file_exists(connect_license_path)) + connect_license_path <- fs::path_abs(connect_license_path) - license_details <- determine_license_env(connect_license) - compose_file <- switch( - license_details$type, - "file" = "ci/test-connect-lic.yml", - "ci/test-connect.yml" + compose_file_path <- system.file( + "ci/test-connect-lic.yml", + package = "connectapi" ) - compose_file_path <- system.file(compose_file, package = "connectapi") env_vars <- c( CONNECT_VERSION = version_to_docker_tag(connect_version), PATH = Sys.getenv("PATH"), - license_details$env_params + RSC_LICENSE_FILE = connect_license_path ) # system2 needs a character vector of name=value env_vars <- paste(names(env_vars), env_vars, sep = "=") @@ -143,7 +113,7 @@ update_renviron_creds <- function( } build_test_env <- function( - connect_license = Sys.getenv("RSC_LICENSE"), + connect_license_path, clean = TRUE, username = "admin", password = "admin0", @@ -153,7 +123,7 @@ build_test_env <- function( scoped_dire_silence() compose_start( - connect_license = connect_license, + connect_license_path = connect_license_path, clean = clean, connect_version = connect_version ) diff --git a/inst/ci/test-connect.yml b/inst/ci/test-connect.yml deleted file mode 100644 index cddecdde..00000000 --- a/inst/ci/test-connect.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '2.3' -services: - - connect: - hostname: connect - image: ghcr.io/rstudio/rstudio-connect:${CONNECT_VERSION} - scale: 2 - ports: - - 3939 - privileged: true - environment: - - RSC_LICENSE - - RSC_HASTE_ENABLED=true - platform: linux/amd64 - # if you need to customize Connect config until we have env vars - # volumes: - # - ../../tmp.gcfg:/etc/rstudio-connect/rstudio-connect.gcfg From 83390b2cdc72e313a7f8c8cb114a9a1a31b66e3c Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 18:53:55 -0400 Subject: [PATCH 07/11] update CONTRIBUTING.md --- .github/CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 4a752628..3d2cf969 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -13,10 +13,10 @@ Run these as you would any other R test suite with `devtools::test()`. A second suite runs integration tests against a live Connect server running locally in Docker. This has some additional requirements. -- You need a valid Connect license key or file. Put the contents of the license key, or the path to the license file, in the `RSC_LICENSE` environment variable. +- You need a valid Connect license file (`.lic` file). Place it in the root of the repository as `connect-license.lic`. - You need Docker. - If you're running on an ARM (non-Intel) Mac, `export DOCKER_DEFAULT_PLATFORM=linux/amd64` -- Run `connectapi:::build_test_env()` to set up the Connect processes in docker +- Run `connectapi:::build_test_env(connect_license_path = "connect-license.lic")` to set up the Connect processes in docker - By default, this will run against a contemporary version of Connect. To test against an older version, set the environment variable `CONNECT_VERSION` to something else and then run `build_test_env()`. - Set `CONNECTAPI_INTEGRATED=true` in the environment to enable running the integration tests (they're skipped by default). - Run them with `source("tests/test-integrated.R")` From a8e4d015b200e48bd10b487e58f241ba33fc7d4e Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 19:16:42 -0400 Subject: [PATCH 08/11] Update R/utils-ci.R Co-authored-by: Kara Woo --- R/utils-ci.R | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/R/utils-ci.R b/R/utils-ci.R index 72bc5148..2f56ed26 100644 --- a/R/utils-ci.R +++ b/R/utils-ci.R @@ -161,32 +161,33 @@ build_test_env <- function( # Before failing, capture diagnostics cat_line("Connect did not become ready in time. Capturing diagnostics...") cat_line(glue::glue("=== Docker logs for {container_name} ===")) - logs <- try( - system2( + try( + { + logs <- system2( "docker", c("logs", "--tail", "100", container_name), stdout = TRUE, stderr = TRUE - ), - silent = TRUE - ) - if (!inherits(logs, "try-error")) { + ) cat(logs, sep = "\n") - } + }, + silent = TRUE + ) cat_line(glue::glue("=== Docker inspect for {container_name} ===")) - inspect <- try( - system2( + try( + { + inspect <- system2( "docker", c("inspect", container_name), stdout = TRUE, stderr = TRUE - ), - silent = TRUE - ) - if (!inherits(inspect, "try-error")) { + ) cat(inspect, sep = "\n") - } + }, + silent = TRUE + ) + stop("Connect did not become ready in time: ", ping_url) } From 14b5eeea0ef21a6e684f770fbf5dae232a3ab078 Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 19:30:44 -0400 Subject: [PATCH 09/11] make container name discovery automatic --- R/utils-ci.R | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/R/utils-ci.R b/R/utils-ci.R index 2f56ed26..4f1544a5 100644 --- a/R/utils-ci.R +++ b/R/utils-ci.R @@ -75,9 +75,13 @@ compose_find_hosts <- function(prefix) { containers <- grep(prefix, docker_ps_output, value = TRUE) ports <- sub(".*0\\.0\\.0\\.0:([0-9]+)->3939.*", "\\1", containers) + container_names <- sub(".*\\s+([^ ]+)$", "\\1", containers) cat_line(glue::glue("docker: got ports {ports[1]} and {ports[2]}")) - paste0("http://localhost:", ports) + list( + hosts = paste0("http://localhost:", ports), + container_names = container_names + ) } @@ -130,7 +134,7 @@ build_test_env <- function( # It was ci_connect before but it's ci-connect on my machine now; # this is a regex so it will match either - hosts <- compose_find_hosts(prefix = "ci.connect") + container_info <- compose_find_hosts(prefix = "ci.connect") wait_for_connect_ready <- function(host, container_name, timeout = 120) { client <- HackyConnect$new(server = host, api_key = NULL) @@ -192,18 +196,18 @@ build_test_env <- function( stop("Connect did not become ready in time: ", ping_url) } - wait_for_connect_ready(hosts[1], container_name = "ci-connect-1") - wait_for_connect_ready(hosts[2], container_name = "ci-connect-2") + wait_for_connect_ready(container_info$hosts[1], container_name = container_info$container_names[1]) + wait_for_connect_ready(container_info$hosts[2], container_name = container_info$container_names[2]) cat_line("connect: creating first admin...") a1 <- create_first_admin( - hosts[1], + container_info$hosts[1], "admin", "admin0", "admin@example.com" ) a2 <- create_first_admin( - hosts[2], + container_info$hosts[2], "admin", "admin0", "admin@example.com" From f38f9a039923c10e39e280b8f236415347c51cce Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 30 Sep 2025 19:31:50 -0400 Subject: [PATCH 10/11] fix linting --- R/utils-ci.R | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/R/utils-ci.R b/R/utils-ci.R index 4f1544a5..42eabff6 100644 --- a/R/utils-ci.R +++ b/R/utils-ci.R @@ -166,38 +166,43 @@ build_test_env <- function( cat_line("Connect did not become ready in time. Capturing diagnostics...") cat_line(glue::glue("=== Docker logs for {container_name} ===")) try( - { - logs <- system2( - "docker", - c("logs", "--tail", "100", container_name), - stdout = TRUE, - stderr = TRUE - ) - cat(logs, sep = "\n") - }, - silent = TRUE + { + logs <- system2( + "docker", + c("logs", "--tail", "100", container_name), + stdout = TRUE, + stderr = TRUE + ) + cat(logs, sep = "\n") + }, + silent = TRUE ) cat_line(glue::glue("=== Docker inspect for {container_name} ===")) try( - { - inspect <- system2( - "docker", - c("inspect", container_name), - stdout = TRUE, - stderr = TRUE - ) - cat(inspect, sep = "\n") - }, - silent = TRUE + { + inspect <- system2( + "docker", + c("inspect", container_name), + stdout = TRUE, + stderr = TRUE + ) + cat(inspect, sep = "\n") + }, + silent = TRUE ) - stop("Connect did not become ready in time: ", ping_url) } - wait_for_connect_ready(container_info$hosts[1], container_name = container_info$container_names[1]) - wait_for_connect_ready(container_info$hosts[2], container_name = container_info$container_names[2]) + wait_for_connect_ready( + container_info$hosts[1], + container_name = container_info$container_names[1] + ) + wait_for_connect_ready( + container_info$hosts[2], + container_name = container_info$container_names[2] + ) cat_line("connect: creating first admin...") a1 <- create_first_admin( From fcb805e35f7a4d6953417e1d57829a29a475b5be Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Wed, 1 Oct 2025 11:12:38 -0400 Subject: [PATCH 11/11] remove references to old license-key workflow --- .github/local/test-connect-ci.yml | 8 ++++---- Makefile | 16 +++------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/local/test-connect-ci.yml b/.github/local/test-connect-ci.yml index 359e6789..197f54ed 100644 --- a/.github/local/test-connect-ci.yml +++ b/.github/local/test-connect-ci.yml @@ -7,13 +7,13 @@ services: ports: - 3939 privileged: true - environment: - - RSC_LICENSE + volumes: + - "${RSC_LICENSE_FILE}:/var/lib/rstudio-connect/license.lic" connect2: hostname: connect2 image: rstudio/rstudio-connect:${CONNECT_VERSION} ports: - 3939 privileged: true - environment: - - RSC_LICENSE + volumes: + - "${RSC_LICENSE_FILE}:/var/lib/rstudio-connect/license.lic" diff --git a/Makefile b/Makefile index 6df74bda..3a859db0 100644 --- a/Makefile +++ b/Makefile @@ -48,27 +48,17 @@ mail-down: connect-up: NETWORK=${NETWORK} \ - RSC_LICENSE=$(RSC_LICENSE) \ - CONNECT_VERSION=$(CONNECT_VERSION) \ - docker compose -f inst/ci/test-connect.yml -f .github/local/make-network.yml up -d - -connect-down: - NETWORK=${NETWORK} \ - docker compose -f inst/ci/test-connect.yml -f .github/local/make-network.yml down - -connect-file-up: - NETWORK=${NETWORK} \ - RSC_LICENSE=$(RSC_LICENSE) \ + RSC_LICENSE_FILE=$(RSC_LICENSE_FILE) \ CONNECT_VERSION=$(CONNECT_VERSION) \ docker compose -f inst/ci/test-connect-lic.yml -f .github/local/make-network.yml up -d -connect-file-down: +connect-down: NETWORK=${NETWORK} \ docker compose -f inst/ci/test-connect-lic.yml -f .github/local/make-network.yml down test-env-up: NETWORK=${NETWORK} \ - RSC_LICENSE=$(RSC_LICENSE) \ + RSC_LICENSE_FILE=$(RSC_LICENSE_FILE) \ CONNECT_VERSION=$(CONNECT_VERSION) \ docker compose -f .github/local/test-connect-ci.yml -f .github/local/make-network.yml up -d