Skip to content
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

[r-packages] GitHub credentials not available during installation #206

Open
dpprdan opened this issue Nov 16, 2023 · 2 comments
Open

[r-packages] GitHub credentials not available during installation #206

dpprdan opened this issue Nov 16, 2023 · 2 comments

Comments

@dpprdan
Copy link
Contributor

dpprdan commented Nov 16, 2023

When installing a package from GitHub with r-packages in a devcontainer, the GitHub credentials, stored in the Git Credential Manager for Windows with {gitcreds}, are not available.

With the following devcontainer.json

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/rocker-org/devcontainer-templates/tree/main/src/r-ver
{
	"name": "${localWorkspaceFolderBasename}",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "ghcr.io/rocker-org/devcontainer/r-ver:4.3",

	// Features to add to the dev container. More info: https://containers.dev/features.
	"features": {
		"ghcr.io/rocker-org/devcontainer-features/r-packages:1": {
			"installSystemRequirements": true,
			"packages": "github::r-lib/crayon"
		}
	}
}

I see the following line in the devcontainer build log scrolling by:

=> => # ! Using bundled GitHub PAT. Please add your own PAT using `gitcreds::gitcreds_set()`.

As a consequence it is not possible to install packages from private repos on GitHub.

I don't know whether this can be fixed, i.e. whether the credentials can be made available during the container build, or whether a line about this in the documentation has to suffice.

A workaround is to install GitHub packages (from private repos) in the postCreateCommand stage:

"postCreateCommand": "R -q -e 'pak::pak(\"r-lib/crayon\")'"
Session

VS Code 1.84.2
Docker Desktop 4.25.1 (128006)
Windows 11 (10.0.22631)

@eitsupi
Copy link
Member

eitsupi commented Nov 16, 2023

@dpprdan
Copy link
Contributor Author

dpprdan commented Nov 16, 2023

I gather from this that the necessary functionality, i.e. passing secrets during the build process, is specified. Furthermore, passing in secrets from the credential manager for my use case outlined above should be possible in the future™️, i.e. once accessing the Windows Credential Manager is implemented in, I believe, https://github.com/microsoft/vscode-remote-release/).

There isn't really anything we can do here now, is there? Except maybe add a line to the documentation?

(It's possible that SSH based authentication might work for this https://github.com/microsoft/vscode-remote-release/ 🤷🏻‍♂️)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants