Hi @Arumugam_ Prasanth ,
This is most likely because ephemeral agents work differently from static agents.
With ephemeral agents, Bamboo relies on the agent template capabilities when deciding what the agent can provide. So even if you add the JDK capability inside the Docker image, Bamboo may still not expose it the same way unless that capability is also defined on the ephemeral agent template.
That is why it may have worked on a static agent but not on an ephemeral one.
There is also one important detail in your example:
You added:
RUN /bamboo-update-capability.sh "system.jdk.jdk21" "/app/jdk-21"
But in the pipeline you are trying to use:
JAVA_HOME="${bamboo.capability.system.jdk.jdk-21}"
Those two names do not match:
system.jdk.jdk21
system.jdk.jdk-21
So even before looking at the ephemeral agent behavior, that variable name difference is a problem.
The better approach here is:
define the JDK capability on the ephemeral agent template
use that capability as a requirement for the job
set JAVA_HOME directly in the container image instead of trying to read it from bamboo.capability...
For example, in your Dockerfile:
ENV JAVA_HOME=/app/jdk-21
ENV PATH=$JAVA_HOME/bin:$PATH
That way, your build does not depend on Bamboo exposing the capability variable inside the script task.
So in simple terms:
for ephemeral agents, adding the capability only in the image is usually not enough. Bamboo expects those capabilities to be present on the template as well. If you want this only for one project, the usual solution is to create a separate ephemeral agent template for that project rather than trying to avoid template capabilities completely.
You could reply with something like this:
This happens because ephemeral agents do not behave like static agents when it comes to capabilities. Bamboo uses the ephemeral agent template as the main source of truth, so adding the JDK capability only inside the image is not usually enough.
Also, in your example the capability names do not match: you added system.jdk.jdk21 but referenced system.jdk.jdk-21 in the script.
The safer solution is to define the JDK capability on the ephemeral template, make the job require it, and set JAVA_HOME directly in the Docker image. If this should apply only to one project, the cleanest way is to use a dedicated ephemeral agent template for that project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.