Using custom jobs in pre-step?

Hi everyone.

I’ll try and shorten my config example to an absolute minimum, and then ask my question-

version: 2.1
  aws-ecr: circleci/aws-ecr@7.0.0
  git-secret: lyvly/git-secret@0.1.0
      - image: 'circleci/node:10.16.3'
      - git-secret/install_git_secret
      - git-secret/import_gpg_key:
          variable_name: GPG_PRIVATE_KEY
      - git-secret/reveal_secrets
      - aws-ecr/build-and-push-image:
          - checkout
          - reveal-secrets

The above configuration is telling me I can’t use reveal-secrets in my pre-steps with the following error:

Cannot find a definition for command named reveal-secrets

Can’t I somehow use this job in my pre-steps?

Hi @Repox ,

Thank you for your question.

Based on your config file, I can see that reveal-secrets is defined as a job. For pre-steps, only steps/commands can be specified. I believe this is why you are getting the error message.

Could you try moving the three steps (git-secret/install_git_secret, git-secret/import_gpg_key, and git-secret/reveal_secrets) under checkout in pre-steps?

Following that, if you do not have additional steps in the reveal-secrets job, I think it would be fine to remove it completely from the config (as you would execute all steps in aws-ecr/build-and-push-image.)

In theory this should get rid of the error message, but you may need to make other changes if your config is more complex then the example above.

Let us know if you have any questions about this. Thank you!

replace jobs: with commands: on line 5