Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
243 changes: 243 additions & 0 deletions bamboo-specs/bamboo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
---
version: 2
plan:
project-key: CALC
key: CML
name: Calculation Module Latest
stages:
- Default Stage:
manual: false
final: false
jobs:
- Build and Test JDK 8
- Build and Test JDK 11
- Build and Test JDK 21
- Build and Test JDK 24
- Build and Test JDK 17
- Deploy:
manual: false
final: false
jobs:
- Deploy to Maven
- Release:
manual: true
final: false
jobs:
- Release to Maven
Build and Test JDK 8:
key: BTJ8
tasks:
- checkout:
force-clean-build: 'false'
description: Checkout default repository
- script:
interpreter: SHELL
scripts:
- |-
#!/bin/bash -eu

set -x

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" maven:3.9.9-amazoncorretto-8 bash -c 'mvn clean package && chmod -R 777 .'
description: Build and test
artifact-subscriptions: []
Build and Test JDK 11:
key: BTJ11
tasks:
- checkout:
force-clean-build: 'false'
description: Checkout default repository
- script:
interpreter: SHELL
scripts:
- |-
#!/bin/bash -eu

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these two lines in between?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see one line in between, line 57.

set -x

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" maven:3.9.9-amazoncorretto-11 bash -c 'mvn clean package && chmod -R 777 .'
description: Build and test
artifact-subscriptions: []
Build and Test JDK 21:
key: BTJ21
tasks:
- checkout:
force-clean-build: 'false'
description: Checkout default repository
- script:
interpreter: SHELL
scripts:
- |-
#!/bin/bash -eu

set -x

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" maven:3.9.9-amazoncorretto-21 bash -c 'mvn clean package && chmod -R 777 .'
description: Build and test
artifact-subscriptions: []
Build and Test JDK 24:
key: BTJ24
tasks:
- checkout:
force-clean-build: 'false'
description: Checkout default repository
- script:
interpreter: SHELL
scripts:
- |-
#!/bin/bash -eu

set -x

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" maven:3.9.9-amazoncorretto-11 bash -c 'mvn clean package && chmod -R 777 .'
description: Build and test
artifact-subscriptions: []
Build and Test JDK 17:
key: BTJ17
tasks:
- checkout:
force-clean-build: 'false'
description: Checkout default repository
- script:
interpreter: SHELL
scripts:
- |-
#!/bin/bash -eu

set -x

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" maven:3.9.9-amazoncorretto-17 bash -c 'mvn clean package && chmod -R 777 .'
description: Build and test
artifact-subscriptions: []
Deploy to Maven:
key: DTM
tasks:
- checkout:
force-clean-build: 'false'
description: Checkout default repository
- script:
interpreter: SHELL
scripts:
- |-
#!/bin/bash -eu

set -x

docker pull ${bamboo.build.docker.image.id}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to pull?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for the reason I had share in the previous review. Basically to ensure that the image version passed in is always the latest, otherwise cached older variants could be used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker images are immutable. So if you are using a specific version ${bamboo.build.docker.image.id}, how can it be modified and stay as the same version.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's consider using maven:3.9.9-amazoncorretto-21. It could be any compatible variant, as that version may come in different flavors depending on the specific minor Java 21 updates included (e.g. 21.0.1, ..., 21.0.8 e.t.c). So if an older variant cache is present, the newer one is not pulled automatically by docker run.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point me to the documentation where you are reading this from?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the docs...

... if a new version of the image being used is available, it doesn't get downloaded before the jobs run. This can cause jobs to fail if new features have been added to the image and are required for the new workflow to succeed.

Cause
Bamboo uses a cached image on the build agent. If Docker finds the tag locally, it won't check the remote registry for an updated version of the same tag.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can i look at some of the values pointed at by {bamboo.build.docker.image.id} for the previous runs?

Copy link
Copy Markdown
Member Author

@Ruhanga Ruhanga Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example is maven:3.9.9-amazoncorretto-21, the default as seen on line 191;

It could be any other builder image tag. (Some other possible values)


