- 
                Notifications
    You must be signed in to change notification settings 
- Fork 127
internal/version: make version available when installed via go install github.com/elastic/elastic-package #648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 💚 Build Succeeded
 Expand to view the summary
 Build stats
 Test stats 🧪
 🤖 GitHub commentsTo re-run your PR in the CI, just comment with: 
 | 
| Failure looks to be unrelated. | 
| /test | 
| /test | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @efd6! thanks for the PR. Regarding failing tests, please merge the latest mainline as we pushed a fix there.
Could you please add to the PR description the sample output of the version command?
…l github.com/elastic/elastic-package This makes to output of elastic-package version informative when the go.mod-based install within integrations is used.
| The output of the version command will remain the same as previously when the Tag is set using -ldflags=-X. I can't demonstrate until there is a merged commit with this code in, but I will construct a hand drawn facsimile. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit concerned about the profiles logic, but in the worst case, we can revert this change.
If the CI is happy, I'm fine too.
| @mtojek With this change in and installing this particular commit I get this: If it's installed with a tagged version the pseudoversion suffix will be absent. What are your concerns about the profiles logic? | 
| @efd6 I'm curious what would be the content of the  
 In my case it's now: {
  "name": "default",
  "date_created": "2022-01-11T16:50:19.230744+01:00",
  "user": "marcin.tojek",
  "version": "30faef5",
  "path": "/Users/marcin.tojek/.elastic-package/profiles/default"
}version contains a hash. 
 It still looks strange, so maybe we should fully switch to the  | 
| In the case with the install I just did, I see Using only the embedded version information should be fine, in fact the hash gives no ordering to versions as is noted in output when there is no version in the current code. The work that's needed is much less than is done in  | 
| If there is a way to modify the code to properly return  | 
This makes to output of elastic-package version informative when the go.mod-based install within integrations is used. It does not prevent the "CommitHash is undefined" warning since that is based on build-time var substitution. The logic required to properly handle update detection is reasonably involved, so I have not added this (see here for the general case — not all of that would be required here).
The output of
elastic-package versionwhen it has been installed usinggo install github.com/elastic/elastic-package@latestor bygo install github.com/elastic/elastic-packagefrom within a module with it written as a require would look something like thisPlease take a look.