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

Feature: Ephemeral action runners #33570

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

ChristopherHX
Copy link
Contributor

@ChristopherHX ChristopherHX commented Feb 12, 2025

Closes #32461

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 12, 2025
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 12, 2025
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code modifies/migrations modifies/dependencies labels Feb 12, 2025
@ChristopherHX
Copy link
Contributor Author

ChristopherHX commented Feb 25, 2025

Possible needs investigation, once gitea has returned a job to act_runner and it starts executing this door is closed
Concurrently requesting jobs from an act_runner (which a regular act_runner would never do)
However it could fail as well and return "no job available" like described in https://github.com/go-gitea/gitea/issues/33492

@ChristopherHX ChristopherHX marked this pull request as ready for review February 25, 2025 12:15
const deleteEphemeralRunnerBatchSize = 100

// CleanupEphemeralRunners removes used ephemeral runners which are no longer able to process jobs
func CleanupEphemeralRunners(ctx context.Context) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also think about to remove offline EphemeralRunners here that didn't connect within 24h as auto cleanup.

We currently cannot remove runners via api.

Ephemeral bool `xorm:"ephemeral"`
}

return x.Sync(new(ActionRunner))
Copy link
Member

Choose a reason for hiding this comment

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

It's better to update the legacy data as false rather than null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if you mean something like that

Suggested change
return x.Sync(new(ActionRunner))
if err := x.Sync(new(ActionRunner)); err != nil {
return err
}
// update all records to set ephemeral to false
_, err := x.Exec("UPDATE `action_runner` SET `ephemeral` = false WHERE `ephemeral` IS NULL")
return err

Or adding a xorm tag like this for both migration and model (I'm not 100% sure, no examples in Gitea has both name and the not null sequence)

Ephemeral bool `xorm:"ephemeral NOT NULL DEFAULT false"`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code modifies/migrations size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Register act_runner as ephemeral to Gitea
3 participants