【发布时间】:2018-06-26 21:43:32
【问题描述】:
配置
CF CLI 版本
cf version
cf 版本 6.37.0+a40009753.2018-05-25
Buildpack 版本https://github.com/cloudfoundry/nodejs-buildpack
清单applications:
- path: .
memory: 2048M
instances: 1
buildpack: nodejs_buildpack
name: kpb-singlenode-api-tmp
command: node server.js
disk_quota: 2048M
deploy.sh
#!/bin/bash
./Bluemix_CLI/bin/ibmcloud config --check-version false
./Bluemix_CLI/bin/ibmcloud api $API_ENDPOINT
./Bluemix_CLI/bin/ibmcloud login --apikey $API_KEY
./Bluemix_CLI/bin/ibmcloud target -o $IBMCLOUD_ORGANIZATION -s $IBMCLOUD_SPACE
./Bluemix_CLI/bin/ibmcloud app push kpb-node-api
.travis.yml
language: node_js
node_js:
- '8'
script: echo "skipping tests"
before_deploy:
- curl -L https://clis.ng.bluemix.net/download/bluemix-cli/latest/linux64 | tar -zx
- chmod -R u+x ./Bluemix_CLI/bin
- chmod +x ./deploy.sh
deploy:
provider: script
script: ./deploy.sh
on:
repo: myrepo/kpb-node-api
branch: master
skip_cleanup: true
问题
我只是想在 IBM Cloud (cloudfoundry) 上推送我的应用程序,但我在 github Enterprise 上使用私有存储库,因此 cf (cloudfoundry) 构建代理失败 npm install 因为它尝试登录/密码连接(被拒绝)虽然它应该使用 Git 令牌...
使用 Travis CI 自动构建。
预期行为
Cloudfoundry(或 Travis?)代理在运行 npm install 时应使用 git 令牌
实际行为
它坚持登录/密码凭据,所以 github 抛出 you should use git token or ssh key instead
据我所知,问题在于我们使用的是私有存储库,声明如下:git+https://github.com/someone/awesome-private-pkg.git(我们不能使用 npm publish 等...)
当 cloudfoundry 尝试使用登录名/密码凭据 npm install 私有存储库时将引发错误
这是我的错误日志:
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://github.ibm.com/myrepo/kpb-api-pkg
npm ERR!
npm ERR! remote: Password authentication is not available for Git operations.
npm ERR! remote: You must use a personal access token or SSH key.
npm ERR! remote: See https://github.ibm.com/settings/tokens or https://github.ibm.com/settings/ssh
npm ERR! fatal: unable to access 'https://github.ibm.com/myrepo/kpb-api-pkg/': The requested URL returned error: 403
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /home/travis/.npm/_logs/2018-06-26T10_31_07_934Z-debug.log
我正在挖掘 .bashrc 以通过 git config --global git.token 设置变量
感谢您的帮助,祝您有美好的一天!
【问题讨论】:
-
不要指向 buildpack 的 master 分支,例如:
buildpack: https://github.com/cloudfoundry/nodejs-buildpack.git。主分支经常发生变化,虽然它不经常发生,但甚至可能进入完全损坏的状态。相反,您想使用平台提供的 buildpack 版本(您可以从cf buildpacks获取名称)或者您想引用 buildpack 的标记稳定版本,例如:buildpack: https://github.com/cloudfoundry/nodejs-buildpack.git#v1.6.27。#<tag>允许您指定所需的版本。
标签: git npm ibm-cloud travis-ci cloud-foundry