Label orb "jobs"

I’m using the cloud foundry orb in one of my workflows. One of the things I was wondering about is if I can label the jobs that I “create” when I use it in my workflow.

Some context:

Currently, I’m using e.g.:

cloudfoundry/push:
  appname: ...

For one, I’d like to give it a more specific name that’s easier to understand when I or someone else is looking at the workflow. This is more a documentation thing, I would like to say “staging deploy” or so, instead of cloudfoundry/push.

The second reason is:

In the end, I am looking to run multiple deployments in a single workflow. I need multiple cloudfoundry/push steps or multiple instances of cloudfoundry/dark_deploy and cloudfoundry/live_deploy (we deploy to multiple CF setups).

It’ll get extra-messy with requires etc. when I need to reference them (e.g. for multiple approves/holds to promote code to different environments).

Any thoughts on how to accomplish this without building my own orb?

Found this while testing/inspecting:

workflows:
  version: 2
  build_app:
    jobs:
    - build_php
    - build_js
    - test_php:
        requires:
        - build_php
        - build_js
    - cloudfoundry/push-1:
        requires:
        - build_php
        - build_js
    - cloudfoundry/push-2:
        requires:
        - test_php

It automatically appends -NUM. So I guess my second concern is “fixed”.

But the first still stands.

Can’t seem to create a dependency:

$ circleci config process ./.circleci/config.yml 
Error: Job 'production_hold' requires 'cloudfoundry/push-1', which is the name of 0 other jobs in workflow 'build_app'

I also can’t add the -1 myself:

13:27 $ circleci config process ./.circleci/config.yml 
Error: Error calling workflow: 'build_app'
Cannot find a definition for job named cloudfoundry/push-1

To add some pseudo YAML:

instead of doing:

- cloudfoundry/push:
    app name: foo

I am looking for:

- name: staging deploy
  command: cloudfoundry/push
    appname: foo

Got a bit confused with commands and jobs. The Cloud Foundry ORB has a command “push” and a job “push”. The job is a shortcut and wraps the commands “install” and “push”.

Thanks to Scott from CircleCI Support and @iynere on Github for helping me!

An example is this:

version: 2.1

orbs:
  cloudfoundry: circleci/cloudfoundry@0.1.46

jobs:
 my_deployment:
   docker:
     ...
   steps:
     - checkout
     - etc. pp.
     - cloudfoundry/install:
         endpoint: https://api.run.pivotal.io
         org: my-org
         space: my-space
     - cloudfoundry/push
         ...

workflows:
  version: 2.0
  everything:
    jobs:
      - my_deployment
      - something_else
          requires:
            - my_deployment

so… no labeling jobs right?

Building upon the automatic numbering for repeated jobs (like this example where I run node/test twice), I managed to leverage the matrix options to have better automated names: see this other example with more than one matrix and with a matrix-named dependency. Here’s the meaningful part of the config:

workflows:
  node-tests:
    jobs:
      - node/test:
          matrix:
            parameters:
              version:
                - lts # generates node/test-lts build
                - current # generates node/test-current build
      - node/test:
          version: lts
          matrix:
            parameters:
              run-command:
                - chromatic # generates node/test-chromatic build
          requires:
            - node/test-lts # depends on specifc build from previous matrix

Nevermind what I did above. It does work, but spelunking through the documentation, I found a mention to the name property in workflow jobs.

workflows:
  matchmaker:
    jobs:
      ...
      - node/test:
          name: chromatic
          version: lts
          run-command: chromatic
          requires:
            - node/test-lts
      - node/test:
          name: vercel
          version: lts
          run-command: vercel -- --token $VERCEL_AUTH_TOKEN
          requires:
            - node/test-lts