mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix(agent/agentcontainers): make sure arch is set for sub agents (#18428)
This commit is contained in:
committed by
GitHub
parent
2f59cd0c73
commit
56ff0fb65a
@ -1063,6 +1063,10 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
|
|||||||
)
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if proc.agent.ID == uuid.Nil {
|
||||||
|
proc.agent.Architecture = arch
|
||||||
|
}
|
||||||
|
|
||||||
agentBinaryPath, err := os.Executable()
|
agentBinaryPath, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("get agent binary path: %w", err)
|
return xerrors.Errorf("get agent binary path: %w", err)
|
||||||
@ -1107,6 +1111,8 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
|
|||||||
|
|
||||||
subAgentConfig := proc.agent.CloneConfig(dc)
|
subAgentConfig := proc.agent.CloneConfig(dc)
|
||||||
if proc.agent.ID == uuid.Nil || maybeRecreateSubAgent {
|
if proc.agent.ID == uuid.Nil || maybeRecreateSubAgent {
|
||||||
|
subAgentConfig.Architecture = arch
|
||||||
|
|
||||||
// Detect workspace folder by executing `pwd` in the container.
|
// Detect workspace folder by executing `pwd` in the container.
|
||||||
// NOTE(mafredri): This is a quick and dirty way to detect the
|
// NOTE(mafredri): This is a quick and dirty way to detect the
|
||||||
// workspace folder inside the container. In the future we will
|
// workspace folder inside the container. In the future we will
|
||||||
|
@ -252,6 +252,15 @@ func (m *fakeSubAgentClient) Create(ctx context.Context, agent agentcontainers.S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if agent.Name == "" {
|
||||||
|
return agentcontainers.SubAgent{}, xerrors.New("name must be set")
|
||||||
|
}
|
||||||
|
if agent.Architecture == "" {
|
||||||
|
return agentcontainers.SubAgent{}, xerrors.New("architecture must be set")
|
||||||
|
}
|
||||||
|
if agent.OperatingSystem == "" {
|
||||||
|
return agentcontainers.SubAgent{}, xerrors.New("operating system must be set")
|
||||||
|
}
|
||||||
agent.ID = uuid.New()
|
agent.ID = uuid.New()
|
||||||
agent.AuthToken = uuid.New()
|
agent.AuthToken = uuid.New()
|
||||||
if m.agents == nil {
|
if m.agents == nil {
|
||||||
|
Reference in New Issue
Block a user