How to share data between pipelines (circleci workflows 2.1)

nodejs
circle.yml
2.0
#1

We have two independent pipelines, A and B, from different repositories.

After A is successfully deployed, it will post a file called config.js, I am thinking to save it as artifacts and share this file to pipeline B and save it to src/config.js when run pipeline B.

How can I set the pipeline (.circleci/config.yml ) in pipeline A and B? Any reference for me?

#2

The “workspace” feature of workflows should be exactly what you need

https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs

#3

@glenjamin.circleci

Thanks for your reply. I have gone through the url you pasted many times before, that’s clearly for sharing data among jobs in same pipeline.

I am looking for the solution to share the data between pipelines which from different repositories.

#4

Oh, my mistake - I didn’t read the post closely enough.

How would you want to decide which job’s config.js to use?

You should be able to use the API to find the latest result and download an artifact.

Another approach i’ve used in the past is to push the generated file to a git branch, and have the other project read it from there.

2 Likes