docker run -v m2-repo:/root/.m2/repository -v ~/.m2/settings.xml:/.m2/settings.xml:ro -v ${PWD}:/module --rm -w="/module" ${bamboo.build.docker.image.id} bash -c 'mvn deploy -DskipTests --settings /.m2/settings.xml'
description: Deploy
artifact-subscriptions: []
Release to Maven:
key: RTMVN
tasks:
- checkout:
force-clean-build: 'false'
description: Checkout Default Repository
- checkout:
repository: Git
path: release-scripts
force-clean-build: 'false'
description: Checkout Default Repository
- script:
interpreter: SHELL
scripts:
- |-
#!/bin/bash -eu

set -x

docker pull ${bamboo.build.docker.image.id}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to pull?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for the reason I had share in the previous review. Basically to ensure that the image version passed in is always the latest, otherwise cached older variants could be used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't ${bamboo.build.docker.image.id} point to a specific id?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but there's provision to override that version which is the reason for ensuring safe override.

Copy link
Copy Markdown
Member

@dkayiwa dkayiwa Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that if you run docker, without an explicit pull, it will not pull the exact version contained in ${bamboo.build.docker.image.id}?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This depends on whether the image was cached. Cached images can become stale, and Docker won’t always pull the latest version if the image already exists on the machine.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that the same behaviour for the docker pull command? Will docker pull again an image which already exists?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. With docker run if a local cache exists, docker won't bother pulling an updated version which is why there's need for explicitly execute docker pull.


docker run \
-v m2-repo:/root/.m2/repository \
-v ~/.m2/settings.xml:/root/.m2/settings.xml:ro \
-v ${PWD}:/module \
-v ~/.ssh/github:/root/.ssh:ro \
-e GIT_USER_NAME=$GIT_USER_NAME \
-e GIT_USER_EMAIL=$GIT_USER_EMAIL \
-e GIT_SSH_COMMAND='ssh -i /root/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \
--rm \
-w='/module' \
${bamboo.build.docker.image.id} \
bash -c '
yum -y install git &&
yum clean all &&
git config --global user.email "$GIT_USER_EMAIL" &&
git config --global user.name "$GIT_USER_NAME" &&
git config --global --add safe.directory /module &&
./release-scripts/release-prepare-perform.sh \
-r ${bamboo.maven.release.version} \
-d ${bamboo.maven.development.version} \
-e ${bamboo.planRepository.repositoryUrl}
'
environment: GIT_USER_NAME=${bamboo.git.user.name} GIT_USER_EMAIL=${bamboo.git.user.email}
description: Release prepare perform
- any-task:
plugin-key: com.atlassian.bamboo.plugins.variable.updater.variable-updater-generic:variable-extractor
configuration:
variable: maven.release.version
removeSnapshot: 'true'
variableScope: PLAN
description: Save next release version
- any-task:
plugin-key: com.atlassian.bamboo.plugins.variable.updater.variable-updater-generic:variable-extractor
configuration:
variable: maven.development.version
variableScope: JOB
description: Retrieve next snaphot version
artifact-subscriptions: []
variables:
build.docker.image.id: maven:3.9.9-amazoncorretto-21
maven.development.version: 2.1.0-SNAPSHOT
maven.release.version: 2.0.0
repositories:
- Git:
type: git
url: https://github.com/openmrs/openmrs-module-calculation.git
branch: master
command-timeout-minutes: '180'
lfs: 'false'
verbose-logs: 'true'
use-shallow-clones: 'false'
cache-on-agents: 'false'
submodules: 'false'
ssh-key-applies-to-submodules: 'false'
fetch-all: 'false'
- Release scripts:
scope: global
triggers:
- polling:
period: '180'
repositories:
- Git
branches:
create: manually
delete: never
link-to-jira: true
notifications:
- events:
- job-failed
recipients:
- committers
- emails:
- dev-refapp@openmrs.org
labels:
- refapp
dependencies:
require-all-stages-passing: false
enabled-for-branches: true
block-strategy: none
plans: []
other:
concurrent-build-plugin: system-default
---
version: 2
plan:
key: CALC-CML
plan-permissions:
- roles:
- anonymous
permissions:
- view
...