-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: add release markers #170
Conversation
b49b8d7
to
944b7c9
Compare
SchemaURL string | ||
Schema string |
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.
Added to the config so we can show this information in the release markersr.
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.
Since they were already provided in the action, no change is needed in the inputs, right?
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.
Right. They were used only to process them, download, and get the local path of the schema.
944b7c9
to
5e86214
Compare
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.
Thanks for addressing this! It will definitely help troubleshooting 🎉
I've left some comments for us to discuss 🙂
I think we should add some docs regarding the markers somewhere, could we use the README?
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 wonder if we should re-try por particular errors. Eg: error reading the markers.
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 would leave it as an improvement in a separate PR. WDYT?
objOutput, err := s.client.GetObject(&s3.GetObjectInput{ | ||
Bucket: aws.String(s.conf.Bucket), | ||
Key: aws.String(s.markerPath()), | ||
}) | ||
if err != nil { | ||
return nil, fmt.Errorf("cannot read marker file: %w", err) | ||
} |
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 the markers file supposed to exist or will the action create it the first 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.
It will be created if it doesn't exist https://github.com/newrelic/infrastructure-publish-action/pull/170/files#diff-746e45e2647cf17fb02b10957238994fabb26c6025dcb63eec2a0e14e7a55094R89
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 totally missed that!
if err != nil {
if !isNoSuchKeyError(err) {
return Mark{}, err
}
Shall we add a comment there to make more obvious?
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.
👍 Added in 27048d7
e865340
to
e2ac976
Compare
e2ac976
to
1b5c84e
Compare
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.
LGTM
Although I'd love to have another pair of eyes here 👀
By the way, how are we enforcing its usage?
🤔 If anybody is using v1.X.Y
(lower than latest or a commit) the release info will not appear in the file.
return ErrLastMarkerEnded | ||
} | ||
|
||
if lastMarker.AppName != mark.AppName || !lastMarker.Start.Equals(mark.Start) { |
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.
Are packages uploaded 1 by 1 always? What if multiple teams try to release at the same time? This tool doesn't allow for it. Should this be allowed in the future?
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.
There is a locking mechanism to prevent multiple actions running at the same time within the same S3 Bucket.
https://github.com/newrelic/infrastructure-publish-action/blob/main/publisher/lock/lock.go
|
ReleaseInfo: ReleaseInfo{ | ||
AppName: "my-app", | ||
Tag: "v1.2", | ||
RunID: "run3", | ||
RepoName: "repo3", | ||
Schema: "schema3", | ||
SchemaURL: "url3", | ||
}, |
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.
(future) I see a lot of repetitions between tests. Maybe we could benefit from having some "basis" variables to reuse on the tests. Maybe is a terrible idea.
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.
It is a good idea :) . We could use stubs with https://github.com/brianvoe/gofakeit for example
This PR will add release information to a file in the bucket where the package is being released.
After the lock is executed, an entry with start time will be appended to
repo_path_root_dir/releases.json
.Just before the lock is released the entry will be loaded, end time will be set, and file will be persisted.
Example of data persisted:
Caveats: One release can call multiple times to the publish action. For example, the Infra Agent calls it once per package type (deb, rpm, tar.gz...). So multiple entries will be present for a release.
Ideally we would have just one, but then we need to move the responsibility to the user of the action.
This can be the first approach and we can discuss improvements.