mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add exit code and status to workspace agent scripts (#24505)
For scripts that have not finished or in dry run cases these will be omitted.
This commit is contained in:
@@ -40,7 +40,7 @@ type ManifestAPI struct {
|
||||
func (a *ManifestAPI) GetManifest(ctx context.Context, _ *agentproto.GetManifestRequest) (*agentproto.Manifest, error) {
|
||||
var (
|
||||
dbApps []database.WorkspaceApp
|
||||
scripts []database.WorkspaceAgentScript
|
||||
scripts []database.GetWorkspaceAgentScriptsByAgentIDsRow
|
||||
metadata []database.WorkspaceAgentMetadatum
|
||||
workspace database.Workspace
|
||||
devcontainers []database.WorkspaceAgentDevcontainer
|
||||
@@ -184,7 +184,7 @@ func dbAgentMetadatumToProtoDescription(metadatum database.WorkspaceAgentMetadat
|
||||
}
|
||||
}
|
||||
|
||||
func dbAgentScriptsToProto(scripts []database.WorkspaceAgentScript) []*agentproto.WorkspaceAgentScript {
|
||||
func dbAgentScriptsToProto(scripts []database.GetWorkspaceAgentScriptsByAgentIDsRow) []*agentproto.WorkspaceAgentScript {
|
||||
ret := make([]*agentproto.WorkspaceAgentScript, len(scripts))
|
||||
for i, script := range scripts {
|
||||
ret[i] = dbAgentScriptToProto(script)
|
||||
@@ -192,7 +192,7 @@ func dbAgentScriptsToProto(scripts []database.WorkspaceAgentScript) []*agentprot
|
||||
return ret
|
||||
}
|
||||
|
||||
func dbAgentScriptToProto(script database.WorkspaceAgentScript) *agentproto.WorkspaceAgentScript {
|
||||
func dbAgentScriptToProto(script database.GetWorkspaceAgentScriptsByAgentIDsRow) *agentproto.WorkspaceAgentScript {
|
||||
return &agentproto.WorkspaceAgentScript{
|
||||
Id: script.ID[:],
|
||||
LogSourceId: script.LogSourceID[:],
|
||||
|
||||
@@ -114,7 +114,7 @@ func TestGetManifest(t *testing.T) {
|
||||
Hidden: true,
|
||||
},
|
||||
}
|
||||
scripts = []database.WorkspaceAgentScript{
|
||||
scripts = []database.GetWorkspaceAgentScriptsByAgentIDsRow{
|
||||
{
|
||||
ID: uuid.New(),
|
||||
WorkspaceAgentID: agent.ID,
|
||||
@@ -396,7 +396,7 @@ func TestGetManifest(t *testing.T) {
|
||||
}
|
||||
|
||||
mDB.EXPECT().GetWorkspaceAppsByAgentID(gomock.Any(), childAgent.ID).Return([]database.WorkspaceApp{}, nil)
|
||||
mDB.EXPECT().GetWorkspaceAgentScriptsByAgentIDs(gomock.Any(), []uuid.UUID{childAgent.ID}).Return([]database.WorkspaceAgentScript{}, nil)
|
||||
mDB.EXPECT().GetWorkspaceAgentScriptsByAgentIDs(gomock.Any(), []uuid.UUID{childAgent.ID}).Return([]database.GetWorkspaceAgentScriptsByAgentIDsRow{}, nil)
|
||||
mDB.EXPECT().GetWorkspaceAgentMetadata(gomock.Any(), database.GetWorkspaceAgentMetadataParams{
|
||||
WorkspaceAgentID: childAgent.ID,
|
||||
Keys: nil, // all
|
||||
@@ -459,7 +459,7 @@ func TestGetManifest(t *testing.T) {
|
||||
}
|
||||
|
||||
mDB.EXPECT().GetWorkspaceAppsByAgentID(gomock.Any(), childAgent.ID).Return([]database.WorkspaceApp{}, nil)
|
||||
mDB.EXPECT().GetWorkspaceAgentScriptsByAgentIDs(gomock.Any(), []uuid.UUID{childAgent.ID}).Return([]database.WorkspaceAgentScript{}, nil)
|
||||
mDB.EXPECT().GetWorkspaceAgentScriptsByAgentIDs(gomock.Any(), []uuid.UUID{childAgent.ID}).Return([]database.GetWorkspaceAgentScriptsByAgentIDsRow{}, nil)
|
||||
mDB.EXPECT().GetWorkspaceAgentMetadata(gomock.Any(), database.GetWorkspaceAgentMetadataParams{
|
||||
WorkspaceAgentID: childAgent.ID,
|
||||
Keys: nil,
|
||||
|
||||
Reference in New Issue
Block a user