Hello,
I created the following example to illustrate my question.
version: 2.1 # Use 2.1 to enable using orbs and other features.
jobs:
create-file:
machine: true
steps:
- run: |
echo "I am first" >> first.txt
echo "I am second" >> second.txt
#
mkdir -p /tmp/one/
mkdir -p /tmp/two/
#
mv first.txt /tmp/one/
mv second.txt /tmp/two/
- persist_to_workspace:
root: /tmp/one/
paths:
- first.txt
- persist_to_workspace:
root: /tmp/two/
paths:
- second.txt
recover-one:
machine: true
steps:
- attach_workspace:
at: tmp/one/
- run: find .
recover-two:
machine: true
steps:
- attach_workspace:
at: tmp/two/
- run: find .
workflows:
check-file:
jobs:
- create-file
- recover-one:
requires: [create-file]
- recover-two:
requires: [recover-one]
The output from job recover-one
:
./tmp
./tmp/one
./tmp/one/first.txt
./tmp/one/second.txt
The output from job recover-two
:
./tmp
./tmp/two
./tmp/two/first.txt
./tmp/two/second.txt
Why am I recovering the “second.txt” file in the recover-one
job and the “first.txt” file in the recover-two
job?
Is it something I’m doing wrong?