cloudbase / garm

GitHub Actions Runner Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue when calling PUT /api/v1/repositories/{repoID} to update a repository

ionutbalutoiu opened this issue · comments

I just did a fresh deployment with GARM using latest main branch (last commit f12d93f as of today).

And I encountered a bug after calling PUT /api/v1/repositories/{repoID} API endpoint.

The bug reproduction steps are:

  1. Have two valid GitHub tokens configured as credentials in the GARM config file.

    I'll be using ionutbalutoiu and ionutbalutoiu-clone (it's the same GitHub token but under different names).

  2. Start a fresh GARM server.

  3. Do the init step via garm-cli init ... command.

  4. Create a repo via garm-cli repo create ... command. I created mine with ionutbalutoiu credentials first.

    After that, doing garm-cli repo ls, the following is shown:

    +--------------------------------------+---------------+----------------+------------------+------------------+
    | ID                                   | OWNER         | NAME           | CREDENTIALS NAME | POOL MGR RUNNING |
    +--------------------------------------+---------------+----------------+------------------+------------------+
    | e9584f09-4eef-49b4-9871-9d9a3ecb2be6 | test-garm-org | test-garm-repo | ionutbalutoiu    | true             |
    +--------------------------------------+---------------+----------------+------------------+------------------+
    

    Notice POOL MGR RUNNING being true, which is expected.

  5. Call the PUT /api/v1/repositories/{repoID} API endpoint to change the credentials_name field via curl:

    curl -X PUT -H $AUTH_HEADER https://garm.balutoiu.com/api/v1/repositories/${REPO_ID} -d '{"credentials_name": "ionutbalutoiu-clone"}'
    

    After successful response from the GARM API, check garm-cli repo ls output:

    +--------------------------------------+---------------+----------------+---------------------+------------------+
    | ID                                   | OWNER         | NAME           | CREDENTIALS NAME    | POOL MGR RUNNING |
    +--------------------------------------+---------------+----------------+---------------------+------------------+
    | e9584f09-4eef-49b4-9871-9d9a3ecb2be6 | test-garm-org | test-garm-repo | ionutbalutoiu-clone | false            |
    +--------------------------------------+---------------+----------------+---------------------+------------------+
    

    Notice that POOL MGR RUNNING is switched to false, and it stays like this until GARM server is restarted.

From my observation, POOL MGR RUNNING being false doesn't disturb the normal GARM server functionality. I was able to create a pool, runner instances, run workflows and see GARM maintain the idle pool of instances.

But, there are certain aspects in the code that will not work with that flag disabled, for example this:

garm/runner/pool/pool.go

Lines 1402 to 1405 in f12d93f

func (r *basePoolManager) ForceDeleteRunner(runner params.Instance) error {
if !r.managerIsRunning {
return runnerErrors.NewConflictError("pool manager is not running for %s", r.helper.String())
}