Closed dominikborkowski closed 2 years ago
$ curl -OL https://github.com/aelsabbahy/goss/releases/download/v0.3.16/goss-linux-amd64
$ chmod a+x goss*
$ ./goss-linux-amd64 --version
goss version v0.3.16
$ curl -OL https://github.com/aelsabbahy/goss/releases/download/v0.3.18/goss-linux-amd64
$ chmod a+x goss*
$ ./goss-linux-amd64 --version
goss version v0.3.18
Still seems good to me, can you tell us what OS/architecture?
Ahh, that's interesting, thank you for verifying it. This must be an issue with how I build goss in docker, and the results are a bit baffling:
Relevant part of the Dockerfile
:
# Build goss and packer-provisioner-goss with musl
FROM golang:1.17-alpine3.14 as build_musl_bins
ARG PACKER_PROVISIONER_GOSS_VER=3
ARG GOSS_VER=0.3.16
ENV GO111MODULE=on
RUN apk --no-cache --upgrade --virtual=build_environment add binutils git && \
go install github.com/YaleUniversity/packer-provisioner-goss/v${PACKER_PROVISIONER_GOSS_VER}@latest && \
go install github.com/aelsabbahy/goss/cmd/goss@v${GOSS_VER} && \
strip $GOPATH/bin/* && \
go clean -cache -modcache && \
apk --no-cache del build_environment
Here are the results:
$ docker run -it dominikborkowski/packer-aws-runner:1.8.0 /bin/goss --version
goss version
$ docker run -it dominikborkowski/packer-aws-runner:1.8.2 /bin/goss --version
Incorrect Usage. flag provided but not defined: -version
NAME:
goss - Quick and Easy server validation
USAGE:
goss [global options] command [command options] [arguments...]
COMMANDS:
validate, v Validate system
serve, s Serve a health endpoint
render, r render gossfile after imports
autoadd, aa automatically add all matching resource to the test suite
add, a add a resource to the test suite
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--gossfile value, -g value Goss file to read from / write to (default: "./goss.yaml") [$GOSS_FILE]
--vars value json/yaml file containing variables for template [$GOSS_VARS]
--vars-inline value json/yaml string containing variables for template (overwrites vars) [$GOSS_VARS_INLINE]
--package value Package type to use [apk, dpkg, pacman, rpm]
--help, -h show help
2022/07/14 17:28:55 flag provided but not defined: -version
It's interesting that this is the only feature that's affected, the rest of goss seems to work just fine.
This is how Goss is built in CI:
That said, only the documented install methods/release binaries are supported.
Considering the issue affects only the binaries I build with alpine (full Dockerfile is at https://github.com/dominikborkowski/packer-aws-runner/blob/master/Dockerfile), I'd say the issue can be closed, sorry for a false alarm. I would have never suspected different behavior when it comes to argument parsing, so I didn't even consider checking the official binaries.
That said, only the documented install methods/release binaries are supported.
Thank you for the reply! Unfortunately, there are no pre-built binaries for all of the platforms I need, that's why I'm resorting to building them myself. I'm not familiar enough with go, but I'll see if there is a way to add that main.version
flag in the build process I currently use.
Cheers!
As per the bit of code shown by @aelsabbahy you need to add -ldflags "-X main.version=${version_stamp} -s -w"
to your go build
where $version_stamp
holds the version to set.
Thank you, looks like these flags are accepted by go install
as well, which makes this a trivial fix.
Cheers!
Hello,
Just had a chance to upgrade to version 0.3.18 from 0.3.16, and saw that my CICD broke. As part of the linting stage I was executing various required components with a simple
--version
flag, to see if they exist and if they execute.Can that be added back, please? Perhaps it can print actual version number, so it will be easier to identify which release is present?
Thank you!