Skip to content

Allow reusing runner scale set if it exists#65

Merged
ispasov merged 2 commits into
mainfrom
is/reuse-scaleset
May 28, 2026
Merged

Allow reusing runner scale set if it exists#65
ispasov merged 2 commits into
mainfrom
is/reuse-scaleset

Conversation

@ispasov

@ispasov ispasov commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Allow reusing runner scale set if it exists
  • Add MANAGE_RUNNER_SCALE_SETS environment variable to control whether to manage runner scale sets

    If set to true, deletes any existing runner scale set with the same name on startup and deletes the scale set on exit (the old behavior).
    If set to false, reuses an existing scale set if found and skips deletion on exit.

  • Fix message session closing
    The message session was never closed and it was impossible to reuse the scaleset

  • Delete the scaleset if the active session is stale
    In case the session was no properly closed, the scaleset needs to be deleted and a new one created

Testing

Old Behavior

  1. Set MANAGE_RUNNER_SCALE_SETS to true
  2. Start the runner
  3. Stop the runner
  4. The scaleset should be deleted in GitHub

New Behavior

  1. Start the runner
  2. Run a job
  3. Wait for it to complete
  4. Stop the runner
  5. The scaleset should be present in GitHub
  6. Start the runner
  7. The scaleset should be reused (you can tell by the logs)
  8. Run a new job
  9. Should complete

Fallback

  1. Start the runner
  2. Kill the process (kill -9 pid)
  3. Start the runner again
  4. The scaleset should be recreated
  5. Start a job
  6. Should be picked up

- Add `MANAGE_RUNNER_SCALE_SETS` environment variable to control whether to manage runner scale sets

    If set to true, deletes any existing runner scale set with the same name on startup and deletes the scale set on exit (the old behavior).
    If set to false, reuses an existing scale set if found and skips deletion on exit.

- Fix message session closing
    The message session was never closed and it was impossible to reuse the scaleset

- Delete the scaleset if the active session is stale
    In case the session was no properly closed, the scaleset needs to be deleted and a new one created
@ispasov ispasov requested a review from a team as a code owner May 27, 2026 13:08
Comment thread pkg/http/logger.go
}

func (l *LeveledLogger) Error(msg string, keysAndValues ...interface{}) {
for i := 1; i < len(keysAndValues); i += 2 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is kind of confusing, and it might be nice to have a comment that we're iterating through until we find the error we want to get more info on.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I have added an explanation. Let me know what you think

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good -- thanks!

@ispasov ispasov merged commit e42535d into main May 28, 2026
2 checks passed
@ispasov ispasov deleted the is/reuse-scaleset branch May 28, 2026 05:21
Rich7690 pushed a commit to Rich7690/orka-github-actions-integration that referenced this pull request May 28, 2026
* Allow reusing runner scale set if it exists

- Add `MANAGE_RUNNER_SCALE_SETS` environment variable to control whether to manage runner scale sets

    If set to true, deletes any existing runner scale set with the same name on startup and deletes the scale set on exit (the old behavior).
    If set to false, reuses an existing scale set if found and skips deletion on exit.

- Fix message session closing
    The message session was never closed and it was impossible to reuse the scaleset

- Delete the scaleset if the active session is stale
    In case the session was no properly closed, the scaleset needs to be deleted and a new one created

* Explain the logging change
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