Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue
Closes: #1029
Describe the changes you've made
There are 3 different scenarios where the version should be appeared in CLI output
i) The 3rd scenario is nearly impossible because, when a developer forks keploy repository the release tags aren't pulled into the fork by default. So it is not possible to get the tags/version. I have tried multiple ways like
--Pulling tags through code in main.go and using them but I found that we can't just pull tags but commit will also be pulled with the tags which will mess developer repo.
--Doing a request to keploy repo with each commit in dev repo and seeing if there is a tag associated with it or not . But this is taking lot of time like 4-5 sec which is not preferable for just getting version.
I have referred other project and they were not printing the version in the output but they were printing the major version and a suffix like "dev". So I have also decided to do the same by printing "2-dev" in case of developer running keploy.
ii) Regarding 1st scenario previously version used to be appeared in the release binary but it stopped appearing after adding this line in goreleaser
- -s -w -X main.Dsn={{.Env.SENTRY_DSN_BINARY}}
I have did a bit of research and found out that by default these ldflags will be added
-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser.
So when we add a custom ldflag like SENTRY_DSN_BINARY the default will be erased and only custom will be taken up. Confirmed from go releaser maintainer - goreleaser/goreleaser#4377
So I have added the version ldflag into the custom
iii) For 2nd scenario I have added the version from tag into the docker-publish and into Dockerfile to show the version.
I have also changed how dsn in being populated
Type of change
Please let us know if any test cases are added
Please describe the tests(if any). Provide instructions how its affecting the coverage.
Describe if there is any unusual behaviour of your code(Write
NA
if there isn't)A clear and concise description of it.
Checklist:
Screenshots (if any)
Ignore the values in the version those were test numbers.
Developer:
Binary:
Docker: