Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated stuff for runners #30930

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions routers/api/actions/runner/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (
const (
uuidHeaderKey = "x-runner-uuid"
tokenHeaderKey = "x-runner-token"
// Deprecated: will be removed after Gitea 1.20 released.
versionHeaderKey = "x-runner-version"
)

var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unaryFunc connect.UnaryFunc) connect.UnaryFunc {
Expand All @@ -35,9 +33,6 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
}
uuid := request.Header().Get(uuidHeaderKey)
token := request.Header().Get(tokenHeaderKey)
// TODO: version will be removed from request header after Gitea 1.20 released.
// And Gitea will not try to read version from request header
version := request.Header().Get(versionHeaderKey)

runner, err := actions_model.GetRunnerByUUID(ctx, uuid)
if err != nil {
Expand All @@ -51,14 +46,6 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
}

cols := []string{"last_online"}

// TODO: version will be removed from request header after Gitea 1.20 released.
// And Gitea will not try to read version from request header
version, _ = util.SplitStringAtByteN(version, 64)
if !util.IsEmptyString(version) && runner.Version != version {
runner.Version = version
cols = append(cols, "version")
}
runner.LastOnline = timeutil.TimeStampNow()
if methodName == "UpdateTask" || methodName == "UpdateLog" {
runner.LastActive = timeutil.TimeStampNow()
Expand Down
6 changes: 0 additions & 6 deletions routers/api/actions/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ func (s *Service) Register(
}

labels := req.Msg.Labels
// TODO: agent_labels should be removed from pb after Gitea 1.20 released.
// Old version runner's agent_labels slice is not empty and labels slice is empty.
// And due to compatibility with older versions, it is temporarily marked as Deprecated in pb, so use `//nolint` here.
if len(req.Msg.AgentLabels) > 0 && len(req.Msg.Labels) == 0 { //nolint:staticcheck
labels = req.Msg.AgentLabels //nolint:staticcheck
}

// create new runner
name, _ := util.SplitStringAtByteN(req.Msg.Name, 255)
Expand Down