Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verify step results in confusing output #22

Open
ThisIsMissEm opened this issue Aug 11, 2021 · 0 comments
Open

verify step results in confusing output #22

ThisIsMissEm opened this issue Aug 11, 2021 · 0 comments

Comments

@ThisIsMissEm
Copy link

In our CI output, whilst trying to use this plugin, we'd been getting the following crash:

[11:50:27 AM] [@yaradigitallabs/node-orb] › ✖  An error occurred while running semantic-release: Error: Command failed: circleci orb publish orbs/graphql/orb.yml yaradigitallabs/[email protected] --token [secure]
Error: Could not load config file at orbs/graphql/orb.yml: open orbs/graphql/orb.yml: no such file or directory
    at makeError (/home/circleci/project/node_modules/semantic-release-circleci-orb/node_modules/execa/index.js:174:9)
    at /home/circleci/project/node_modules/semantic-release-circleci-orb/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async module.exports (/home/circleci/project/node_modules/semantic-release-circleci-orb/lib/publish.js:32:3)
    at async validator (/home/circleci/project/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /home/circleci/project/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next (/home/circleci/project/node_modules/p-reduce/index.js:16:18) {
  code: 255,
  stdout: '',
  stderr: 'Error: Could not load config file at orbs/graphql/orb.yml: open orbs/graphql/orb.yml: no such file or directory\n',
  failed: true,
  signal: null,
  cmd: 'circleci orb publish orbs/graphql/orb.yml yaradigitallabs/[email protected] --token [secure]',
  timedOut: false,
  killed: false,
  pluginName: 'Inline plugin'
}

But we knew this file existed; after a lot of debugging, what we realised was that we'd totally misconfigured semantic-release i.e., per orb we'd included this plugin, but of cause each orb was a separate package in our yarn workspace, so we were calling the plugin from other packages that were to be published in our yarn workspace, not just those that need to release orbs.

The issue I'm wanting to report was that the debug & log output here hid this issue (it was only once I started forking your package via patch-package that I realised what was happening).

So we'd be doing:

  semantic-release:circleci-orbs Verifying orb at orbs/graphql/orb.yml from [truncated]/packages/botato-cli +114ms

Even though that file was relative to the root of our workspace, not a file inside packages/botato-cli.

In the verify step, you actually need to be verifying that orbPath exists in the cwd: https://github.com/matt-oakes/semantic-release-circleci-orb/blob/master/lib/verify.js#L23-L25

-   if (!orbPath) {
+   if (!orbPath || !fs.existsSync(path.join(cwd, orbPath))) {

This way you're actually verifying that the orb.yaml exists in the cwd from where you're running semantic-release.

Also, the usage of a global for "have we run verifyConditions" (https://github.com/matt-oakes/semantic-release-circleci-orb/blob/master/index.js#L5) means that this plugin cannot be used to release multiple orbs at once.

I'm now working on a replacement plugin that loads the orb release configuration from package.json inside the release directory, rather than passing orbName and orbPath through the plugin configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant