2

我正在尝试使用 Concourse-CI 自动化部署。

我有一个 go 应用程序,该应用程序已签入具有两个分支(主和开发)的本地 Gitlab。

我有一个用于运行 go 单元测试的开发分支的管道设置,如果它们通过,我想自动将开发分支的更改合并到主分支并用最新版本标记它。

这是我到目前为止所拥有的:

jobs:
- name: run-unit-tests
  public: true
  plan:
  - get: source-master
  - get: source
    trigger: true
  - put: discord
    params:
      channel: "((channel_id))"
      color: 6076508
      title: Concourse CI
      message: |
        Starting Unit tests for manageGameData
  - task: task-unit-tests
    file: source/ci/tasks/task-unit-tests.yml
    on_success:
      do:
        - put: discord
          params:
            channel: "((channel_id))"
            color: 6076508
            title: Concourse CI
            message: |
              All Unit tests passed for manageGameData
        - put: version
          params: 
            bump: minor
        - get: version
        - put: source-master
          params:
            merge: source
            repository: source-master
            tag: version/number

问题是这只会用新版本标记主分支。

有没有办法将develop分支合并到master?

4

2 回答 2

5

I guess i didn't understand the documentation at first but the answer was pretty easy.

- get: source-master
- get: source
- put: source-master
  params:
    repository: source

First you have to get both branches in this case master and develop. Then you push the source local repo (a folder on the concourse worker) to master by using put.

There is no need for the merge parameter and i had the wrong repository parameter.

Hope this helps someone else.

于 2018-11-21T14:56:57.570 回答
-2

或者,您可以只使用脚本来执行更复杂的 git 命令。

 platform: linux

image_resource:
  type: docker-image
  source:
    repository: concourse/buildroot
    tag: git
    run:
      path: /bin/bash
      args:
      - -c
      - |
        set -eux

    git clone https://user:passw@repo.git

    git config --global user.name "UserName"

    git config --global user.email "email@your.com"

    git checkout master

    git merge hotfix
于 2019-03-05T13:06:32.340 回答