-
Notifications
You must be signed in to change notification settings - Fork 11
ci: use with-connect action for Posit Connect integration tests
#351
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
658cc89
Switch CI workflow to use with-connect setup
nealrichardson c0cd7d5
Get it running
nealrichardson 8141e6e
:nail_care:
nealrichardson d29699b
Update license secret and remove import
nealrichardson 9d3d7ad
Cleanup and doc
nealrichardson db51501
Restore (for now) _HackyConnect
nealrichardson a2dc89a
Use v1 endpoint even in HackyConnect
nealrichardson d238ed5
Update for latest with-connect improvements
nealrichardson 221566a
Revert "Update for latest with-connect improvements"
nealrichardson 224c8b8
Use multiline with-connect command for readability
nealrichardson 3dc96dd
Add make target to run connect tests
nealrichardson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,3 +146,5 @@ reference/ | |
| src/ | ||
|
|
||
| /.luarc.json | ||
|
|
||
| *.lic | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,35 @@ | ||
| import json | ||
| import os | ||
| import sys | ||
|
|
||
| from pins.rsconnect.api import _HackyConnect | ||
| from pins.rsconnect.api import LoginConnectApi, RsConnectApi | ||
|
|
||
| OUT_FILE = sys.argv[1] | ||
|
|
||
|
|
||
| def get_api_key(user, password, email): | ||
| rsc = _HackyConnect("http://localhost:3939") | ||
|
|
||
| return rsc.create_first_admin(user, password, email).api_key | ||
|
|
||
|
|
||
| api_keys = { | ||
| "admin": get_api_key("admin", "admin0", "[email protected]"), | ||
| "susan": get_api_key("susan", "susan", "[email protected]"), | ||
| "derek": get_api_key("derek", "derek", "[email protected]"), | ||
| } | ||
| extra_users = [ | ||
| {"username": "susan", "password": "susansusan"}, | ||
| {"username": "derek", "password": "derekderek"}, | ||
| ] | ||
|
|
||
| # Assumes CONNECT_SERVER and CONNECT_API_KEY are set in the environment | ||
| admin_client = RsConnectApi() | ||
|
|
||
| # Rename admin user to "admin" ¯\_(ツ)_/¯ | ||
| guid = admin_client.get_user()["guid"] | ||
| admin_client.query_v1(f"users/{guid}", "PUT", json={"username": "admin"}) | ||
|
|
||
| api_keys = {"admin": os.getenv("CONNECT_API_KEY")} | ||
|
|
||
| for user in extra_users: | ||
| # Create user | ||
| admin_client.create_user( | ||
| username=user["username"], | ||
| password=user["password"], | ||
| __confirmed=True, | ||
| ) | ||
| # Log in as them and generate an API key, and add to dict | ||
| api_keys[user["username"]] = LoginConnectApi( | ||
| user["username"], user["password"] | ||
| ).create_api_key() | ||
|
|
||
| json.dump(api_keys, open(OUT_FILE, "w")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| [Server] | ||
| DataDir = /data | ||
| Address = http://localhost:3939 | ||
| AllowConfirmedUsers = true | ||
|
|
||
| [HTTP] | ||
| Listen = :3939 | ||
|
|
||
| [Authentication] | ||
| Provider = pam | ||
| Provider = password | ||
|
|
||
| [Authorization] | ||
| DefaultUserRole = publisher | ||
|
|
||
| [Python] | ||
| Enabled = false | ||
|
|
||
| [RPackageRepository "CRAN"] | ||
| URL = https://packagemanager.rstudio.com/cran/__linux__/bionic/latest | ||
|
|
||
| [RPackageRepository "RSPM"] | ||
| URL = https://packagemanager.rstudio.com/cran/__linux__/bionic/latest | ||
| ; Copied from the Docker image config in github.com/rstudio/rstudio-docker-products | ||
| [Logging] | ||
| ServiceLog = STDOUT | ||
| ServiceLogFormat = TEXT ; TEXT or JSON | ||
| ServiceLogLevel = INFO ; INFO, WARNING or ERROR | ||
| AccessLog = STDOUT | ||
| AccessLogFormat = COMMON ; COMMON, COMBINED, or JSON |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there a way to set up
with-connectlocally we can add in the Makefile? likewith-connect -- xyz, even if it makes assumptions about having a.licfile in a certain location or other creds.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 added a note to CONTRIBUTING.md about how to install and run locally--is that enough or would you like a
maketarget too? Easy enough to add one.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.
On second thought I'll just do this, there is still a bit of fussing that the GHA job does to get it working right, so it would be nice to encapsulate that for local testing.
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, there's just enough complexity in setup that having a
maketarget would be very helpful. Thanks!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.
Added in 3dc96dd