Skip to content
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

Validate version consistency #510

Merged
merged 3 commits into from
Jun 16, 2020

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented Jun 15, 2020

Issue: #509

@mtojek mtojek requested a review from ruflin June 15, 2020 13:12
@mtojek mtojek self-assigned this Jun 15, 2020
@elasticmachine
Copy link

elasticmachine commented Jun 15, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #510 updated]

  • Start Time: 2020-06-16T10:07:58.867+0000

  • Duration: 9 min 31 sec

baseDir := filepath.Base(p.BasePath)
versionDir, err := semver.Parse(baseDir)
if err != nil {
return nil // package content is not rooted in version directory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect us to support this long term or only at the moment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I planned to leave it there long term. I put this check just in case.

return p.ValidateDatasets()
}

func (p *Package) validateVersionConsistency() error {
versionPackage, err := semver.Parse(p.Version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use this one here:

versionSemVer semver.Version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I couldn't. The Validate() method is called by Marshal(), so the mentioned field is not filled yet.

@@ -32,10 +32,9 @@ const (
)

var (
packagesBasePath string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we don't use this anymore? My initial intention with this was to be able to pass it as a flag to to the docker container on which directories it should read.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I the next step I have a plan to support multiple sources of packages (exactly for the docker environment). I think we can leave it as is.

@mtojek mtojek requested a review from ruflin June 16, 2020 07:18
Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My usual ask for a changelog ;-)

@mtojek mtojek merged commit 50b8806 into elastic:master Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants