How to specify an executor parameter for the Gradle orb?

I’m trying to use the circleci/gradle@3.0.0 orb, but I need to execute builds using Java 17 (instead of the default, which seems to be Java 13). According to the orb docs, the default executor has a parameter, tag that can be used to specify the tag of the cimg/openjdk Docker image that will be used, but I can’t figure out how to specify that tag parameter in my workflow.

Here’s what I’ve tried:

version: 2.1

orbs:
  gradle: circleci/gradle@3.0.0
workflows:
  build--app1:
    jobs:
      - gradle/run:
          app_src_directory: 'App1'
          executor:
            name: default
            tag: "17.0.6"

That produces an error in the config editor: Cannot find a definition for executor named default. If I leave off the name then I get the error: The value of name must be a string.

So how can I specify the tag to be used for the executor of this orb? In general, it would be useful to have examples of “interesting” usage of the org.

I think the issue is that the docs for the orb are ‘as clear as mud’ when it comes to how to use an executor.

From looking at the code published for the orb, what it is expecting you to do is define an executor under ‘executors:’ and then pass the name of the defined executor to the orb. ‘tag’ then becomes a parameter passed to the defined executor.

As such the following may work

version: 2.1

orbs:
  gradle: circleci/gradle@3.0.0
workflows:
  build--app1:
    jobs:
      - gradle/run:
          app_src_directory: 'App1'
          executor: default
            tag: "17.0.6"

As the value ‘default’ is now assigned to the parameter executor as within the orb code there is a ‘default’ executor defined called ‘default’ that accepts a parameter called tag.

Unfortunately, that didn’t work either. That’s a YAML parsing error: mapping values are not allowed here.

I’ve been trying a few options, but I’ve not had any luck getting exactly the right syntax to allow the tag parameter to be passed via the orb to the executor.

What you can do is just define your own executor with its own default value for the tag and just have the orb use that.

version: 2.1

orbs:
  gradle: circleci/gradle@3.0.0

executors:
  test-exec:
    parameters:
      tag-value:
        type: string
        default: "17.0"
    docker:
      - image: cimg/openjdk:<<parameters.tag-value>>

workflows:
  build--app1:
    jobs:
      - gradle/run:
          app_src_directory: 'App1'
          executor: 
            name: "test-exec"

Maybe someone will be a long who does know the correct way to pass the value via the orb at some point

I believe I got this working using the following config:

workflows:
  test:
    jobs:
    - gradle/test:
        executor:
          name: gradle/default
          tag: "21.0"