Giter VIP home page Giter VIP logo

Comments (14)

sxlijin avatar sxlijin commented on August 25, 2024 2

Hi @nomirose and @kevcube - thanks for flagging this for us!

Re commitlint: this is clearly broken and we're looking into it; we'll update this when we have a root cause / fix / released fix.

Re hermeticity: we have a few hermeticity issues with both linters and actions (in particular, for linters we rely on your own node_modules/, so actions + packages_file is actually a slightly different hermeticity model).

Re open source: we are aiming to eventually open source the CLI, but have no immediate plans to do so.

from plugins.

kevcube avatar kevcube commented on August 25, 2024

I retrieved the output from trunk which is ..

action_id: commitlint
date: 2022-12-09 04:28:47
run: commitlint --edit ${1}
args:
  - .git/COMMIT_EDITMSG
run_from: ""
trigger: commit-msg
result:
  exit_code: 1
  out: ""
  err: Exception occurred while executing 'commitlint'. See .trunk/out/fmVmY.yaml for details.
  error_path: /Users/kevin/code/icecube.dog/.trunk/out/fmVmY.yaml
timestamp: 1670560127
trunk_version: 1.1.0
action_output:
  notifications:
    - commands:
        - run: trunk actions history commitlint
          title: Show history
      id: commitlint_git_hook_commit-msg-failure
      message: A recent run of action 'commitlint' failed.
      priority: low
      rendered: "\x1b[1m\x1b[31m✖ A recent run of action 'commitlint' failed. Run `trunk actions history commitlint` to see the full log.\n\x1b[0m"
      timestamp: 1670560127
      title: commitlint failed

cat .trunk/out/fmVmY.yaml

title: Exception occurred while executing commitlint
report:
  - message: Unable to find binary in PATH
    binary: commitlint
    PATH:
      - /Users/kevin/.cache/trunk/actions/6165351a1a1a944c0518cc4b39b1a01d5354955584bdd78b27d807aef5a3094b/node_modules/.bin
      - /Users/kevin/.cache/trunk/linters/node/16.14.2-73bda31323fd039957d5ae145b9a37ad/bin
      - /opt/homebrew/Cellar/git/2.38.1/libexec/git-core
      - /opt/homebrew/bin
      - /Users/kevin/.bin
      - /Users/kevin/go/bin
      - /opt/homebrew/lib/ruby/gems/3.0.0/bin
      - /usr/local/bin
      - /System/Cryptexes/App/usr/bin
      - /usr/bin
      - /bin
      - /usr/sbin
      - /sbin
      - /Library/Apple/usr/bin
      - /Users/kevin/.cargo/bin
      - /Applications/kitty.app/Contents/MacOS
  - command: |
      commitlint --edit .git/COMMIT_EDITMSG
    stdin_path: (none)
    run_from: /Users/kevin/code/icecube.dog/
    timeout: 0
    rerun: env -i -C /Users/kevin/code/icecube.dog/ GITHUB_TOKEN=xxx_ffff HOME=/Users/kevin PATH=/Users/kevin/.cache/trunk/actions/6165351a1a1a944c0518cc4b39b1a01d5354955584bdd78b27d807aef5a3094b/node_modules/.bin:/Users/kevin/.cache/trunk/linters/node/16.14.2-73bda31323fd039957d5ae145b9a37ad/bin:/opt/homebrew/Cellar/git/2.38.1/libexec/git-core:/opt/homebrew/bin:/Users/kevin/.bin:/Users/kevin/go/bin:/opt/homebrew/lib/ruby/gems/3.0.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/kevin/.cargo/bin:/Applications/kitty.app/Contents/MacOS USER=kevin commitlint --edit .git/COMMIT_EDITMSG

so it is looking for the executable in my local path.

Has trunk considered hermetically packaging binaries for plugins like it does for linters?

from plugins.

kevcube avatar kevcube commented on August 25, 2024

because my goal is to have everything run on a freshly cloned repo I do not want to rely on user's commitlint

