代码之家  ›  专栏  ›  技术社区  ›  ir2pid

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

  •  1
  • ir2pid  · 技术社区  · 6 年前

    我有两个工作,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
    

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

    我如何做到这一点?

    1 回复  |  直到 6 年前
        1
  •  1
  •   FelicianoTech    6 年前

    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