iteratec/semantic-release-docker

TypeError: context.options.prepare.find is not a function

brpaz opened this issue · 2 comments

brpaz commented

Hello.
Got this error when running this plugin:

Envrionment: Linux (GitHub Actions)
Node version: 10.16.3
Semantic Release version: 15.13.24

 + semantic-release@15.13.24
+ @iteratec/semantic-release-docker@1.0.5
added 782 packages from 1038 contributors in 23.451s
[6:51:19 PM] [semantic-release] › ℹ  Running semantic-release version 15.13.24
[6:51:19 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[6:51:19 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@iteratec/semantic-release-docker"
[6:51:19 PM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[6:51:19 PM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[6:51:19 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@iteratec/semantic-release-docker"
[6:51:19 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@iteratec/semantic-release-docker"
[6:51:19 PM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[6:51:19 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[6:51:19 PM] [semantic-release] › ✔  Run automated release from branch master
[6:51:20 PM] [semantic-release] › ✔  Allowed to push to the Git repository
[6:51:20 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[6:51:20 PM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication
[6:51:20 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
[6:51:20 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@iteratec/semantic-release-docker"
[6:51:20 PM] [semantic-release] › ✖  Failed step "verifyConditions" of plugin "@iteratec/semantic-release-docker"
[6:51:20 PM] [semantic-release] › ✖  An error occurred while running semantic-release: { TypeError: context.options.prepare.find is not a function
    at verifyConditions (/opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/@iteratec/semantic-release-docker/verifyConditions/index.js:17:34)
    at validator (/opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/semantic-release/lib/plugins/normalize.js:34:30)
    at pReduce (/opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/semantic-release/lib/plugins/pipeline.js:37:40)
    at next (/opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/semantic-release/node_modules/p-reduce/index.js:17:9)
    at process._tickCallback (internal/process/next_tick.js:68:7) pluginName: '@iteratec/semantic-release-docker' }
{ AggregateError: 
    TypeError: context.options.prepare.find is not a function
        at verifyConditions (/opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/@iteratec/semantic-release-docker/verifyConditions/index.js:17:34)
        at validator (/opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/semantic-release/lib/plugins/normalize.js:34:30)
        at pReduce (/opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/semantic-release/lib/plugins/pipeline.js:37:40)
        at next (/opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/semantic-release/node_modules/p-reduce/index.js:17:9)
    at /opt/hostedtoolcache/node/10.16.3/x64/lib/node_modules/semantic-release/lib/plugins/pipeline.js:54:11
    at process._tickCallback (internal/process/next_tick.js:68:7) name: 'AggregateError' }

And my .releaserc configuration file:


{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator", 
    "@semantic-release/github",
    "@iteratec/semantic-release-docker"
  ],
  "verifyConfig": ["@iteratec/semantic-release-docker"],
  "prepare": {
    "path": "@iteratec/semantic-release-docker",
    "imageName": "myimage",
    "respositoryName": "brpaz"
  },
  "publish": {
    "path": "@iteratec/semantic-release-docker"
  }
}

Having the same error. In general, I'm a bit confused by the configuration of the prepare block since most of the top-level keys in a .release.[yml|json] file are arrays, and not objects. Case in point, I've configured my .releaserc.json file as follows:

{
  "branch": "master",
  "ci": true,
  "debug": true,
  "plugins": [
    [
      "@semantic-release/changelog",
      {
        "changelogFile": "CHANGELOG.md",
        "changelogTitle": "# someapp Changelog"
      }
    ],
    [
      "@semantic-release/commit-analyzer",
      {
        "present": "angular"
      }
    ],
    "@iteratec/semantic-release-docker",
    [
      "@semantic-release/git",
      {
        "assets": [
          "CHANGELOG.md"
        ],
        "message": "build(release): release <%= nextRelease.version %> - <%= new Date().toLocaleDateString('en-US', {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' }) %> [ci skip]\n\n<%= nextRelease.notes %>"
      }
    ],
    "@semantic-release/gitlab",
    [
      "@semantic-release/release-notes-generator",
      {
        "preset": "angular",
        "writerOpts": {
          "commitsSort": [
            "scope",
            "subject"
          ]
        }
      }
    ]
  ],
  "prepare": [
    [
      "@iteratec/semantic-release-docker",
      {
        "additionalTags": ["stable"],
        "imageName": "test-repo",
        "respositoryName": "stackstate"
      }
    ]
  ],
  "publish": [
    "@iteratec/semantic-release-docker",
    [
      "@semantic-release/gitlab",
      {
        "assets": [
          {
            "label": "someapp-darwin-amd64",
            "path": "./someapp-darwin-amd64"
          },
          {
            "label": "someapp-linux-amd64",
            "path": "./someapp-linux-amd64"
          },
          {
            "label": "someapp-windows-amd64",
            "path": "./someapp-windows-amd64.exes"
          }
        ]
      }
    ]
  ],
  "repositoryUrl": "https://gitlab.com/myorg/someapp",
  "verifyConditions": [
    "@iteratec/semantic-release-docker",
    "@semantic-release/gitlab"
  ],
  "verifyConfig": [
    "@iteratec/semantic-release-docker"
  ]
}

IMO, the prepare step should look like what I have, namely an array since there might be multiple plugins called during the prepare stage. However, if I use the object form that @brpaz has mentioned, I receive the same error.

brpaz commented

ah, ok. makes sense. Thank you. I will close this them.