Installing private dependencies via npm in a VS Team Services CI build

前端 未结 2 1185
北恋
北恋 2021-01-28 18:39

I\'m setting up some CI builds of NodeJS projects in VS Team Services. I currently have four projects being cloned from private Github repositories, running npm install

2条回答
  •  暖寄归人
    2021-01-28 19:10

    Recently i needed to do this in Azure Devops on a Windows based agent, Instead of changing dependencies to include user and token in the packages.json, it was easier to create a build step to add the authentication information from environment variables to windows credentials store and instructing git to use that.

    git config --global credential.helper wincred
    cmdkey /generic:LegacyGeneric:target=git:https://our-private-domain.com /user:git-readonly-use@our-private-domain.com /pass:"Personal Access Token With Read Permissions"
    

    After adding these configurations, Npm installs that we were doing using a script in source code went through without any issue

    "dependencies": {
    "example-1": "git+https://our-private-domain.com/proj/example-1.git#v0.1.9",
    "example-2": "git+https://our-private-domain.com/proj/example-2.git#master"
    }
    

提交回复
热议问题