Skip to content

CALC-58: Added support for Bamboo Specs.#14

Merged
dkayiwa merged 6 commits intoopenmrs:masterfrom
Ruhanga:CALC-58
Jul 21, 2025
Merged

CALC-58: Added support for Bamboo Specs.#14
dkayiwa merged 6 commits intoopenmrs:masterfrom
Ruhanga:CALC-58

Conversation

@Ruhanga
Copy link
Copy Markdown
Member

@Ruhanga Ruhanga commented Jun 9, 2025

This PR adds Bamboo Specs involving JDK 21 and 24 since those are the only ones have successful builds.

https://openmrs.atlassian.net/browse/CALC-58

@Ruhanga
Copy link
Copy Markdown
Member Author

Ruhanga commented Jun 16, 2025

Hi @dkayiwa, could we merge this?

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Jun 16, 2025

What failures do you get for the other Java versions?

@Ruhanga
Copy link
Copy Markdown
Member Author

Ruhanga commented Jun 16, 2025

This master branch was updated a few days ago. I missed this. Let me update this PR accordingly.

@Ruhanga
Copy link
Copy Markdown
Member Author

Ruhanga commented Jul 16, 2025

Hi @dkayiwa, I think this might have slipped through the cracks. Could we go ahead and get it merged?


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

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

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


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.


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.


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)

@dkayiwa dkayiwa merged commit d5e64b5 into openmrs:master Jul 21, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants