Help making commands pretty

All, I’m looking to move some of my CircleCI to use the new (to me) commands…command. And I’m liking it except for one thing: it is ugly on the Dashboard where I monitor the pipelines probably because I’m doing it wrong.

With my old style where I had:

      - run:
          name: "CMake"
          command: |
            cd ${CIRCLE_WORKING_DIRECTORY}/GEOSgcm
            mkdir build
            cd build
            cmake .. -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_BUILD_TYPE=Debug -DUSE_F2PY=OFF

On my Dashboard I’d see a nice section named “CMake”.

Cool. Now with a command:

commands:
  cmake:
    description: "Run CMake"
    parameters:
      repo:
        type: string
      compiler:
        type: string
    steps:
      - run: |
          mkdir -p /logfiles
          cd ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >>
          mkdir -p ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
          cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
          cmake ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >> -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=Debug -DUSE_F2PY=OFF -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-<< parameters.repo >> |& tee /logfiles/cmake.log
...
jobs:
  build-GEOSgcm:
    parameters:
      compiler:
        type: string
    executor: << parameters.compiler >>
    working_directory: /root/project
    steps:
      - run:
          name: "GEOS_Shared branch"
          command: echo ${CIRCLE_BRANCH}
...
      - cmake:
          repo: GEOSgcm
          compiler: << parameters.compiler >>

I do not see “Run CMake”, the description of the command, I see:

Uh. It’s explicit if nothing else. I tried adding a name like in my echo step seen above, but circleci config validate wasn’t happy.

Is there a way to get the Dashboard to just show “Run CMake” instead of the actual command?

Hi @mathomp4,

Thank you for sharing your question on the forum!

In order to change the step name, you will need to format the run step under your command in the same way you were doing previously.

I also noticed that you were not providing default values for the parameters which may be what was causing the validation errors. Here is a sample config I was able to validate locally:

version: 2.1

commands:
  cmake:
    parameters:
      repo:
        type: string
        default: ""
      compiler:
        type: string
        default: ""
    steps:
      - run:
          name: "Run CMake"
          command: |
            echo "This is the CMake command"
jobs:
  build:
    docker:
      - image: alpine
    steps:
      - cmake

workflows:
  workflow1:
    jobs:
      - build

Could you take a look at the above config and let me know if you can modify yours so that it passes validation?

If you would like any clarification or have additional questions, please feel free to ask.

Ahhh. That did it. I thought description: was the field in commands that would do it, but it is name: under steps->run.

Query @aaronclark : What is the description used for? Is it displayed elsewhere in the Dashboard?

Hi @mathomp4,

Glad to hear it is working!

The main usage of the description field is to provide an explanation for steps to be shown in orb documentation. It will not be shown anywhere on the dashboard.

For example:
https://circleci.com/developer/orbs/orb/circleci/windows#usage-run_windows_default

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.