CircleCI Workspace


version: 2.1
 
executors:
  my-executor:
    docker:
      - image: buildpack-deps:jessie
    working_directory: /tmp
 
jobs:
  flow:
    executor: my-executor
    steps:
      - run: mkdir -p workspace
      - run: echo "Hello, world!" > workspace/echo-output
 
      - persist_to_workspace:
          root: workspace
          paths:
            - echo-output
 
  downstream:
    executor: my-executor
    steps:
      - attach_workspace:
          at: /tmp/workspace
 
      - run: |
          if [[ `cat /tmp/workspace/echo-output` == "Hello, world!" ]]; then
            echo "It worked!";
          else
            echo "Nope!"; exit 1
          fi
 
workflows:
  btd:
    jobs:
      - flow
      - downstream:
          requires:
            - flow
  • persist_to_workspace ๋ฅผ ํ†ตํ•ด Job ์—์„œ ์ƒ์„ฑ๋œ ํŒŒ์ผ ์ €์žฅ ๊ฐ€๋Šฅ
    • root ๋Š” ์ ˆ๋Œ€ ๊ฒฝ๋กœ ๋˜๋Š” working_directory ์— ๋Œ€ํ•œ ์ƒ๋Œ€ ๊ฒฝ๋กœ
  • attach_workspace ๋Š” ์ ˆ๋Œ€ ๊ฒฝ๋กœ๋กœ ์ง€์ •ํ•ด์ค˜์•ผ ํ•จ

References