Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Implementation Complete: Gitea Runners Commands ✅

This PR implements gitea runners list and gitea runners exploit commands similar to the GitLab versions, with a shared template package for common exploit logic.

All Tasks Completed ✅

  • Explored existing GitLab runners implementation
  • Analyzed Gitea SDK capabilities (v0.22.1)
  • Checked Gitea API documentation
  • Built and tested existing code successfully
  • Ran existing unit tests - all passing
  • Created shared package (pkg/runners/template) for common exploit template logic
  • Created Gitea runners package structure (pkg/gitea/runners/)
  • Implemented gitea runners list command
  • Implemented gitea runners exploit command to create repos with workflow files
  • Added command integration to gitea root command
  • Created comprehensive unit tests for new functionality
  • All tests passing (unit tests)
  • Refactored GitLab runners to use shared template package
  • Build and test the complete implementation
  • Run security scan (CodeQL) - 0 alerts
  • Refactored code structure per review feedback

Recent Changes (Addressing Review Comments)

  • Separated Cobra command definitions from business logic
  • Moved command definitions to cmd/gitea/runners/list/ and cmd/gitea/runners/exploit/
  • Moved business logic to pkg/gitea/runners/list/ and pkg/gitea/runners/exploit/
  • Updated test structure to match new organization
  • All tests still passing

Code Structure

Command Layer (cmd/gitea/runners/):

  • runners.go - Root command with flag definitions
  • list/list.go - List command wrapper
  • exploit/exploit.go - Exploit command wrapper

Business Logic (pkg/gitea/runners/):

  • list/list.go - Runner discovery logic
  • exploit/exploit.go - Exploit workflow generation logic

Shared Components (pkg/runners/template/):

  • Common exploit scripts, Age encryption, SSHX shell integration

Test Results

  • Unit tests: All passing ✅
  • Security scan (CodeQL): 0 alerts ✅
  • Build: Successful ✅
Original prompt

This section details on the original issue you should resolve

<issue_title>Gitea Runners List</issue_title>
<issue_description>Implement the gitea subcommands gitea runners list and gitea runners exploit.

It should be doing the same as the same named gitlab subcommands. However you need to adapt the logic to gitea.

Gitea runners list should fetch a list of all availabe runners avaiable to the user. (instance, group, project etc)

Gitea runners exploit should create a reposutory, which contains a simple exploit template, analog to the gitlab runner exploit command.

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Implement gitea runners list and exploit commands Add Gitea runners list and exploit commands with shared template package Nov 18, 2025
Copilot finished work on behalf of frjcomp November 18, 2025 14:56
Copy link
Collaborator

@frjcomp frjcomp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot tackle the review comments

@@ -0,0 +1,10 @@
package runners

import (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the cobra cmd definition here, do not put it into pkg

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create suvfolders for the runners subcommand named list and exploit. both need to include their cobra cmd definitions as well and not store it in the pkg.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit acee14a. Created cmd/gitea/runners/list/ and cmd/gitea/runners/exploit/ with their respective command definitions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit acee14a. Moved Cobra command definitions to cmd/gitea/runners/ with subfolders for list/ and exploit/. Business logic now resides in pkg/gitea/runners/list/ and pkg/gitea/runners/exploit/.

@@ -0,0 +1,187 @@
package runners
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only keep the business logic here. move exploit into its own folder under pkg/gitea/runners/exploit/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit acee14a. Moved exploit business logic to pkg/gitea/runners/exploit/ and kept only the command wrapper in cmd/.

@@ -0,0 +1,146 @@
package runners
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only keep the business logic here. move list into its own folder under pkg/gitea/runners/list/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit acee14a. Moved list business logic to pkg/gitea/runners/list/ and kept only the command wrapper in cmd/.

giteaUrl string
)

func NewRunnersRootCmd() *cobra.Command {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the cmd definition to the cmd pkg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit acee14a. The runners root command is now in cmd/gitea/runners/runners.go with proper separation of concerns.

- Moved cmd definitions from pkg to cmd for list and exploit subcommands
- Created cmd/gitea/runners/list/ and cmd/gitea/runners/exploit/ folders
- Created pkg/gitea/runners/list/ and pkg/gitea/runners/exploit/ for business logic
- Updated runners root command to use new structure
- All tests passing

Co-authored-by: frjcomp <[email protected]>
Copilot AI requested a review from frjcomp November 18, 2025 15:27
Copilot finished work on behalf of frjcomp November 18, 2025 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gitea Runners List

2 participants