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,458,901
Community Members
 
Community Events
176
Community Groups

Simple Bitbucket pipeline with Bamboo

There isn't an only way to perform this, however, this is especially useful where Bamboo script task may not have support for tty. Running docker exec -it is not supported, so commands can not be passed as input to a running container. 

This example illustrates a use case where multiple services are required to perform an application test, and they can be spawned with containerization.  At the end of the test, we would like to parse the result.

Step 1: 

Create the executable script index.sh in a location in the repository. The script should contain the necessary instruction to run and perform the test for the project 

#!/bin/sh

#script goes here i.e.
npm install

npm run test



Step 2:

Create a Dockerfile with an ENTRYPOINT of a script to be run in when the container is started 

FROM {PRE-BUILT-IMAGE}

WORKDIR /app/

# Copy all project into the container working directory
COPY . ./app

#make the script an executable
RUN chmod a+x index.sh


#Specify the interpreter to run the script
ENTRYPOINT ["/bin/sh", "index.sh" ]

Step 3:

Create a docker-compose.yml to orchestrate the container and required services

version: "3.7"

services:

app:
mage: webapp
container_name: C-NAME
build:
context: ./
dockerfile: Dockerfile

# map the volume to the host filesystem, this will be useful if a test
# run by the script produces result that should be parsed by a Bamboo task

volumes:
- ./test:/app/test-reports

# add the required services
service1:
image: IMAGE

 
Step 4:
Example of a Bamboo YAML Specs managed plan
---
version: 2

# List of plan's stages and jobs
stages:
- Building to run the custom test within docker container:
- Build
- Parse Test Results:
- Test


#Job definition
Build:
tasks:
- script:
- docker-compose up -d
- script:
- docker-compose down
Test
tasks:
- test-parser:
type: junit
test-results: '**/test/*.xml'


References

0 comments

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events