Skip to content

should we abstract versionOK in devtools #563

@AtzeDeVries

Description

@AtzeDeVries

Currently versionOK is repeated quite a bit. Reasons for that are

  • There is difference between how to get the current version of a command.
  • There is difference between how to get the required version, sometimes from dockerfile sometimes from a const.
  • The constraintString is not always in the same format

constraintString cloud be abstracted with the this logic

func constraint(constraint string) string {
  // digits should be <= 0. any is a string and can only be any
 // in format of semver
  if string matches "digit|any.digit|any.digit|any {
     split on . 
       if a digit, this is the deviation from the req, any means any diviation
  } 
  else {
    version requirement is passed through. This is useful when having fixed version like terraform >1.3.6 and <1.6.0
 }

}

With then we could make a generic versionOK that requires the current version, required version and version contstraint as input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions