mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-08-08 07:55:02 +02:00
support runner.arch (#1290)
* support runner.arch Signed-off-by: Fabian Kammel <[email protected]> * add arch to runner definition Signed-off-by: Fabian Kammel <[email protected]> * get architecture from docker Signed-off-by: Fabian Kammel <[email protected]> * Update pkg/container/docker_run.go Co-authored-by: ChristopherHX <[email protected]> * lint: goimport file Signed-off-by: Fabian Kammel <[email protected]> Co-authored-by: Casey Lee <[email protected]> Co-authored-by: ChristopherHX <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Casey Lee
ChristopherHX
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
8bad6aca50
commit
e1b906813e
@@ -276,6 +276,26 @@ func GetHostInfo(ctx context.Context) (info types.Info, err error) {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
// Arch fetches values from docker info and translates architecture to
|
||||
// GitHub actions compatible runner.arch values
|
||||
// https://github.com/github/docs/blob/main/data/reusables/actions/runner-arch-description.md
|
||||
func RunnerArch(ctx context.Context) string {
|
||||
info, err := GetHostInfo(ctx)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
archMapper := map[string]string{
|
||||
"x86_64": "X64",
|
||||
"386": "x86",
|
||||
"aarch64": "arm64",
|
||||
}
|
||||
if arch, ok := archMapper[info.Architecture]; ok {
|
||||
return arch
|
||||
}
|
||||
return info.Architecture
|
||||
}
|
||||
|
||||
func (cr *containerReference) connect() common.Executor {
|
||||
return func(ctx context.Context) error {
|
||||
if cr.cli != nil {
|
||||
|
||||
Reference in New Issue
Block a user