Skip to content
Snippets Groups Projects

added package_version() in Lua, removed version module

Merged Marek Vavrusa requested to merge add-version-in-lua into master
All threads resolved!

It's generally useful to export current package version, so I added that. Fixed some problems in the version module:

  • Custom build version results in wrong information
  • Empty response raises error (when blocked for example)
  • Malformed response raises error
  • Double event initialisation
Edited by Tomas Krizek

Merge request reports

Pipeline #37837 passed with warnings

Pipeline passed with warnings for b138e3a8 on add-version-in-lua

Test coverage 70.20% (0.20%) from 1 job
Approval is optional

Merged by Tomas KrizekTomas Krizek 6 years ago (Jul 16, 2018 9:35am UTC)

Merge details

  • Changes merged into master with ce809057.
  • Deleted the source branch.
  • Auto-merge enabled

Pipeline #37838 passed with warnings

Pipeline passed with warnings for ce809057 on master

Test coverage 70.20% (0.20%) from 1 job

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added feature label

  • Petr Špaček changed title from added package_version() in Lua, catched some errors in version, added test to WIP: added package_version() in Lua, catched some errors in version, added test

    changed title from added package_version() in Lua, catched some errors in version, added test to WIP: added package_version() in Lua, catched some errors in version, added test

  • Petr Špaček changed the description

    changed the description

  • Petr Špaček changed target branch from query-trace to master

    changed target branch from query-trace to master

  • Marek Vavrusa added 494 commits

    added 494 commits

    • b2c003be...400941fb - 493 commits from branch master
    • b077f912 - added package_version() in Lua, catched some errors in version, added test

    Compare with previous version

  • Author Reporter

    The linter fails because of some other changes merged to master:

    not ok 39 tests/config/keyfile/nonexist_keyfile1.test.lua:2:1: (W122) setting read-only field 'keyfile_default' of global 'trust_anchors'
    not ok 40 tests/config/keyfile/nonexist_keyfile2.test.lua:2:1: (W122) setting read-only field 'keyfile_default' of global 'trust_anchors'
    ok 41 tests/config/test_utils.lua
    not ok 42 tests/config/tests/keyfile/nonexist_keyfile1.test.lua:2:1: (W122) setting read-only field 'keyfile_default' of global 'trust_anchors'
    not ok 43 tests/config/tests/keyfile/nonexist_keyfile2.test.lua:2:1: (W122) setting read-only field 'keyfile_default' of global 'trust_anchors'
  • Author Reporter

    It's broken since 2702e041, because the files['tests'].ignore doesn't specify an override for W122 in .luacheckrc, @pspacek do you want me to fix that in this PR, or are you going to fix it separately?

  • Feel free to fix it in here, just in separate commit.

  • @tkrizek Please have a look at this and make sure the versioning scheme here makes sense to you and can express versioning in all the distros we build packages for. Thanks!

  • assigned to @tkrizek

  • The version number shouldn't be considered as three integers. That only applies to regular releases. We're also using development versions, which currently have the format of 2.1.1.40.gd71db413.

    This format will have to change once we start using a different branching model to also support older branches. Then I expect we'll be using same version as in knot-version.m4, which can also produce versions like 2.7.dev or 2.6.5.dev.

    sort can properly handle all of these versions. The complete list of possible versions looks like this (sorted, ascending):

    2.1.1
    2.1.1.40.gd127b73e
    2.1.1.dev.1521451111.g83923cba   (future)
    2.1.2
    2.1.2.dev.1521451112.g4c168228   (future)
    2.1.dev.1521451113.g2d2e34e8     (future)
    2.2.0

    When the version is checked, I think the entire version string should be taken and compared lexicographically to the latest version from DNS TXT. Then, the user should be notified only when the current version is older (not different) than the latest.

  • Author Reporter

    Did you figure out whether you want return it as a string, or as a tuple in the end? I'm happy to keep it as it is or revert the change to tuple @pspacek asked for. The only thing that's useful to me is that I can return a running version in CH TXT responses.

  • Marek Vavrusa unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Author Reporter

    @vcunat @pspacek @tkrizek Any consensus? I don't mind either string or table, I'd just like to expose resolver version in metrics to track deployments.

  • I'm sorry for the delay, this totally fall through cracks. @tkrizek will decide what to do with it today.

  • @vavrusam We can use the string representation as proposed in https://gitlab.labs.nic.cz/knot/knot-resolver/merge_requests/412#note_72742 . These string versions can compared using lua string comparison, so it's possible to do version checks such as version >= '2.3'. I've tested all the above cases and it handles them as expected.

    Sorry for the delay!

  • For the comparisons we would need to make sure that we don't release e.g. 2.10, but that seems a reasonable rule anyway, at least for some medium-term future (until 9.9).

    Edited by Vladimír Čunát
  • Marek Vavrusa added 210 commits

    added 210 commits

    • 733ebbe3...d316da92 - 209 commits from branch master
    • 0329d1bc - added package_version() in Lua, catched some errors in version, added test

    Compare with previous version

  • Author Reporter

    @tkrizek rebased and updated to text format

  • Marek Vavrusa added 2 commits

    added 2 commits

    • 82fa2fde - luacheck: added missing module (trust_anchors)
    • b2c99a77 - added package_version() in Lua, catched some errors in version, added test

    Compare with previous version

  • @tkrizek Ready for merge?

  • Tomas Krizek
  • Tomas Krizek
  • @vavrusam We were considering the use cases of this module with @pspacek and we couldn't come up with any reasonable ones. Are you only interested exposing the package_version() function to lua, or do you intend to use the version.lua module as well?

    If it's only about package_version(), we're considering to drop the version module entirely. Distribution packages don't use it by default and those who decide to compile kresd by themselves have more appropriate means to find out about new versions than from the log (e.g. knot-resolver-announce mailing list; twitter or watching the git repo for new tag)

    The CVE detection/warning also wouldn't work as is. The CVE published in the et.knot-resolver.cz TXT record is the latest found CVE and it stays there until a new one appears. Thus, users would get false positive warnings with the current implementation, when updating from a version that already has the latest CVE fixed.

    If you're not interested in the version.lua module and just want the API, feel free to remove it in this MR.

    Thanks!

  • Author Reporter

    I have no use case for the module, just the package_version(). I'll remove it then.

    Edited by Marek Vavrusa
  • assigned to @vavrusam

  • Petr Špaček marked as a Work In Progress

    marked as a Work In Progress

  • Marek Vavrusa added 171 commits

    added 171 commits

    • b2c99a77...4141975d - 169 commits from branch master
    • 351a305b - luacheck: added missing module (trust_anchors)
    • febcfd7c - added package_version() in Lua, catched some errors in version, added test

    Compare with previous version

  • Author Reporter

    Removed the version module and rebased to master.

  • Marek Vavrusa added 1 commit

    added 1 commit

    • e0c0b112 - added package_version() in Lua, removed version module, added test

    Compare with previous version

  • Tomas Krizek added 2 commits

    added 2 commits

    • 2791f75f - luacheck: added missing module (trust_anchors)
    • ea9bfca9 - added package_version() in Lua, catched some errors in version, added test

    Compare with previous version

  • Tomas Krizek added 174 commits

    added 174 commits

    • ea9bfca9...a861c4de - 171 commits from branch master
    • a913cd7f - luacheck: added missing module (trust_anchors)
    • b4d9c9ee - added package_version() in Lua, removed version module
    • 0e3de4fc - distro/deb: remove version.lua module

    Compare with previous version

  • Tomas Krizek unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Tomas Krizek changed title from WIP: added package_version() in Lua, catched some errors in version, added test to added package_version() in Lua, removed version module

    changed title from WIP: added package_version() in Lua, catched some errors in version, added test to added package_version() in Lua, removed version module

  • Tomas Krizek added 5 commits

    added 5 commits

    • 0e3de4fc...df546afb - 2 commits from branch master
    • 97a43e26 - luacheck: added missing module (trust_anchors)
    • fcdf8d6e - added package_version() in Lua, removed version module
    • b138e3a8 - distro/deb: remove version.lua module

    Compare with previous version

  • Tomas Krizek resolved all discussions

    resolved all discussions

  • Tomas Krizek enabled an automatic merge when the pipeline for b138e3a8 succeeds

    enabled an automatic merge when the pipeline for b138e3a8 succeeds

  • Looks good, thanks!

  • merged

  • Tomas Krizek mentioned in commit ce809057

    mentioned in commit ce809057

  • Please register or sign in to reply
    Loading