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

build: Update ARTIFACT_VERSION in autocomplete files #384

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

numerical
Copy link

Updates the autocomplete files to reflect the most recent version

A future improvement could be to pull the version information in util.nim from the same place that the Makefile pulls it

Issue

Chalk never updates the autocomplete files to insert the ARTIFACT_VERSION so continually replaces the file as it's used.
#251

Description

Updates util.nim and the autocomplete files with the correct version.
Also updates the Makefile with a new target to run the nimble task that will update the autocomplete files

Testing

  1. compile chalk
  2. run any chalk command to install the new autocomplete file
  3. run any chalk command to see that the autocomplete file is no longer copied
~/chalk ❯❯❯ ./chalk env
info:  Updating autocomplete script to version: 0.4.9
info:  Installed bash auto-completion file to: /home/numeral/.local/share/bash_completion/completions/chalk.bash
info:  /home/numeral/.local/chalk/chalk.log: Open (sink conf='default_out')
info:  Full chalk report appended to: ~/.local/chalk/chalk.log
[...]

~/chalk ❯❯❯ ./chalk env
info:  /home/numeral/.local/chalk/chalk.log: Open (sink conf='default_out')
info:  Full chalk report appended to: ~/.local/chalk/chalk.log

Updates the autocomplete files to reflect the most recent version

A future improvement could be to pull the version information in
util.nim from the same place that the Makefile pulls it
@numerical numerical requested a review from viega as a code owner July 29, 2024 16:36
@numerical
Copy link
Author

One issue in this PR is that the current version is still hardcoded, I do have updates to pull in the current version with getChalkScope and use parseVersion to do the comparison if that would be better

@miki725
Copy link
Contributor

miki725 commented Aug 1, 2024

thanks for the PR!

One issue in this PR is that the current version is still hardcoded, I do have updates to pull in the current version with getChalkScope and use parseVersion to do the comparison if that would be better

there is actually a module for that already:

https://github.com/crashappsec/chalk/blob/e9a6a11865d42db1348c46b5beb7b49e2b12c144/src/config_version.nim

although it returns a string, not a tuple so there might need to be some adjusting somewhere to make it all work


as a side note we should def add a step in our release process to chalk those autocomplete files so that released version is always chalked with the corresponding release number chalkmark

@numerical
Copy link
Author

the autocheck happens during runtime so I guess get[string](getChalkScope(), 'keyspec.CHALK_VERSION.value') has to be used here, but I think it prob makes sense to add a withoutSuffix to semver to strip the -dev just in case

* add flag to parseVersion to remove suffix
* change autocomplete file check to use current version instead of
  hardcoded version
@numerical
Copy link
Author

Hey @miki725 sorry it took so long to update this PR, hacker summer camp had me running around way too much. I updated the PR to check the current chalk version in util.nim so now it compares the autocomplete file version vs the current chalk version rather than a hardcoded value. Should be ready to merge (assuming good review etc).

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

Successfully merging this pull request may close these issues.

2 participants