Skip to content
Merged
Changes from 3 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
267 changes: 267 additions & 0 deletions bamboo-specs/bamboo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
---
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

export IMAGE="maven:3.9.9-amazoncorretto-8"
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 still need the above line?

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.

Yep, it’s just to make it easier for others to find the right variable when making changes.

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.

I am not sold to variables for one time usages. I usually defer to the times when such need actually arises. I am a fun of reviewing and maintaining less code 😊

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 guess, it comes down to balancing between less code and clarity, especially when it involves variables that might change later. Personally, I’d prefer more explicit and readable lines over fewer, less clear ones. I'm happy to change in favour of fewer lines though as I think this may not be the best example.

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.

When you say might change, many times this never happens. That is how we end up with lots of things in our code bases that are never used. But a developer thought that this might be of use in the future. I do not see us reducing the clarity of this code by using maven:3.9.9-amazoncorretto-8, unless we want to use it to teach others the meaning of the parameters for the docker run command. 😊

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 like this... Thanks for clarifying @dkayiwa.


docker pull ${IMAGE}
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.

By the way, do we need to explicitly pull? Shouldn't run automatically do that?

Copy link
Copy Markdown
Member Author

@Ruhanga Ruhanga Jul 16, 2025

Choose a reason for hiding this comment

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

By the way, do we need to explicitly pull?

No, just for explicitly's sake. It's not harmful but I could remove it.

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.

I like reviewing a smaller number of lines :)

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.

Should be a lighter review now with the latest commit... :-)


docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" ${IMAGE} 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

export IMAGE="maven:3.9.9-amazoncorretto-11"

docker pull ${IMAGE}

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" ${IMAGE} 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

export IMAGE="maven:3.9.9-amazoncorretto-21"

docker pull ${IMAGE}

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" ${IMAGE} 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

export IMAGE="maven:3.9.9-amazoncorretto-11"

docker pull ${IMAGE}

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" ${IMAGE} 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

export IMAGE="maven:3.9.9-amazoncorretto-17"

docker pull ${IMAGE}

docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" ${IMAGE} 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

export IMAGE=${bamboo.build.docker.image.id}

docker pull ${IMAGE}

docker run -v m2-repo:/root/.m2/repository -v ~/.m2/settings.xml:/.m2/settings.xml:ro -v ${PWD}:/module --rm -w="/module" ${IMAGE} 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

export IMAGE=${bamboo.build.docker.image.id}

docker pull ${IMAGE}
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 here?

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, to ensure we’re using the latest of the provided image if not pulled yet.

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.

Wouldn't the docker run automatically do that?

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.

At-times no especially if the image available in the local cache exists even when not the latest.

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.

Aren't we using a specific image 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.

The one provided at that build stage varies and so is not specific. It does have a default though.

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.

If you provided this to the docker run command ${bamboo.build.docker.image.id}, will it run a different one from ${IMAGE} ?

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...

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.

So what is the added value?

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.

Should now be amended below.


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' \
${IMAGE} \
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
...