goss icon indicating copy to clipboard operation
goss copied to clipboard

goss doesn't support semantic versioning for custom rpms

Open thatsk opened this issue 7 years ago • 5 comments

Hi, Its nice to use your tool. But there is an bug i have found it doesn't support custom versioing of rpms lets take an example Here is my goss.yaml {code} package: custom-service: installed: true versions: - "5.37.0-201709220549.68d18f9" service: custom-service: enabled: true running: true {code} when I try to validate it fails ...F

Failures/Skipped:

Package: custom-service: version: Expected <[]string | len:1, cap:1>: ["5.37.0"] to contain element matching : 5.37.0-201709220549.68d18f9

Total Duration: 0.044s Count: 4, Failed: 1, Skipped: 0

thatsk avatar Mar 20 '18 22:03 thatsk

need to add here in System->package_rpm.go p.loaded = true cmd := util.NewCommand("rpm", "-q", "--nosignature", "--nohdrchk", "--nodigest", "--qf", "%{VERSION}\n", p.name) if err := cmd.Run(); err != nil { return } p.installed = true p.versions = strings.Split(strings.TrimSpace(cmd.Stdout.String()), "\n")

thatsk avatar Mar 20 '18 22:03 thatsk

Currently for RPM goss only checks the Version, not the Release.

$ rpm -q kernel-4.15.15-300.fc27.x86_64 --qf '%{Version}\n'
4.15.15
$ rpm -q kernel-4.15.15-300.fc27.x86_64 --qf '%{Release}\n'
300.fc27

Need to come up with a good syntax to support Release without breaking backwards compatibility, or rip the bandage off and make a breaking change to change rpm version to %{Version}-%{Release} and cut a major goss release.

Another approach would be to make the matcher special and make it work with both: 4.15.15 and 4.15.15-300.fc27

aelsabbahy avatar May 20 '18 18:05 aelsabbahy

When i am cheking on puppet side. its looks its using different syntax which is matching for all type of rpm. /bin/rpm -q rpmname --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'

thatsk avatar Apr 24 '19 07:04 thatsk

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 09 '20 19:07 stale[bot]

Epoch (optionally) and release will be in v0.4.0

This would be a breaking change, so waiting on v0.4.0

aelsabbahy avatar Jul 09 '20 20:07 aelsabbahy