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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,920
Community Members
 
Community Events
176
Community Groups

Need help with Bamboo using Docker for build/test environments

Hello everyone,

I having an issue with Bamboo using Docker to spin up a Python container install some packages then run unit tests.

I am using Bamboo YAML spec files for configuring the pipeline. In the Spec file I defined Docker to use the Python image at the plan level.

When the pipeline runs Bamboo spins up the Python container and runs the Build stage to install python packages, but for the Test stage Bamboo spins up another Python container that doesn't have my dependencies and tests fail.

I must be misunderstanding or doing something wrong. Any guidance or assistance would be much appreciated.

 

Expectation:

- Bamboo Spins up Python container

- pulls code

- install packages

- run tests

All inside the same isolated container.

 

Example Spec File:

---
version: 2
plan:
   project-key: AN
   key: PYAPP
   name: py app testing

docker:
   image: python:3.7
   volumes:
      ${bamboo.tmp.directory}: ${bamboo.tmp.directory}:z
      ${bamboo.working.directory}: ${bamboo.working.directory}:z
  use-default-volumes: false

stages:
  - Build environment:
       - Build
  - Test Ansible Role:
       - Test

Build:
  tasks:
   - script:
       - pip install pytest
       - pip install -e .

Test:
  tasks:
    - script:
        - pytest

1 answer

1 accepted

0 votes
Answer accepted

Hello @Patrick Peace

The behavior you see is expected. You defined two different stages, each stage has a different job. Each job will run in a fresh Docker container. 

To avoid the issue you are facing you could:

Option 1

  • Put all the tasks in the same stage.

Option 2

  • Build a new image with all the dependencies you need for your build and add it to docker hub. Then reference the new image in your build. This will allow you to use different jobs for your builds without the need to re-add the dependencies.

I hope that clarifies the issue.

You are always welcome @Patrick Peace!

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events