-
Notifications
You must be signed in to change notification settings - Fork 120
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
Add SkipInitialHealthCheck flag to MachineBasedResource #850
Conversation
@@ -51,5 +50,8 @@ public abstract class MachineBasedResource : Resource, INamedResource, IHaveSlug | |||
public string Architecture { get; set; } | |||
|
|||
public string Slug { get; set; } | |||
|
|||
[Writeable] | |||
public bool SkipInitialHealthCheck { get; set; } |
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.
The only way I could get this information through the Client is by adding it to the MachineBasedResource. I don't love this but I also feel like the benefits outweigh the drawbacks in this case. Most people won't even care about this property.
I did consider adding a code comment above it to explain that it's only used when creating a new Machine (Deployment Target or Worker).
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.
@APErebus I'm interested in your opinion on this.
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.
Do workers also have this initial health-check?
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 believe they do, Although your comment made me realise I forgot to update the CreateWorkerCommandHandler
in server.
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've updated the Server codebase to also pass this flag down when a worker is created.
It's interesting that the same test doesn't fail very often (it has failed the same way once) when it uses a worker instead of a deployment target. I believe this is because there is a second level of indirection with the event that causes a health check after creating a worker.
When you create a worker a MachineCreatedDomainEvent
is created which is handled in MachineCreatedDomainEventMapper
. This mapper returns a MachineCreatedEventV2
which is the same event directly raised when creating a deployment target.
Background
There are a few tests in Server which use Octopus.Server.Client to create machines but they don't want background processes like HealthChecks to run. Adding this property allows us to skip the initial health check when adding a machine to make testing easier, more stable and decrease the load on the server running in the test.
Results
In the Client all we have to do is add the additional property. The server PR (https://github.com/OctopusDeploy/OctopusDeploy/pull/24785) will handle this flag and ensure an initial health check isn't executed if the flag is true.