gitlab CI 从私有仓库安装 R 包
gitlab CI install R package from private repository
我正在尝试为位于私有存储库中的 R 包构建一个 gitlab CI 文件。此包依赖于另一个私有存储库中的另一个 R 包。要安装依赖包,我使用以下方法,我确信这不是最好的方法,因为 username/password 详细信息已公开。
是否有其他方法可以从私有 gitlab 存储库安装依赖包?
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
经过更多尝试,我找到了一种方法,您可以为您的项目创建一个组令牌并使用它代替 username/password
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')"
我正在尝试为位于私有存储库中的 R 包构建一个 gitlab CI 文件。此包依赖于另一个私有存储库中的另一个 R 包。要安装依赖包,我使用以下方法,我确信这不是最好的方法,因为 username/password 详细信息已公开。
是否有其他方法可以从私有 gitlab 存储库安装依赖包?
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
经过更多尝试,我找到了一种方法,您可以为您的项目创建一个组令牌并使用它代替 username/password 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')"