使用 orb 的 CircleCI 验证:找不到作业的定义

CircleCI validation using orb: Cannot find a definition for job

我创建了一个 circleci orb dev 并发布了它:

>circleci orb publish myorb.yml mynamespace/myorb@dev:alpha2
Orb `mynamespace/myorb@dev:alpha2` was published.
Please note that this is an open orb and is world-readable.
Note that your dev label `dev:alpha2` can be overwritten by anyone in your organization.
Your dev orb will expire in 90 days unless a new version is published on the label `dev:alpha2`.

因为我发现在registery下看不到dev orbs,我尝试使用cli列出它,这是我得到的:

 >circleci orb list vydev --uncertified
 Orbs found: 1. Includes all certified and uncertified orbs.

 mynamespace/myorb (Not published)

当我尝试检查我的 config.yml 文件的验证时,我收到此错误:

 >circleci config validate
 Error: Error calling workflow: 'myworkflow'
 Cannot find a definition for job named myorb/job1

这里是 myorb.yml 文件:

version: 2.1
description: My orb

commands:
  job1:
    description: "job1"
    steps:
      - checkout:
          path: ~/repo
      - run:
          name: Validate code
          command: |
            printf "Validating code\n"
        
  job2:
    steps:
      - checkout:
          path: ~/repo
      - run:
          name: Zip source code
          command: |
            s3_prefix="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/branches/$CIRCLE_BRANCH"
            sha1="$(echo $CIRCLE_SHA1 | cut -c -7)"
            ls -al
            more commands
      - persist_to_workspace:
          root: ./
          paths:
            - "*"
  job3:
    steps:
      - attach_workspace:
          at: /tmp/workspace
      - run:
          name: Upload source to S3
          command: |
            s3_bucket="mybucket"
            ls -al
            more commands

executors:
  exe1:
    description: using defined version 
    parameters:
      version:
        type: string
        default: ${version} 
        description: Version of code
    docker:
      - image: << parameters.version >>
    working_directory: /tmp/workspace
  exe2:
    description: buildpackages
    docker:
      - image: myimage:latest 
    working_directory: /tmp/workspace   
  exe3:
    description: using ECR CLI
    docker:
      - image: myimage:v1
    working_directory: /tmp/workspace

和config.yml如下图:

version: 2.1
orbs:
  myorb: mynamespace/myorb@dev:alpha2
workflows:
  myworkflow:
    jobs:
      - myorb/job1:
          executor: 
            name: myorb/exe1
            version: 0.12.24
          filters:
            branches:
              only: master
      - myorbm/job2:
          executor: 
            name: myorb/exe2
          filters:
            branches:
              only: master
      - myorb/job3:
          executor: 
            name: myorb/exe3
          filters:
            branches:
              only: master
          requires:
            - myorb/job1
            - myorb/job2

有人知道这里缺少什么吗?

如有任何帮助,我们将不胜感激。

在您提供的示例中,您正在定义 commands 并将它们命名为 jobs.

错误是说该名称下没有工作,因为没有。但是有命令。

命令必须在作业中使用。

https://circleci.com/docs/2.0/orbs-faq/#difference-between-commands-and-jobs

如何创作作业:https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs

实例:

节点“测试”工作https://github.com/CircleCI-Public/node-orb/blob/master/src/jobs/test.yml

节点“install-packages”命令https://github.com/CircleCI-Public/node-orb/blob/master/src/commands/install-packages.yml