to solve this I have abandoned trunk's commitlint action in favor of husky

I also would need yarn dlx @trunkio/launcher to work to switch to trunk for my commit linting (I need to be able to install hooks on first pkg manager install)

from plugins.

nomicode avatar nomicode commented on August 25, 2024

I just came here to report the same issue. It appears that the plugin directory contains a package.yaml file that wants to install commitlint. However, evidently, this isn't happening for some reason.

from plugins.

nomicode avatar nomicode commented on August 25, 2024

I cloned the repository and have been playing around with the commitlint config. It appears that the packages_file setting is ignored, which is why the commitlint CLI tool is never installed.

You can sort of get a sense of why by looking at the error log:

report:
  - message: Unable to find binary in PATH
    binary: commitlint
    PATH:
      - /root/.cache/trunk/actions/6165351a1a1a944c0518cc4b39b1a01d5354955584bdd78b27d807aef5a3094b/node_modules/.bin
      - /root/.cache/trunk/linters/node/16.14.2-793f8dc0dd107c4610e5685da6d88dbf/bin
[...]

It appears that for NPM modules, the PATH for actions is set to whatever is installed by the root-level packages.json.

Note the presence of node_modules in the actions PATH. Then note how different the PATH looks for the linters PATH.

I haven't dug into the actual Trunk CLI code yet to see if I can find any more clues. But I think perhaps the runtime feature hasn't been implemented yet for actions (or there's been some sort of regression, meaning that it no longer works).

from plugins.

nomicode avatar nomicode commented on August 25, 2024

Huh. That took some digging. I couldn't find the source on GitHub. I found https://socket.dev/npm/package/@trunkio/launcher/, but that NPM package is a lightweight installer for a precompiled binary.

So, I am guessing that the CLI binary is not (yet?) open source. So, I have no easy way of diagnosing this issue any further.

I would like to know from the project maintainers if they intend to publish the source code for the CLI tool on GitHub?

from plugins.

kevcube avatar kevcube commented on August 25, 2024

from plugins.

nomicode avatar nomicode commented on August 25, 2024

Thanks so much! Looking forward to both.

from plugins.

sxlijin avatar sxlijin commented on August 25, 2024

Just reviewed the fix for this, so the next public release should have it for you :)

For some context: the breakage slipped in when we made some structural changes to how plugins work.

We used to define everything in the root plugin.yaml, and then for the sake of organizational sanity changed things to be defined in hierarchical ones, e.g. actions/commitlint/plugin.yaml. Our linter test coverage is a lot better than our action test coverage, which is how that slipped through the gaps.

We're currently working on migrating a whole bunch of linter definitions out of our defaults (basically, the contents of the lint section in trunk print-config) into this repo, which also includes building out a new testing framework in this repo. For now we're focusing on linter testing, since that's what we're focused on migrating right now; eventually we'll do the same for actions.

from plugins.

nomicode avatar nomicode commented on August 25, 2024

Thanks so much for the response!

I forgot about this issue, and reported it on Slack: https://trunkcommunity.slack.com/archives/C04GAE5EA5S/p1672317954988819

I'll make a note on Slack to cross-reference this issue.

from plugins.

sxlijin avatar sxlijin commented on August 25, 2024

@TylerJang27 has confirmed that this should work going as far back as trunk 1.4.0 and plugins 0.0.6, so I'm going to close this out. Please let us know if you still see issues!

from plugins.

TylerJang27 avatar TylerJang27 commented on August 25, 2024

To clarify, plugin ref v0.0.6, not commitlint 0.0.6. I tested on current commitlint latest. For best experience, use the latest release of trunk and the latest release of this plugins repo.

from plugins.

kevcube avatar kevcube commented on August 25, 2024

Thanks!

from plugins.

TylerJang27 avatar TylerJang27 commented on August 25, 2024

We are still actively working to improve our runtime versioning story around actions. To my knowledge and from my own testing, this specific issue is fixed, but we have ongoing work to make it even better. If you experience any remaining problems using commitlint with trunk, please let us know.

from plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.