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

agent: implements logic to register agents and scan images and upload reports #90

Merged
merged 19 commits into from
Jan 3, 2025

Conversation

ashwiniag
Copy link
Member

@ashwiniag ashwiniag commented Jan 1, 2025

closes
#91

Introduces

./gokakashi agent start --server=http://localhost:8000 --token=letsdoit --workspace=/tmp
  • adds agent task execution logic.

Abstract Task Execution Flow #77

  1. start an agent via cmd
  2. make an API call to agent table and register the agent with agent.status = connected
  3. start polling for the tasks from agentTasks table where agenttasks.Status = pending and from the order returned in asc of agenttasks.Created_at
    1. picks a task from list
    2. updates the agenttasks.Status = in_progress
    3. fetchScan details using scanID
    4. fetchIntegration details
    5. authenticateAndPullImage
    6. update scan.status = scan_in_progress
    7. perform scan of image with provided scan.scanner
      1. if fails update scan.Status = error
    8. upload report to scan.Report and set scan.Status = complete
      1. if fails update scan.Status = error
    9. updates the agenttasks.Status = complete
  4. Continue to next tasks
    No pending tasks. Retrying after 10 seconds

@ashwiniag ashwiniag changed the base branch from main to ag-server-enhancement January 1, 2025 09:13
* updates the get call of scan to query by status

* updates the GET call of agents to query by status

* updates the GET call of agents to query by status or scan_id

* adds task assignment logic

* adds task assignment logic

* fix lints

* fix lints
@ashwiniag ashwiniag merged commit d563be5 into ag-server-enhancement Jan 3, 2025
1 check passed
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.

1 participant