From 6fe25e935cec9cd81326f90c7d8895216ef1d26e Mon Sep 17 00:00:00 2001 From: "Mihail Penchev (c)" Date: Thu, 10 Oct 2024 13:54:44 +0300 Subject: [PATCH 1/4] feat: [159] Restored System and Server logs in VRDT OUTPUT Signed-off-by: Mihail Penchev (c) --- extension/src/client/command/RunAction.ts | 10 ++++++---- packages/node/vrdt-common/src/logger.ts | 7 +++++++ packages/node/vrdt-common/src/rest/VroRestClient.ts | 3 +-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/extension/src/client/command/RunAction.ts b/extension/src/client/command/RunAction.ts index 0973fc6d..79a1d59b 100644 --- a/extension/src/client/command/RunAction.ts +++ b/extension/src/client/command/RunAction.ts @@ -280,7 +280,6 @@ class ActionRunner { } this.logger.info(`Running workflow ${RUN_SCRIPT_WORKFLOW_ID} (vRO ${this.vroVersion})`) - const supportsSysLog = semver.gt(this.vroVersion, "7.3.1") const params = [ { name: "script", @@ -293,7 +292,7 @@ class ActionRunner { name: "printInOutput", type: "boolean", value: { - boolean: { value: !supportsSysLog } + boolean: { value: true } } } ] @@ -416,6 +415,9 @@ abstract class FetchSysLogsStrategy extends FetchLogsStrategy { protected abstract getLogMessages(): Promise async printMessages(): Promise { + if (Logger.level === "off") { + return + } const timestamp = Date.now() - 10000 // 10sec earlier const logs = await this.getLogMessages() logs.forEach(logMessage => { @@ -455,7 +457,7 @@ class FetchLogsPre76 extends FetchSysLogsStrategy { return this.restClient.getWorkflowLogsPre76( RUN_SCRIPT_WORKFLOW_ID, this.executionToken, - "debug", + Logger.level, this.lastTimestamp ) } @@ -475,7 +477,7 @@ class FetchLogsPost76 extends FetchSysLogsStrategy { return this.restClient.getWorkflowLogsPost76( RUN_SCRIPT_WORKFLOW_ID, this.executionToken, - "debug", + Logger.level, this.lastTimestamp ) } diff --git a/packages/node/vrdt-common/src/logger.ts b/packages/node/vrdt-common/src/logger.ts index a8b3724e..38eb0ab7 100644 --- a/packages/node/vrdt-common/src/logger.ts +++ b/packages/node/vrdt-common/src/logger.ts @@ -37,6 +37,13 @@ export default class Logger { } } + /** + * Configured log level. + */ + static get level(): LogLevel { + return Logger.logLevel + } + debug(message: string, data?: any): void { if (this.channel && Logger.logLevel === "debug") { this.channel.debug(this.format("DEBUG", message, data)) diff --git a/packages/node/vrdt-common/src/rest/VroRestClient.ts b/packages/node/vrdt-common/src/rest/VroRestClient.ts index 10f4155b..0c5a5ea1 100644 --- a/packages/node/vrdt-common/src/rest/VroRestClient.ts +++ b/packages/node/vrdt-common/src/rest/VroRestClient.ts @@ -321,8 +321,7 @@ export class VroRestClient { "GET", `workflows/${workflowId}/executions/${executionId}/syslogs` + `?conditions=severity=${severity}` + - `&conditions=timestamp${encodeURIComponent(">")}${timestamp}` + - "&conditions=type=system" + `&conditions=timestamp${encodeURIComponent(">")}${timestamp}` // + "&conditions=type=system" ) const messages: LogMessage[] = [] From 83b5c79f35bb31f473c2179be2cc213fad5e431b Mon Sep 17 00:00:00 2001 From: Venelin Bakalov Date: Fri, 11 Oct 2024 10:34:12 +0300 Subject: [PATCH 2/4] update upload artifact action version Signed-off-by: Venelin Bakalov --- .github/workflows/build.yml | 2 +- .github/workflows/draft-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 332b64b4..91340770 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,7 +85,7 @@ jobs: name: codecov - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: runner.os == 'ubuntu-latest' with: name: vrealize-developer-tools-${{steps.version_step.outputs.version_build}}.vsix diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 18287516..6e7fcf17 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -70,7 +70,7 @@ jobs: MINISIGN_PASSWORD: ${{ secrets.RELEASE_MINISIGN_PASS }} - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: vrealize-developer-tools-${{steps.version_step.outputs.version}} path: | From 15f216190218b0ea0fa412bb9f09105b88ffb911 Mon Sep 17 00:00:00 2001 From: "Mihail Penchev (c)" Date: Fri, 11 Oct 2024 11:09:52 +0300 Subject: [PATCH 3/4] fix: [159] removed obsolete Run Script WF parameter printInOutput Signed-off-by: Mihail Penchev (c) --- extension/src/client/command/RunAction.ts | 7 ------- packages/node/vrdt-common/src/rest/VroRestClient.ts | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/extension/src/client/command/RunAction.ts b/extension/src/client/command/RunAction.ts index 79a1d59b..96c30217 100644 --- a/extension/src/client/command/RunAction.ts +++ b/extension/src/client/command/RunAction.ts @@ -287,13 +287,6 @@ class ActionRunner { value: { string: { value: fileContent } } - }, - { - name: "printInOutput", - type: "boolean", - value: { - boolean: { value: true } - } } ] diff --git a/packages/node/vrdt-common/src/rest/VroRestClient.ts b/packages/node/vrdt-common/src/rest/VroRestClient.ts index 0c5a5ea1..9c42e835 100644 --- a/packages/node/vrdt-common/src/rest/VroRestClient.ts +++ b/packages/node/vrdt-common/src/rest/VroRestClient.ts @@ -321,7 +321,7 @@ export class VroRestClient { "GET", `workflows/${workflowId}/executions/${executionId}/syslogs` + `?conditions=severity=${severity}` + - `&conditions=timestamp${encodeURIComponent(">")}${timestamp}` // + "&conditions=type=system" + `&conditions=timestamp${encodeURIComponent(">")}${timestamp}` ) const messages: LogMessage[] = [] From c1098b0a71e1ce7f9752b3fc92c32a345d9fbeb5 Mon Sep 17 00:00:00 2001 From: "Mihail Penchev (c)" Date: Fri, 11 Oct 2024 11:17:10 +0300 Subject: [PATCH 4/4] feat: [159] Added optional LogMessage origin (Server/System) Signed-off-by: Mihail Penchev (c) --- extension/src/client/command/RunAction.ts | 3 ++- packages/node/vrdt-common/src/rest/VroRestClient.ts | 3 ++- packages/node/vrdt-common/src/rest/vro-model.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extension/src/client/command/RunAction.ts b/extension/src/client/command/RunAction.ts index 96c30217..49c1ec32 100644 --- a/extension/src/client/command/RunAction.ts +++ b/extension/src/client/command/RunAction.ts @@ -415,7 +415,8 @@ abstract class FetchSysLogsStrategy extends FetchLogsStrategy { const logs = await this.getLogMessages() logs.forEach(logMessage => { const timestamp = moment(logMessage.timestamp).format("YYYY-MM-DD HH:mm:ss.SSS ZZ") - const msg = `[${timestamp}] [${logMessage.severity}] ${logMessage.description}` + const origin = !logMessage.origin ? "" : `[${logMessage.origin}] ` + const msg = `[${timestamp}] ${origin}[${logMessage.severity}] ${logMessage.description}` if (!this.printedMessages.has(msg)) { this.log(msg) this.printedMessages.add(msg) diff --git a/packages/node/vrdt-common/src/rest/VroRestClient.ts b/packages/node/vrdt-common/src/rest/VroRestClient.ts index 9c42e835..98499975 100644 --- a/packages/node/vrdt-common/src/rest/VroRestClient.ts +++ b/packages/node/vrdt-common/src/rest/VroRestClient.ts @@ -334,7 +334,8 @@ export class VroRestClient { messages.push({ timestamp: e["time-stamp"], severity: e.severity, - description + description, + origin: e.origin }) } diff --git a/packages/node/vrdt-common/src/rest/vro-model.ts b/packages/node/vrdt-common/src/rest/vro-model.ts index ab6d810e..e5e05402 100644 --- a/packages/node/vrdt-common/src/rest/vro-model.ts +++ b/packages/node/vrdt-common/src/rest/vro-model.ts @@ -15,6 +15,7 @@ export interface LogMessage { timestamp: string severity: string description: string + origin?: string } export interface Version {