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

fix(events): app run event wording #362

Merged
merged 21 commits into from
Sep 21, 2023
Merged

Conversation

EtienneM
Copy link
Member

@EtienneM EtienneM commented Sep 18, 2023

I also took the opportunity to fix all linter offenses.

Fix #326

@EtienneM EtienneM self-assigned this Sep 18, 2023
@EtienneM EtienneM force-pushed the fix/326/app_run_event_wording branch 2 times, most recently from 9734756 to b12bddb Compare September 18, 2023 15:12
@EtienneM EtienneM marked this pull request as ready for review September 19, 2023 05:19
Comment on lines 45 to 47
if ev.User.Email == "deploy@scalingo.com" {
return "Scalingo Operator"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@Soulou I updated the Who method to match what is asked in the related issue. But not that it also impacts other event types. For instance in case of a crash or an alert. Is it OK for you?

Copy link
Member

Choose a reason for hiding this comment

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

Could we keep something more generic like Scalingo Platform? (It seems to me it's already what is in the event no?)

It's weird to say an operator crashes a container

Copy link
Member Author

@EtienneM EtienneM Sep 20, 2023

Choose a reason for hiding this comment

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

The current output is <scalingo-platform (deploy@scalingo.com)>, with this change it would be <Scalingo Operator>. I wanted to follow what is asked on the related issu but I agree that this feels a bit odd. Or maybe I could try to modify it only for the run event?

Copy link
Member

Choose a reason for hiding this comment

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

For the run event I agree, for these rest it's misleading..

Copy link
Member Author

Choose a reason for hiding this comment

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

OK that's what is included in the commit 4782dab

return fmt.Sprintf("%s (%s)", ev.User.Username, ev.User.Email)
}

func (ev *Event) PrintableType() string {
return strings.Title(strings.Replace(string(ev.Type), "_", " ", -1))
return cases.Title(language.English).String(strings.Replace(string(ev.Type), "_", " ", -1))
Copy link
Member Author

Choose a reason for hiding this comment

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

strings.Title is deprecated, hence this change.

@EtienneM EtienneM force-pushed the fix/326/app_run_event_wording branch 6 times, most recently from de589f1 to 30461a8 Compare September 19, 2023 06:27
return fmt.Sprintf("%sone-off container with command '%s'", detached, ev.TypeData.Command)
}

func (ev *EventRunType) isEventRunFromOperator() bool {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it more if the comande is run by the generic user?

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean by "generic user"?

@EtienneM
Copy link
Member Author

With commit 4782dab, only the run event has a custom user name. So the output is:

* Mon Sep 18 2023 15:06:42 - Run        - one-off container for maintenance/support purposes <Scalingo Operator>
* Mon Sep 18 2023 15:05:07 - Deployment - deployment of 949de4437933f3ceca7f7e51a98e2af7652a8dde (success) <scalingo-platform (deploy@scalingo.com)>

We can see Scalingo Operator for a run event by a Scalingo operator, and still the same output for another scalingo-deploy event.

@EtienneM EtienneM requested review from Soulou and curzolapierre and removed request for yohann-bacha September 20, 2023 10:59
Soulou
Soulou previously approved these changes Sep 20, 2023
@EtienneM
Copy link
Member Author

@curzolapierre I let you assigned as reviewer. I wanted Soulou's thoughts about the wording but I want your review on the code part :)

curzolapierre
curzolapierre previously approved these changes Sep 21, 2023
Copy link
Member

@curzolapierre curzolapierre left a comment

Choose a reason for hiding this comment

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

Thanks for the cleaning 👍
Just a typo but otherwise LGTM

@@ -48,6 +48,22 @@ var eventsSpecializeCases = map[string]struct {
DetailedEventName: "*scalingo.EventEditAppType",
DetailedEventString: "application settings have been updated, Force HTTPS has been disabled",
},
"test app run event for a command run by an opeator": {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"test app run event for a command run by an opeator": {
"test app run event for a command run by an operator": {

@EtienneM
Copy link
Member Author

Sorry @curzolapierre, pushing your suggestion dismissed your review..

@EtienneM EtienneM merged commit 93a0453 into master Sep 21, 2023
1 check passed
@EtienneM EtienneM deleted the fix/326/app_run_event_wording branch September 21, 2023 12:26
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.

App run event wording is wrongly formatted
3 participants