Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Sharing environment across steps

Yogesh Mongar February 9, 2020

Question: Is it possible to share docker environment used in step 1 with other steps?

 

I have a huge number of test files and instead of running all in a single step, I would like to break and run these in multiple steps. However, all of these steps would need a common environment setup. Instead of setting up the initial environment like bundler and other app dependencies on every step, will it be possible to run the initial setup in one step, and use that in other steps?

 

Thanks

1 answer

0 votes
Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2020

Hi @Yogesh Mongar , one approach you could use is to build the custom docker image with all dependencies in the initial step and use this image to run the rest of the steps. Here is an example:

pipelines:
branches:
master:
- step:
name: Build the environment
services:
- docker
script:
- echo ${DOCKERHUB_PASSWORD} | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
- docker build -t dockerhub-username/image-name .
- docker push dockerhub-username/image-name
- step:
name: Test
image: dockerhub-username/image-name
script:
- echo Running tests

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events