mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: Update Docker configuration for Copilot debugging
This commit updates the Docker configuration in the `.vscode/launch.json` file to improve the debugging experience for Copilot. It modifies the `Debug: Copilot Locally` configuration by changing the `localRoot` to `${workspaceFolder}/TestServer` and updating the `name` to `Copilot: Debug with Docker`. Additionally, it sets the `port` to `9985`, `remoteRoot` to `/usr/src/app`, and enables `restart` and `autoAttachChildProcesses` for better debugging capabilities. These changes enhance the development workflow and make it easier to debug Copilot locally with Docker.
This commit is contained in:
32
.vscode/launch.json
vendored
32
.vscode/launch.json
vendored
@@ -20,18 +20,18 @@
|
||||
],
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug: Copilot Locally",
|
||||
"request": "launch",
|
||||
"localRoot": "${workspaceFolder}/Copilot",
|
||||
"runtimeArgs": [
|
||||
"run-script",
|
||||
"start"
|
||||
],
|
||||
"runtimeExecutable": "npm",
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/TestServer",
|
||||
"name": "Copilot: Debug with Docker",
|
||||
"port": 9985,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "node"
|
||||
"type": "node",
|
||||
"restart": true,
|
||||
"autoAttachChildProcesses": true
|
||||
},
|
||||
{
|
||||
"name": "Debug Infrastructure Agent",
|
||||
@@ -147,20 +147,6 @@
|
||||
"restart": true,
|
||||
"autoAttachChildProcesses": true
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/Copilot",
|
||||
"name": "Copilot: Debug with Docker",
|
||||
"port": 9985,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "node",
|
||||
"restart": true,
|
||||
"autoAttachChildProcesses": true
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/Workers",
|
||||
|
||||
@@ -14,6 +14,7 @@ Init()
|
||||
})
|
||||
.catch(async (error: Error | HTTPErrorResponse) => {
|
||||
try {
|
||||
logger.error(error);
|
||||
await CodeRepositoryUtil.discardChanges();
|
||||
|
||||
// change back to main branch.
|
||||
|
||||
@@ -135,7 +135,11 @@ export default class CopilotActionService {
|
||||
|
||||
// add files to stage
|
||||
|
||||
logger.info("Adding files to stage");
|
||||
logger.info("Adding files to stage: ");
|
||||
|
||||
for (const filePath of filePaths) {
|
||||
logger.info(`- ${filePath}`);
|
||||
}
|
||||
|
||||
await CodeRepositoryUtil.addFilesToGit({
|
||||
filePaths: filePaths,
|
||||
|
||||
@@ -49,6 +49,10 @@ export default class CodeRepositoryUtil {
|
||||
public static gitHubUtil: GitHubUtil | null = null;
|
||||
public static folderNameOfClonedRepository: string | null = null;
|
||||
|
||||
public static isRepoCloned(): boolean {
|
||||
return Boolean(this.folderNameOfClonedRepository);
|
||||
}
|
||||
|
||||
public static async getOpenSetupPullRequest(): Promise<CopilotPullRequest | null> {
|
||||
const openPullRequests: Array<CopilotPullRequest> =
|
||||
await CopilotPullRequestService.getOpenPullRequestsFromDatabase();
|
||||
@@ -475,21 +479,29 @@ export default class CodeRepositoryUtil {
|
||||
}
|
||||
|
||||
public static async discardChanges(): Promise<void> {
|
||||
await CodeRepositoryServerUtil.discardChanges({
|
||||
repoPath: this.getLocalRepositoryPath(),
|
||||
});
|
||||
if (this.isRepoCloned()) {
|
||||
await CodeRepositoryServerUtil.discardChanges({
|
||||
repoPath: this.getLocalRepositoryPath(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static async checkoutBranch(data: {
|
||||
branchName: string;
|
||||
}): Promise<void> {
|
||||
await CodeRepositoryServerUtil.checkoutBranch({
|
||||
repoPath: this.getLocalRepositoryPath(),
|
||||
branchName: data.branchName,
|
||||
});
|
||||
if (this.isRepoCloned()) {
|
||||
await CodeRepositoryServerUtil.checkoutBranch({
|
||||
repoPath: this.getLocalRepositoryPath(),
|
||||
branchName: data.branchName,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static async checkoutMainBranch(): Promise<void> {
|
||||
if (!this.isRepoCloned()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const codeRepository: CopilotCodeRepository =
|
||||
await this.getCodeRepository();
|
||||
|
||||
@@ -685,6 +697,8 @@ export default class CodeRepositoryUtil {
|
||||
return this.codeRepositoryResult;
|
||||
}
|
||||
|
||||
logger.info("Fetching Code Repository...");
|
||||
|
||||
const repositorySecretKey: string | null = GetRepositorySecretKey();
|
||||
|
||||
if (!repositorySecretKey) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import API from "Common/Utils/API";
|
||||
import HTTPErrorResponse from "Common/Types/API/HTTPErrorResponse";
|
||||
import HTTPResponse from "Common/Types/API/HTTPResponse";
|
||||
import { JSONObject } from "Common/Types/JSON";
|
||||
import logger from "CommonServer/Utils/Logger";
|
||||
|
||||
export default class InitUtil {
|
||||
public static async init(): Promise<CodeRepositoryResult> {
|
||||
@@ -40,6 +41,10 @@ export default class InitUtil {
|
||||
// Check if the repository type is GitHub and the GitHub token is provided
|
||||
|
||||
if (codeRepositoryResult.serviceRepositories.length === 0) {
|
||||
logger.error(
|
||||
"No services found in the repository. Please add services to the repository in OneUptime Dashboard.",
|
||||
);
|
||||
|
||||
throw new BadDataException(
|
||||
"No services found in the repository. Please add services to the repository in OneUptime Dashboard.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user