All checks were successful
Release / build (amd64, linux) (push) Successful in 1m15s
CI / build-and-test (push) Successful in 1m7s
Release / build (amd64, windows) (push) Successful in 1m3s
Release / build (amd64, darwin) (push) Successful in 1m8s
Release / build (arm64, darwin) (push) Successful in 46s
Release / build (arm64, linux) (push) Successful in 50s
Release / release (push) Successful in 26s
- Update module path: gitea.com/gitea/act_runner → git.marketally.com/gitcaddy/gitcaddy-runner - Update all import paths across Go source files - Update Makefile LDFLAGS and package references - Update .goreleaser.yaml ldflags and S3 directory path - Add comprehensive README with capacity configuration documentation - Document troubleshooting for capacity feature and Docker detection - Bump version to v1.0.0 for major rebrand - All linting checks passed (fmt-check, go mod tidy, go vet)
70 lines
1.3 KiB
Go
70 lines
1.3 KiB
Go
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"os/signal"
|
|
|
|
"git.marketally.com/gitcaddy/gitcaddy-runner/internal/pkg/config"
|
|
|
|
"github.com/nektos/act/pkg/artifactcache"
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
type cacheServerArgs struct {
|
|
Dir string
|
|
Host string
|
|
Port uint16
|
|
}
|
|
|
|
func runCacheServer(ctx context.Context, configFile *string, cacheArgs *cacheServerArgs) func(cmd *cobra.Command, args []string) error {
|
|
return func(cmd *cobra.Command, args []string) error {
|
|
cfg, err := config.LoadDefault(*configFile)
|
|
if err != nil {
|
|
return fmt.Errorf("invalid configuration: %w", err)
|
|
}
|
|
|
|
initLogging(cfg)
|
|
|
|
var (
|
|
dir = cfg.Cache.Dir
|
|
host = cfg.Cache.Host
|
|
port = cfg.Cache.Port
|
|
)
|
|
|
|
// cacheArgs has higher priority
|
|
if cacheArgs.Dir != "" {
|
|
dir = cacheArgs.Dir
|
|
}
|
|
if cacheArgs.Host != "" {
|
|
host = cacheArgs.Host
|
|
}
|
|
if cacheArgs.Port != 0 {
|
|
port = cacheArgs.Port
|
|
}
|
|
|
|
cacheHandler, err := artifactcache.StartHandler(
|
|
dir,
|
|
host,
|
|
port,
|
|
log.StandardLogger().WithField("module", "cache_request"),
|
|
)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
log.Infof("cache server is listening on %v", cacheHandler.ExternalURL())
|
|
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, os.Interrupt)
|
|
<-c
|
|
|
|
return nil
|
|
}
|
|
}
|