[英]gitlab CI install R package from private repository
I am trying to build a gitlab CI file for an R package which lives in a private repository.我正在尝试为位于私有存储库中的 R package 构建 gitlab CI 文件。 This package depends on another R package in another private repository.
这个 package 依赖于另一个私有存储库中的另一个 R package。 To install the dependency package I am using the following approach which I am sure is not the best since the username/password details are exposed.
要安装依赖项 package 我使用以下方法,我确信这不是最好的,因为用户名/密码详细信息已暴露。
Is there an alternative way to install the dependency package from a private gitlab repository?是否有其他方法可以从私有 gitlab 存储库安装依赖项 package?
image: rocker/rstudio
stages:
- build
build_job:
stage: build
before_script:
- apt-get update
script:
- Rscript -e "install.packages(c('covr','testthat','devtools'))"
- Rscript -e "devtools::install_git('https://username:password@gitlab.com/project.git')"
- Rscript -e "devtools::test()"
- R CMD build . --no-build-vignettes --no-manual
- PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
- R CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual
- mkdir build
- mv "${PKG_FILE_NAME}" $CI_PROJECT_DIR/build
artifacts:
paths:
- build/
expire_in: 1 week
After some more tries I found a way it could be done, you can create a group token for your project and use this instead of the username/password https://docs.gitlab.com/ee/user/project/deploy_tokens/经过多次尝试,我找到了一种可以完成的方法,您可以为您的项目创建一个组令牌并使用它来代替用户名/密码https://docs.gitlab.com/ee/user/project/deploy_tokens/
- Rscript -e "devtools::install_git('https://gitlab+deploy-token-891150:gH-QQZ3BHJuioZfZkl1M@gitlab.com/project.git')"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.