Skip to content

Provide support for deferred services#49

Merged
dzbarsky merged 8 commits into
hermeticbuild:masterfrom
darkrift:issue38_take2
Nov 26, 2025
Merged

Provide support for deferred services#49
dzbarsky merged 8 commits into
hermeticbuild:masterfrom
darkrift:issue38_take2

Conversation

@darkrift

@darkrift darkrift commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

This allow services to be deferred upon start meaning the runner will not automatically start them. One need to use the svcctl endpoint to start the service.

This provides support to declare services that needs to be delayed for the test environment to be setup first and then started such as cron jobs.

This also adds support to properly pass TMPDIR and SOCKET_DIR as env vars to the test

Comment thread svcctl/svcctl.go Outdated
}

if s.Deferred {
// make sure all the deferred dependencies are started

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this logic is a bit confusing, aren't we skipping the deferred deps on line 83? Taking a step back, should launching a service for all deps (even deferred) to start?

Also, what happens if a non-deferred service depends on a deferred one? Should we make that an analysis time error?

@darkrift darkrift Nov 9, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When you start a deferred service through the http API, the contract is that all deferred services should also be manually started though. The comment is actually the opposite, it should relate to non-deferred services...

And yeah, we should be able to do some checks at analysis time, I'll check that out

Comment thread tests/svcctl/client.go
@@ -0,0 +1,93 @@
package svcctl

import (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we can provide this as an official client package in the main module, its pretty small but nice to have and adds no deps

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The only reason I didn't provide that as an official API, is that it's golang based and very simple. Also most of our integration tests are run from python code so it wasn't even necessary for us.

I don't have any objection though

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok we can just keep it here for now and maybe move as followup

Comment thread tests/svcctl/client.go
httpClient *http.Client
}

func NewSvcctlClient(baseURL string, client *http.Client) *SvcctlClient {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if we make this official API, should we grab the baseURL from the env var by default to make it simpler?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What would you see ? a config object that we would pass to the New client function rather than all the required parameters ?

Then we can populate that object with proper defaults.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yep exactly

@darkrift darkrift force-pushed the issue38_take2 branch 2 times, most recently from ebdb938 to b7183e8 Compare November 11, 2025 13:44
Comment thread private/itest.bzl
RunEnvironmentInfo(environment = _run_environment(ctx, service_specs_file)),
DefaultInfo(runfiles = runfiles),
_ServiceGroupInfo(services = services),
_ServiceGroupInfo(services = services, deferred = False),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think group also needs a deferred prop, otherwise you can have (non-deferred service) depend on (group) depend on (deferred service) and it will defeat the check you added

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same thing with tasks, right? let's just add the attribute on all of them

@dzbarsky dzbarsky merged commit 9a1d30e into hermeticbuild:master Nov 26, 2025
2 checks passed
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.

2 participants