cloudbase / garm

GitHub Actions Runner Manager
Apache License 2.0
136 stars 26 forks source link

Error with the [[github.com]] section in garm@0.1.4 #271

Closed tannevaled closed 5 months ago

tannevaled commented 5 months ago

Hi.

I try garm with the last (tagged) one i packaged in pkgx. I have an error with the way the github credential is defined in the config file. Have i missed something in the 0.1.4 documentation? Is the 0.1.5 tagging already scheduled?

ubuntu@github-actions-runner-manager:/home/ubuntu$ sudo cat /etc/systemd/system/garm.service.d/local.conf 
[Service]
Environment="GARM_VERSION=0.1.4"
Environment="GARM_CONFIG_PATH=/etc/garm/config.toml"
ubuntu@github-actions-runner-manager:/home/ubuntu$ sudo cat /etc/systemd/system/garm.service
[Unit]
Description=GitHub Actions Runner Manager (garm)
After=multi-user.target

[Service]
Type=simple
User=_garm
Group=_garm
ExecStart=/usr/local/bin/pkgx +garm^${GARM_VERSION} garm -config ${GARM_CONFIG_PATH}
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target
ubuntu@github-actions-runner-manager:/home/ubuntu$ sudo systemctl status garm
● garm.service - GitHub Actions Runner Manager (garm)
     Loaded: loaded (/etc/systemd/system/garm.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/garm.service.d
             └─local.conf
     Active: activating (auto-restart) (Result: exit-code) since Tue 2024-06-25 11:00:16 UTC; 780ms ago
    Process: 235534 ExecStart=/usr/local/bin/pkgx +garm^${GARM_VERSION} garm -config ${GARM_CONFIG_PATH} (code=exited, status=1/FAILURE)
   Main PID: 235534 (code=exited, status=1/FAILURE)
        CPU: 1.898s
ubuntu@github-actions-runner-manager:/home/ubuntu$ sudo journalctl -xeu garm | grep "Jun 25 13:03:18 github-actions-runner-manager pkgx" 
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]: 2024/06/25 13:03:18 Fetching config: toml: (last key "github"): incompatible types: TOML value has type map[string]interface {}; destination has type slice
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]: decoding toml
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]: github.com/cloudbase/garm/config.NewConfig
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]:         /__w/pantry/pantry/builds/github.com__cloudbase__garm-0.1.4/config/config.go:71
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]: main.main
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]:         /__w/pantry/pantry/builds/github.com__cloudbase__garm-0.1.4/cmd/garm/main.go:154
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]: runtime.main
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]:         /opt/go.dev/v1.22.4/src/runtime/proc.go:271
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]: runtime.goexit
Jun 25 13:03:18 github-actions-runner-manager pkgx[235937]:         /opt/go.dev/v1.22.4/src/runtime/asm_amd64.s:1695
ubuntu@github-actions-runner-manager:/home/ubuntu$ sudo cat /etc/garm/config.toml
...
# This is a list of credentials that you can define as part of the repository
# or organization definitions. They are not saved inside the database, as there
# is no Vault integration (yet). This will change in the future.
# Credentials defined here can be listed using the API. Obviously, only the name
# and descriptions are returned.
[[github.com]]
  name = "test_repo"
  description = "test_repo PAT"
  # This is a personal token with access to the repositories and organizations
  # you plan on adding to garm. The "workflow" option needs to be selected in order
  # to work with repositories, and the admin:org needs to be set if you plan on
  # adding an organization.
  oauth2_token = "ghp_XXX"
gabriel-samfira commented 5 months ago

Hi @tannevaled

You have to remove the dot. In toml, it's a marker for a subsection. Try to use just github instead of github.com.

tannevaled commented 5 months ago

hum ok, and there is none in the documentation. i do not know from where i take this. big thanks @gabriel-samfira

gabriel-samfira commented 5 months ago

Anytime! Closing this for now, feel free to re-open if needed.