无法从 bitbucket 管道 yml 脚本检出 git 分支

314*_*926 6 git bitbucket bitbucket-pipelines

我希望在部署到 QA 服务器之前在 staging 之上进行 rebase(或与 staging 合并),这样它将包含来自我的分支的最新更改和更改。

作为第一步,我尝试检查暂存并失败:我在 bitbucket-pipelines.yml 中有以下配置

merge:
- step:
    name: merge with staging
    image: node:8
    script:
    - git remote update
    - git fetch origin
    - git branch -f staging origin/staging
    - git checkout staging
Run Code Online (Sandbox Code Playgroud)

错误:

+ git branch -f staging origin/staging
fatal: Not a valid object name: 'origin/staging'.
Run Code Online (Sandbox Code Playgroud)

我确实尝试了很多在本地工作的其他变体,但一切都失败了...看起来 bitbucket 限制了对其他分支的访问..

检查 bitbucket 管道中的分支的正确方法是什么?

314*_*926 0

以下似乎是我的问题的解决方案,因为我可以避免检查分期:

name: Build and test on QA env
image: node:8
script:
  - git fetch origin
  - git pull --rebase origin staging --verbose
  - npm ci
  - npm test
  - npm run build
Run Code Online (Sandbox Code Playgroud)

另一方面,它没有回答所提出的问题,所以我暂时将其保留为“开放”