CircleCI保存工作流程中相关作业的输出

时间:2018-07-12 11:58:37

标签: continuous-integration circleci

我有两个工作,B依赖于A,我需要将其输出用作下一个工作的输入。

version: 2
jobs:
  A:
    docker:
      - image: xxx
    environment:
      MAKEFLAGS: "-i"
      JVM_OPTS: -Xmx3200m
    steps:
      - run: git submodule update --init
      - run:
          name: build A
          command: cd platform/android/ && ant
  B:
    docker:
      - image: yyy
    environment:
      MAKEFLAGS: "-i"
      JVM_OPTS: -Xmx3200m
    steps:
          name: build B
          command: ./gradlew assembleDebug

workflows:
  version: 2
  tests:
    jobs:
      - A
      - B:
          requires:
           - A

文件夹./build/output中作业A的输出需要保存并在作业B中使用。

我该如何实现?

1 个答案:

答案 0 :(得分:1)

免责声明:我是CircleCI开发人员倡导者

您将使用CircleCI Workspaces

version: 2
jobs:
  A:
    docker:
      - image: xxx
    environment:
      MAKEFLAGS: "-i"
      JVM_OPTS: -Xmx3200m
    steps:
      - run: git submodule update --init
      - run:
          name: build A
          command: cd platform/android/ && ant
      - persist_to_workspace:
          root: build/
          paths:
            - output
  B:
    docker:
      - image: yyy
    environment:
      MAKEFLAGS: "-i"
      JVM_OPTS: -Xmx3200m
    steps:
      - attach_workspace:
          at: build/
          name: build B
          command: ./gradlew assembleDebug

workflows:
  version: 2
  tests:
    jobs:
      - A
      - B:
          requires:
           - A

还请记住,您的B职位有一些YAML问题。