fix(ci): route runs-on: deploy jobs through Spot, not the deleted executor
The dispatcher routed `deploy`-labelled jobs (deploy-arikigame, release) to invokeLambdaExec → the tinqs-ci-exec Lambda. That Lambda was deleted on 26 May 2026, and EXECUTOR_FUNCTION_NAME was never set, so every deploy job silently hit the `[DRY RUN] Would invoke executor` no-op and never ran. DEVOPS.md already states "deploy jobs go through Spot now" — the code just never followed. Drop the dead `case "deploy"` so `deploy` falls through to the default Spot path (labelToSpot already maps deploy → t3.micro). Remove the now-unused invokeLambdaExec, ExecFnName, and awslambda import. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
/bootstrap
|
||||||
|
/function.zip
|
||||||
|
/dispatch.exe
|
||||||
@@ -31,7 +31,6 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
|
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
|
||||||
"github.com/aws/aws-sdk-go-v2/service/ec2"
|
"github.com/aws/aws-sdk-go-v2/service/ec2"
|
||||||
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||||
awslambda "github.com/aws/aws-sdk-go-v2/service/lambda"
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -113,7 +112,6 @@ type cfg struct {
|
|||||||
GiteaURL string
|
GiteaURL string
|
||||||
GiteaToken string // API token (for fetching workflows, setting commit status)
|
GiteaToken string // API token (for fetching workflows, setting commit status)
|
||||||
RunnerToken string // Runner registration token (for act_runner register)
|
RunnerToken string // Runner registration token (for act_runner register)
|
||||||
ExecFnName string
|
|
||||||
AMI string // pre-baked AMI with Go, Node, Docker, AWS CLI, act_runner
|
AMI string // pre-baked AMI with Go, Node, Docker, AWS CLI, act_runner
|
||||||
Subnet string
|
Subnet string
|
||||||
SecurityGroup string
|
SecurityGroup string
|
||||||
@@ -126,7 +124,6 @@ func loadCfg() cfg {
|
|||||||
GiteaURL: os.Getenv("GITEA_URL"),
|
GiteaURL: os.Getenv("GITEA_URL"),
|
||||||
GiteaToken: os.Getenv("GITEA_TOKEN"),
|
GiteaToken: os.Getenv("GITEA_TOKEN"),
|
||||||
RunnerToken: os.Getenv("RUNNER_TOKEN"),
|
RunnerToken: os.Getenv("RUNNER_TOKEN"),
|
||||||
ExecFnName: os.Getenv("EXECUTOR_FUNCTION_NAME"),
|
|
||||||
AMI: os.Getenv("RUNNER_AMI"),
|
AMI: os.Getenv("RUNNER_AMI"),
|
||||||
Subnet: os.Getenv("SUBNET"),
|
Subnet: os.Getenv("SUBNET"),
|
||||||
SecurityGroup: os.Getenv("SECURITY_GROUP"),
|
SecurityGroup: os.Getenv("SECURITY_GROUP"),
|
||||||
@@ -266,15 +263,14 @@ func handler(ctx context.Context, request events.APIGatewayProxyRequest) (events
|
|||||||
runID := fmt.Sprintf("%s-%s-%d", push.After[:7], name, time.Now().UnixMilli())
|
runID := fmt.Sprintf("%s-%s-%d", push.After[:7], name, time.Now().UnixMilli())
|
||||||
|
|
||||||
switch label {
|
switch label {
|
||||||
case "deploy":
|
|
||||||
if err := invokeLambdaExec(ctx, c, push, name, content); err != nil {
|
|
||||||
log.Printf("Failed to invoke executor for %s: %v", name, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
case "host":
|
case "host":
|
||||||
log.Printf("Skipping %s (runs-on: host — registered runner)", name)
|
log.Printf("Skipping %s (runs-on: host — registered runner)", name)
|
||||||
continue
|
continue
|
||||||
default:
|
default:
|
||||||
|
// All non-host jobs (go/node/docker/deploy/godot) go through Spot.
|
||||||
|
// The old `deploy` → Lambda-executor path was retired when
|
||||||
|
// tinqs-ci-exec was deleted (26 May 2026); deploy now launches
|
||||||
|
// a t3.micro Spot runner labelled `deploy` like any other job.
|
||||||
instanceID, err := startSpotRunner(ctx, c, label, runID)
|
instanceID, err := startSpotRunner(ctx, c, label, runID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to start spot for %s: %v", name, err)
|
log.Printf("Failed to start spot for %s: %v", name, err)
|
||||||
@@ -385,39 +381,6 @@ func startSpotRunner(ctx context.Context, c cfg, label, runID string) (string, e
|
|||||||
return instanceID, nil
|
return instanceID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Lambda executor (for deploy-only jobs) ---
|
|
||||||
|
|
||||||
func invokeLambdaExec(ctx context.Context, c cfg, push GiteaPushEvent, workflow, content string) error {
|
|
||||||
if c.ExecFnName == "" {
|
|
||||||
log.Printf("[DRY RUN] Would invoke executor for %s", workflow)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
awsCfg, err := config.LoadDefaultConfig(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
payload, _ := json.Marshal(map[string]interface{}{
|
|
||||||
"repo": push.Repository,
|
|
||||||
"ref": push.Ref,
|
|
||||||
"commit_sha": push.After,
|
|
||||||
"pusher": push.Pusher.Login,
|
|
||||||
"workflow_name": workflow,
|
|
||||||
"workflow_yaml": content,
|
|
||||||
"gitea_url": c.GiteaURL,
|
|
||||||
"gitea_token": c.GiteaToken,
|
|
||||||
})
|
|
||||||
|
|
||||||
client := awslambda.NewFromConfig(awsCfg)
|
|
||||||
_, err = client.Invoke(ctx, &awslambda.InvokeInput{
|
|
||||||
FunctionName: aws.String(c.ExecFnName),
|
|
||||||
InvocationType: "Event",
|
|
||||||
Payload: payload,
|
|
||||||
})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Cancel handler ---
|
// --- Cancel handler ---
|
||||||
|
|
||||||
func handleCancel(ctx context.Context, c cfg, body string) (events.APIGatewayProxyResponse, error) {
|
func handleCancel(ctx context.Context, c cfg, body string) (events.APIGatewayProxyResponse, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user