Run Test step using "Gradle" as Build Tool is failing with error "sh: 2: gradle: not found"

Running CI pipeline with test step which is configured with Gradle as build tool could fail with the below error.

sh: 2: gradle: not found

When we configure run test step in CIE pipeline, we have the option to choose which image we want to run the test step on. Also we have the option to choose the source code language and build tool such as maven, gradle, bazel etc. We could get an error similar to the above when the image used in the run test step doesn’t have gradle binary available in it.

To avoid getting into these issues, we need to make sure that the build tools that we configure in the run test step are available in the image that we specify in the same step.