-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Migrate from go-bindata to vfsgen #1532
Conversation
Ok so |
To be exhaustive, the CI fails also because just like go-bindata, vfsgen doesn't preserve timestamps (see shurcooL/vfsgen#26). I'm testing some ideas on how we could preserve timestamps since this is hitting us for the other Prometheus projects. |
e649ca5
to
3a5714a
Compare
@simonpasquier let us know once this is ready for a review. |
3a5714a
to
b2e2bb1
Compare
b2e2bb1
to
c777f33
Compare
Now that the flakes are "fixed", this is ready for review though it deserves a bit of explanation. To circumvent the problem that the file generation wasn't idempotent, I've implemented the As we have the same issue with idempotency for the other Prometheus projects, it would make sense to put this code in the common repository but maybe it should be tried here for a bit of time? |
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.
Appreciate the profound work here. Especially vendoring all dependencies, only requiring go generate
.
I am still a bit scared of the introduced complexity to enforce idempotency for timestamps, with previously simply setting all timestamps to 1
.
Running this locally works fine except this small formatting issue:
diff --git a/asset/assets_vfsdata.go b/asset/assets_vfsdata.go
index ad00a03..fc6f1cf 100644
--- a/asset/assets_vfsdata.go
+++ b/asset/assets_vfsdata.go
@@ -214,7 +214,7 @@ func (fs vfsgen۰FS) Open(path string) (http.File, error) {
}
return &vfsgen۰CompressedFile{
vfsgen۰CompressedFileInfo: f,
- gr: gr,
+ gr: gr,
}, nil
case *vfsgen۰FileInfo:
return &vfsgen۰File{
But that just might be my setup (CI runs green) with Go 1.11.
asset/assets_ident.go
Outdated
@@ -0,0 +1,163 @@ | |||
// Code generated by idemvfsgen; DO NOT EDIT. |
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.
Is this the metadata file you referenced in https://github.com/prometheus/alertmanager/pull/1532/#issuecomment-420321115
?
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.
yes
I've encountered this in a couple PRs -- gobindata is formatted differently between 1.10 and 1.11 :/ |
Signed-off-by: Simon Pasquier <[email protected]>
Signed-off-by: Simon Pasquier <[email protected]>
Signed-off-by: Simon Pasquier <[email protected]>
Signed-off-by: Simon Pasquier <[email protected]>
f402eaf
to
2861843
Compare
Signed-off-by: Simon Pasquier <[email protected]>
This is identical to what we had with go-bindata and avoids the extra step of storing the identity of the complete file system in another location. Signed-off-by: Simon Pasquier <[email protected]>
Signed-off-by: Simon Pasquier <[email protected]>
@mxinden @stuartnelson3 for simplicity, I've implemented something similar to what we had with |
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.
Looks good to me. Thanks for the simplification. If there are no further comments by @stuartnelson3 I will merge tomorrow.
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.
sounds good, thanks for this!
Closes #1487
Regarding whether to commit the generated files or not, the outcome from prometheus/prometheus#4430 (comment) was to commit so
go get ...
would work. But this isn't enough for AlertManager since the Javascript code (eg/ui/app/script.js
) is also generated but not committed.