diff --git a/.azure/ci.yml b/.azure/ci.yml index ea2a35361..edfc7d796 100644 --- a/.azure/ci.yml +++ b/.azure/ci.yml @@ -52,6 +52,14 @@ jobs: npx tfx extension create --root ./dist/azure --manifest-js ./dist/azure/manifest.config.cjs Expand-Archive -Path gittools.gittools-0.0.1.vsix -DestinationPath dist/vsix displayName: 'Build code' + - pwsh: | + npm run test:ci + displayName: 'Run tests' + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'JUnit' + testResultsFiles: 'junit-report.xml' + displayName: 'Test Summary' - pwsh: | # set the inputs for the 'gitversion/setup' action $env:INPUT_VERSIONSPEC = "$(INPUT_VERSIONSPEC)" @@ -76,13 +84,6 @@ jobs: name: version displayName: gitversion/execute workingDirectory: dist/vsix - - pwsh: | - npm run test:ci - displayName: 'Run tests' - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'JUnit' - testResultsFiles: 'junit-report.xml' - pwsh: | echo "Major (major) : $(major)" echo "Major (GitVersion_Major) : $(GitVersion_Major)" diff --git a/.eslintrc.json b/.eslintrc.json index e520f9bb9..2723b072b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -116,7 +116,13 @@ "never" ], "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unbound-method": "error" + "@typescript-eslint/unbound-method": "error", + "vitest/expect-expect": [ + "error", + { + "assertFunctionNames": ["expect", "expectValidSettings"] + } + ] }, "ignorePatterns": [ "packages/glob/__tests__/_temp/**/", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a5d35b57..287c89dbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,13 @@ jobs: npm run build:agent:github npm run build:agent:azure name: Build code + - run: | + npm run test:ci + name: Run tests + - name: Test Summary + uses: test-summary/action@v2.4 + with: + paths: junit-report.xml - name: gitversion/setup uses: ./gitversion/setup with: @@ -56,13 +63,6 @@ jobs: disableNormalization: false overrideConfig: | update-build-number=false - - run: | - npm run test:ci - name: Run tests - - name: Test Summary - uses: test-summary/action@v2.4 - with: - paths: junit-report.xml - run: | echo "Major (env.major) : ${{ env.major }}" echo "Major (env.GitVersion_Major) : ${{ env.GitVersion_Major }}" diff --git a/dist/azure/gitreleasemanager/setup/task.json b/dist/azure/gitreleasemanager/setup/task.json index 6c2a42593..372fc61ca 100644 --- a/dist/azure/gitreleasemanager/setup/task.json +++ b/dist/azure/gitreleasemanager/setup/task.json @@ -28,7 +28,7 @@ "label": "The version spec", "defaultValue": "", "required": true, - "helpMarkDown": "Required version in the form of 0.17.x or exact version like 0.17.0" + "helpMarkDown": "Required version in the form of 0.18.x or exact version like 0.18.0" }, { "name": "includePrerelease", @@ -55,4 +55,4 @@ "helpMarkDown": "Prefer to download the latest version matching the versionSpec, even if there is a local cached version." } ] -} \ No newline at end of file +} diff --git a/dist/tools/libs/gitreleasemanager.mjs b/dist/tools/libs/gitreleasemanager.mjs index e8a169358..bc6a2e57a 100644 --- a/dist/tools/libs/gitreleasemanager.mjs +++ b/dist/tools/libs/gitreleasemanager.mjs @@ -282,96 +282,119 @@ class Runner { this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`); this.buildAgent.setVariable(pathVariable, toolPath); this.buildAgent.setSucceeded("GitReleaseManager installed successfully", true); - return 0; + return { + code: 0 + }; } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } async create() { try { this.disableTelemetry(); this.buildAgent.debug("Creating release"); - await this.gitReleaseManagerTool.create(); + const result = await this.gitReleaseManagerTool.create(); this.buildAgent.setSucceeded("GitReleaseManager created release successfully", true); - return 0; + return result; } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } async discard() { try { this.disableTelemetry(); this.buildAgent.debug("Discarding release"); - await this.gitReleaseManagerTool.discard(); + const result = await this.gitReleaseManagerTool.discard(); this.buildAgent.setSucceeded("GitReleaseManager discarded release successfully", true); - return 0; + return result; } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } async close() { try { this.disableTelemetry(); this.buildAgent.debug("Closing release"); - await this.gitReleaseManagerTool.close(); + const result = await this.gitReleaseManagerTool.close(); this.buildAgent.setSucceeded("GitReleaseManager closed release successfully", true); - return 0; + return result; } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } async open() { try { this.disableTelemetry(); this.buildAgent.debug("Opening release"); - await this.gitReleaseManagerTool.open(); + const result = await this.gitReleaseManagerTool.open(); this.buildAgent.setSucceeded("GitReleaseManager opened release successfully", true); - return 0; + return result; } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } async publish() { try { this.disableTelemetry(); this.buildAgent.debug("Publishing release"); - await this.gitReleaseManagerTool.publish(); + const result = await this.gitReleaseManagerTool.publish(); this.buildAgent.setSucceeded("GitReleaseManager published release successfully", true); - return 0; + return result; } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } async addAsset() { try { this.disableTelemetry(); this.buildAgent.debug("Adding asset to release"); - await this.gitReleaseManagerTool.addAsset(); + const result = await this.gitReleaseManagerTool.addAsset(); this.buildAgent.setSucceeded("GitReleaseManager added assets to release successfully", true); - return 0; + return result; } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } disableTelemetry() { diff --git a/dist/tools/libs/gitreleasemanager.mjs.map b/dist/tools/libs/gitreleasemanager.mjs.map index 64e80404b..f9f6d9c0c 100644 --- a/dist/tools/libs/gitreleasemanager.mjs.map +++ b/dist/tools/libs/gitreleasemanager.mjs.map @@ -1 +1 @@ -{"version":3,"file":"gitreleasemanager.mjs","sources":["../../../src/tools/gitreleasemanager/models.ts","../../../src/tools/gitreleasemanager/settings.ts","../../../src/tools/gitreleasemanager/tool.ts","../../../src/tools/gitreleasemanager/runner.ts"],"sourcesContent":["export type Commands = 'setup' | 'addasset' | 'close' | 'create' | 'discard' | 'open' | 'publish'\n\nexport enum CommonFields {\n repository = 'repository',\n owner = 'owner',\n token = 'token',\n targetDirectory = 'targetDirectory'\n}\n\nexport enum CreateFields {\n milestone = 'milestone',\n name = 'name',\n inputFileName = 'inputFileName',\n isPreRelease = 'isPreRelease',\n commit = 'commit',\n assets = 'assets'\n}\n\nexport enum DiscardFields {\n milestone = 'milestone'\n}\n\nexport enum CloseFields {\n milestone = 'milestone'\n}\n\nexport enum OpenFields {\n milestone = 'milestone'\n}\n\nexport enum PublishFields {\n milestone = 'milestone'\n}\n\nexport enum AddAssetFields {\n milestone = 'milestone',\n assets = 'assets'\n}\n\nexport type GitReleaseManagerSettings = {\n [CommonFields.repository]: string\n [CommonFields.owner]: string\n [CommonFields.token]: string\n [CommonFields.targetDirectory]: string\n}\n\nexport interface GitReleaseManagerCreateSettings extends GitReleaseManagerSettings {\n [CreateFields.milestone]: string\n [CreateFields.name]: string\n [CreateFields.inputFileName]: string\n [CreateFields.isPreRelease]: boolean\n [CreateFields.commit]: string\n [CreateFields.assets]?: string[]\n}\n\nexport interface GitReleaseManagerDiscardSettings extends GitReleaseManagerSettings {\n [DiscardFields.milestone]: string\n}\n\nexport interface GitReleaseManagerCloseSettings extends GitReleaseManagerSettings {\n [CloseFields.milestone]: string\n}\n\nexport interface GitReleaseManagerOpenSettings extends GitReleaseManagerSettings {\n [OpenFields.milestone]: string\n}\n\nexport interface GitReleaseManagerPublishSettings extends GitReleaseManagerSettings {\n [PublishFields.milestone]: string\n}\n\nexport interface GitReleaseManagerAddAssetSettings extends GitReleaseManagerSettings {\n [AddAssetFields.milestone]: string\n [AddAssetFields.assets]: string[]\n}\n","import { type ISettingsProvider, SettingsProvider } from '@tools/common'\nimport {\n AddAssetFields,\n CloseFields,\n CommonFields,\n CreateFields,\n DiscardFields,\n OpenFields,\n PublishFields,\n type GitReleaseManagerAddAssetSettings,\n type GitReleaseManagerCloseSettings,\n type GitReleaseManagerCreateSettings,\n type GitReleaseManagerDiscardSettings,\n type GitReleaseManagerOpenSettings,\n type GitReleaseManagerPublishSettings,\n type GitReleaseManagerSettings\n} from './models'\nexport interface IGitReleaseManagerSettingsProvider extends ISettingsProvider {\n getCreateSettings(): GitReleaseManagerCreateSettings\n\n getDiscardSettings(): GitReleaseManagerDiscardSettings\n\n getCloseSettings(): GitReleaseManagerCloseSettings\n\n getOpenSettings(): GitReleaseManagerOpenSettings\n\n getPublishSettings(): GitReleaseManagerPublishSettings\n\n getAddAssetSettings(): GitReleaseManagerAddAssetSettings\n\n getCommonSettings(): GitReleaseManagerSettings\n}\n\nexport class GitReleaseManagerSettingsProvider extends SettingsProvider implements IGitReleaseManagerSettingsProvider {\n getCreateSettings(): GitReleaseManagerCreateSettings {\n const milestone = this.buildAgent.getInput(CreateFields.milestone)\n const name = this.buildAgent.getInput(CreateFields.name)\n const inputFileName = this.buildAgent.getInput(CreateFields.inputFileName)\n const isPreRelease = this.buildAgent.getBooleanInput(CreateFields.isPreRelease)\n const commit = this.buildAgent.getInput(CreateFields.commit)\n const assets = this.buildAgent.getListInput(CreateFields.assets)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone,\n name,\n inputFileName,\n isPreRelease,\n commit,\n assets\n }\n }\n\n getDiscardSettings(): GitReleaseManagerDiscardSettings {\n const milestone = this.buildAgent.getInput(DiscardFields.milestone)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone\n }\n }\n\n getCloseSettings(): GitReleaseManagerCloseSettings {\n const milestone = this.buildAgent.getInput(CloseFields.milestone)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone\n }\n }\n\n getOpenSettings(): GitReleaseManagerOpenSettings {\n const milestone = this.buildAgent.getInput(OpenFields.milestone)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone\n }\n }\n getPublishSettings(): GitReleaseManagerPublishSettings {\n const milestone = this.buildAgent.getInput(PublishFields.milestone)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone\n }\n }\n\n getAddAssetSettings(): GitReleaseManagerAddAssetSettings {\n const milestone = this.buildAgent.getInput(AddAssetFields.milestone)\n const assets = this.buildAgent.getListInput(AddAssetFields.assets)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone,\n assets\n }\n }\n\n getCommonSettings(): GitReleaseManagerSettings {\n const owner = this.buildAgent.getInput(CommonFields.owner, true)\n const repository = this.buildAgent.getInput(CommonFields.repository, true)\n const token = this.buildAgent.getInput(CommonFields.token, true)\n const targetDirectory = this.buildAgent.getInput(CommonFields.targetDirectory)\n\n return {\n owner,\n repository,\n token,\n targetDirectory\n }\n }\n}\n","import * as path from 'path'\n\nimport { DotnetTool } from '@tools/common'\nimport { type ExecResult } from '@agents/common'\n\nimport {\n type GitReleaseManagerAddAssetSettings,\n type GitReleaseManagerCloseSettings,\n type GitReleaseManagerCreateSettings,\n type GitReleaseManagerDiscardSettings,\n type GitReleaseManagerOpenSettings,\n type GitReleaseManagerPublishSettings,\n type GitReleaseManagerSettings\n} from './models'\nimport { GitReleaseManagerSettingsProvider, IGitReleaseManagerSettingsProvider } from './settings'\n\nexport class GitReleaseManagerTool extends DotnetTool {\n get packageName(): string {\n return 'GitReleaseManager.Tool'\n }\n\n get toolName(): string {\n return 'dotnet-gitreleasemanager'\n }\n\n get toolPathVariable(): string {\n return 'GITRELEASEMANAGER_PATH'\n }\n\n get versionRange(): string | null {\n return '>=0.10.0 <0.20.0'\n }\n\n get settingsProvider(): IGitReleaseManagerSettingsProvider {\n return new GitReleaseManagerSettingsProvider(this.buildAgent)\n }\n\n async create(): Promise {\n const settings = this.settingsProvider.getCreateSettings()\n const args = await this.getCreateArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async discard(): Promise {\n const settings = this.settingsProvider.getDiscardSettings()\n const args = await this.getDiscardArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async close(): Promise {\n const settings = this.settingsProvider.getCloseSettings()\n const args = await this.getCloseArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async open(): Promise {\n const settings = this.settingsProvider.getOpenSettings()\n const args = await this.getOpenArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async publish(): Promise {\n const settings = this.settingsProvider.getPublishSettings()\n const args = await this.getPublishArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async addAsset(): Promise {\n const settings = this.settingsProvider.getAddAssetSettings()\n const args = await this.getAddAssetArguments(settings)\n\n return await this.executeTool(args)\n }\n\n protected async getCommonArguments(settings: GitReleaseManagerSettings): Promise {\n const args: string[] = []\n\n args.push('--owner', settings.owner)\n args.push('--repository', settings.repository)\n args.push('--token', settings.token)\n\n settings.targetDirectory = await this.getRepoDir(settings)\n\n args.push('--targetDirectory', settings.targetDirectory)\n\n return args\n }\n\n protected async getCreateArguments(settings: GitReleaseManagerCreateSettings): Promise {\n const args: string[] = ['create', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n if (settings.name) {\n args.push('--name', settings.name)\n }\n if (settings.commit) {\n args.push('--targetcommitish', settings.commit)\n }\n\n if (settings.inputFileName) {\n if (await this.buildAgent.fileExists(settings.inputFileName)) {\n args.push('--inputFilePath', settings.inputFileName)\n } else {\n throw new Error(`GitReleaseManager inputFilePath not found at ${settings.inputFileName}`)\n }\n }\n if (settings.isPreRelease) {\n args.push('--pre')\n }\n if (settings.assets && settings.assets.length > 0) {\n settings.assets = settings.assets.map(asset => {\n return path.join(settings.targetDirectory, asset)\n })\n\n args.push('--assets', settings.assets.join(','))\n }\n\n return args\n }\n\n protected async getDiscardArguments(settings: GitReleaseManagerDiscardSettings): Promise {\n const args: string[] = ['discard', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getCloseArguments(settings: GitReleaseManagerCloseSettings): Promise {\n const args: string[] = ['close', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getOpenArguments(settings: GitReleaseManagerOpenSettings): Promise {\n const args: string[] = ['open', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getPublishArguments(settings: GitReleaseManagerPublishSettings): Promise {\n const args: string[] = ['publish', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--tagName', settings.milestone)\n }\n\n return args\n }\n\n protected async getAddAssetArguments(settings: GitReleaseManagerAddAssetSettings): Promise {\n const args: string[] = ['addasset', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--tagName', settings.milestone)\n }\n if (settings.assets && settings.assets.length > 0) {\n settings.assets = settings.assets.map(asset => {\n return path.join(settings.targetDirectory, asset)\n })\n\n args.push('--assets', settings.assets.join(','))\n }\n\n return args\n }\n\n protected async getRepoDir(settings: GitReleaseManagerSettings): Promise {\n return await this.getRepoPath(settings.targetDirectory)\n }\n}\n","import { type IBuildAgent } from '@agents/common'\nimport { type IRunner } from '@tools/common'\nimport { type Commands } from './models'\nimport { GitReleaseManagerTool } from './tool'\n\nexport class Runner implements IRunner {\n private readonly gitReleaseManagerTool: GitReleaseManagerTool\n\n constructor(private readonly buildAgent: IBuildAgent) {\n this.gitReleaseManagerTool = new GitReleaseManagerTool(this.buildAgent)\n }\n\n async run(command: Commands): Promise {\n switch (command) {\n case 'setup':\n return await this.setup()\n case 'addasset':\n return await this.addAsset()\n case 'open':\n return await this.open()\n case 'close':\n return await this.close()\n case 'create':\n return await this.create()\n case 'discard':\n return await this.discard()\n case 'publish':\n return await this.publish()\n }\n }\n\n private async setup(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Installing GitReleaseManager')\n const toolPath = await this.gitReleaseManagerTool.install()\n\n const pathVariable = this.gitReleaseManagerTool.toolPathVariable\n this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`)\n this.buildAgent.setVariable(pathVariable, toolPath)\n\n this.buildAgent.setSucceeded('GitReleaseManager installed successfully', true)\n return 0\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private async create(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Creating release')\n\n await this.gitReleaseManagerTool.create()\n\n this.buildAgent.setSucceeded('GitReleaseManager created release successfully', true)\n return 0\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private async discard(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Discarding release')\n\n await this.gitReleaseManagerTool.discard()\n\n this.buildAgent.setSucceeded('GitReleaseManager discarded release successfully', true)\n return 0\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private async close(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Closing release')\n\n await this.gitReleaseManagerTool.close()\n\n this.buildAgent.setSucceeded('GitReleaseManager closed release successfully', true)\n return 0\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private async open(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Opening release')\n\n await this.gitReleaseManagerTool.open()\n\n this.buildAgent.setSucceeded('GitReleaseManager opened release successfully', true)\n return 0\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private async publish(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Publishing release')\n\n await this.gitReleaseManagerTool.publish()\n\n this.buildAgent.setSucceeded('GitReleaseManager published release successfully', true)\n return 0\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private async addAsset(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Adding asset to release')\n\n await this.gitReleaseManagerTool.addAsset()\n\n this.buildAgent.setSucceeded('GitReleaseManager added assets to release successfully', true)\n return 0\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private disableTelemetry(): void {\n this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`)\n this.buildAgent.debug('Disabling telemetry')\n this.gitReleaseManagerTool.disableTelemetry()\n }\n}\n"],"names":["CommonFields","CreateFields","DiscardFields","CloseFields","OpenFields","PublishFields","AddAssetFields"],"mappings":";;;;;;;;AAEY,IAAA,YAAA,qBAAAA,aAAL,KAAA;AACH,EAAAA,cAAA,YAAa,CAAA,GAAA,YAAA,CAAA;AACb,EAAAA,cAAA,OAAQ,CAAA,GAAA,OAAA,CAAA;AACR,EAAAA,cAAA,OAAQ,CAAA,GAAA,OAAA,CAAA;AACR,EAAAA,cAAA,iBAAkB,CAAA,GAAA,iBAAA,CAAA;AAJV,EAAAA,OAAAA,aAAAA,CAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA,CAAA,CAAA;AAOA,IAAA,YAAA,qBAAAC,aAAL,KAAA;AACH,EAAAA,cAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AACZ,EAAAA,cAAA,MAAO,CAAA,GAAA,MAAA,CAAA;AACP,EAAAA,cAAA,eAAgB,CAAA,GAAA,eAAA,CAAA;AAChB,EAAAA,cAAA,cAAe,CAAA,GAAA,cAAA,CAAA;AACf,EAAAA,cAAA,QAAS,CAAA,GAAA,QAAA,CAAA;AACT,EAAAA,cAAA,QAAS,CAAA,GAAA,QAAA,CAAA;AAND,EAAAA,OAAAA,aAAAA,CAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA,CAAA,CAAA;AASA,IAAA,aAAA,qBAAAC,cAAL,KAAA;AACH,EAAAA,eAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AADJ,EAAAA,OAAAA,cAA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,aAAA,EAAgB,IAAK,CAAA,UAAA,CAAW,SAAS,CAAG,CAAA,CAAA,CAAA,CAAA;AACjE,IAAK,IAAA,CAAA,UAAA,CAAW,MAAM,qBAAqB,CAAA,CAAA;AAC3C,IAAA,IAAA,CAAK,sBAAsB,gBAAiB,EAAA,CAAA;AAAA,GAChD;AACJ;;;;"} \ No newline at end of file +{"version":3,"file":"gitreleasemanager.mjs","sources":["../../../src/tools/gitreleasemanager/models.ts","../../../src/tools/gitreleasemanager/settings.ts","../../../src/tools/gitreleasemanager/tool.ts","../../../src/tools/gitreleasemanager/runner.ts"],"sourcesContent":["export type Commands = 'setup' | 'addasset' | 'close' | 'create' | 'discard' | 'open' | 'publish'\n\nexport enum CommonFields {\n repository = 'repository',\n owner = 'owner',\n token = 'token',\n targetDirectory = 'targetDirectory'\n}\n\nexport enum CreateFields {\n milestone = 'milestone',\n name = 'name',\n inputFileName = 'inputFileName',\n isPreRelease = 'isPreRelease',\n commit = 'commit',\n assets = 'assets'\n}\n\nexport enum DiscardFields {\n milestone = 'milestone'\n}\n\nexport enum CloseFields {\n milestone = 'milestone'\n}\n\nexport enum OpenFields {\n milestone = 'milestone'\n}\n\nexport enum PublishFields {\n milestone = 'milestone'\n}\n\nexport enum AddAssetFields {\n milestone = 'milestone',\n assets = 'assets'\n}\n\nexport type GitReleaseManagerSettings = {\n [CommonFields.repository]: string\n [CommonFields.owner]: string\n [CommonFields.token]: string\n [CommonFields.targetDirectory]: string\n}\n\nexport interface GitReleaseManagerCreateSettings extends GitReleaseManagerSettings {\n [CreateFields.milestone]: string\n [CreateFields.name]: string\n [CreateFields.inputFileName]: string\n [CreateFields.isPreRelease]: boolean\n [CreateFields.commit]: string\n [CreateFields.assets]?: string[]\n}\n\nexport interface GitReleaseManagerDiscardSettings extends GitReleaseManagerSettings {\n [DiscardFields.milestone]: string\n}\n\nexport interface GitReleaseManagerCloseSettings extends GitReleaseManagerSettings {\n [CloseFields.milestone]: string\n}\n\nexport interface GitReleaseManagerOpenSettings extends GitReleaseManagerSettings {\n [OpenFields.milestone]: string\n}\n\nexport interface GitReleaseManagerPublishSettings extends GitReleaseManagerSettings {\n [PublishFields.milestone]: string\n}\n\nexport interface GitReleaseManagerAddAssetSettings extends GitReleaseManagerSettings {\n [AddAssetFields.milestone]: string\n [AddAssetFields.assets]: string[]\n}\n","import { type ISettingsProvider, SettingsProvider } from '@tools/common'\nimport {\n AddAssetFields,\n CloseFields,\n CommonFields,\n CreateFields,\n DiscardFields,\n OpenFields,\n PublishFields,\n type GitReleaseManagerAddAssetSettings,\n type GitReleaseManagerCloseSettings,\n type GitReleaseManagerCreateSettings,\n type GitReleaseManagerDiscardSettings,\n type GitReleaseManagerOpenSettings,\n type GitReleaseManagerPublishSettings,\n type GitReleaseManagerSettings\n} from './models'\nexport interface IGitReleaseManagerSettingsProvider extends ISettingsProvider {\n getCreateSettings(): GitReleaseManagerCreateSettings\n\n getDiscardSettings(): GitReleaseManagerDiscardSettings\n\n getCloseSettings(): GitReleaseManagerCloseSettings\n\n getOpenSettings(): GitReleaseManagerOpenSettings\n\n getPublishSettings(): GitReleaseManagerPublishSettings\n\n getAddAssetSettings(): GitReleaseManagerAddAssetSettings\n\n getCommonSettings(): GitReleaseManagerSettings\n}\n\nexport class GitReleaseManagerSettingsProvider extends SettingsProvider implements IGitReleaseManagerSettingsProvider {\n getCreateSettings(): GitReleaseManagerCreateSettings {\n const milestone = this.buildAgent.getInput(CreateFields.milestone)\n const name = this.buildAgent.getInput(CreateFields.name)\n const inputFileName = this.buildAgent.getInput(CreateFields.inputFileName)\n const isPreRelease = this.buildAgent.getBooleanInput(CreateFields.isPreRelease)\n const commit = this.buildAgent.getInput(CreateFields.commit)\n const assets = this.buildAgent.getListInput(CreateFields.assets)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone,\n name,\n inputFileName,\n isPreRelease,\n commit,\n assets\n }\n }\n\n getDiscardSettings(): GitReleaseManagerDiscardSettings {\n const milestone = this.buildAgent.getInput(DiscardFields.milestone)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone\n }\n }\n\n getCloseSettings(): GitReleaseManagerCloseSettings {\n const milestone = this.buildAgent.getInput(CloseFields.milestone)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone\n }\n }\n\n getOpenSettings(): GitReleaseManagerOpenSettings {\n const milestone = this.buildAgent.getInput(OpenFields.milestone)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone\n }\n }\n getPublishSettings(): GitReleaseManagerPublishSettings {\n const milestone = this.buildAgent.getInput(PublishFields.milestone)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone\n }\n }\n\n getAddAssetSettings(): GitReleaseManagerAddAssetSettings {\n const milestone = this.buildAgent.getInput(AddAssetFields.milestone)\n const assets = this.buildAgent.getListInput(AddAssetFields.assets)\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n milestone,\n assets\n }\n }\n\n getCommonSettings(): GitReleaseManagerSettings {\n const owner = this.buildAgent.getInput(CommonFields.owner, true)\n const repository = this.buildAgent.getInput(CommonFields.repository, true)\n const token = this.buildAgent.getInput(CommonFields.token, true)\n const targetDirectory = this.buildAgent.getInput(CommonFields.targetDirectory)\n\n return {\n owner,\n repository,\n token,\n targetDirectory\n }\n }\n}\n","import * as path from 'path'\n\nimport { DotnetTool } from '@tools/common'\nimport { type ExecResult } from '@agents/common'\n\nimport {\n type GitReleaseManagerAddAssetSettings,\n type GitReleaseManagerCloseSettings,\n type GitReleaseManagerCreateSettings,\n type GitReleaseManagerDiscardSettings,\n type GitReleaseManagerOpenSettings,\n type GitReleaseManagerPublishSettings,\n type GitReleaseManagerSettings\n} from './models'\nimport { GitReleaseManagerSettingsProvider, IGitReleaseManagerSettingsProvider } from './settings'\n\nexport class GitReleaseManagerTool extends DotnetTool {\n get packageName(): string {\n return 'GitReleaseManager.Tool'\n }\n\n get toolName(): string {\n return 'dotnet-gitreleasemanager'\n }\n\n get toolPathVariable(): string {\n return 'GITRELEASEMANAGER_PATH'\n }\n\n get versionRange(): string | null {\n return '>=0.10.0 <0.20.0'\n }\n\n get settingsProvider(): IGitReleaseManagerSettingsProvider {\n return new GitReleaseManagerSettingsProvider(this.buildAgent)\n }\n\n async create(): Promise {\n const settings = this.settingsProvider.getCreateSettings()\n const args = await this.getCreateArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async discard(): Promise {\n const settings = this.settingsProvider.getDiscardSettings()\n const args = await this.getDiscardArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async close(): Promise {\n const settings = this.settingsProvider.getCloseSettings()\n const args = await this.getCloseArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async open(): Promise {\n const settings = this.settingsProvider.getOpenSettings()\n const args = await this.getOpenArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async publish(): Promise {\n const settings = this.settingsProvider.getPublishSettings()\n const args = await this.getPublishArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async addAsset(): Promise {\n const settings = this.settingsProvider.getAddAssetSettings()\n const args = await this.getAddAssetArguments(settings)\n\n return await this.executeTool(args)\n }\n\n protected async getCommonArguments(settings: GitReleaseManagerSettings): Promise {\n const args: string[] = []\n\n args.push('--owner', settings.owner)\n args.push('--repository', settings.repository)\n args.push('--token', settings.token)\n\n settings.targetDirectory = await this.getRepoDir(settings)\n\n args.push('--targetDirectory', settings.targetDirectory)\n\n return args\n }\n\n protected async getCreateArguments(settings: GitReleaseManagerCreateSettings): Promise {\n const args: string[] = ['create', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n if (settings.name) {\n args.push('--name', settings.name)\n }\n if (settings.commit) {\n args.push('--targetcommitish', settings.commit)\n }\n\n if (settings.inputFileName) {\n if (await this.buildAgent.fileExists(settings.inputFileName)) {\n args.push('--inputFilePath', settings.inputFileName)\n } else {\n throw new Error(`GitReleaseManager inputFilePath not found at ${settings.inputFileName}`)\n }\n }\n if (settings.isPreRelease) {\n args.push('--pre')\n }\n if (settings.assets && settings.assets.length > 0) {\n settings.assets = settings.assets.map(asset => {\n return path.join(settings.targetDirectory, asset)\n })\n\n args.push('--assets', settings.assets.join(','))\n }\n\n return args\n }\n\n protected async getDiscardArguments(settings: GitReleaseManagerDiscardSettings): Promise {\n const args: string[] = ['discard', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getCloseArguments(settings: GitReleaseManagerCloseSettings): Promise {\n const args: string[] = ['close', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getOpenArguments(settings: GitReleaseManagerOpenSettings): Promise {\n const args: string[] = ['open', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getPublishArguments(settings: GitReleaseManagerPublishSettings): Promise {\n const args: string[] = ['publish', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--tagName', settings.milestone)\n }\n\n return args\n }\n\n protected async getAddAssetArguments(settings: GitReleaseManagerAddAssetSettings): Promise {\n const args: string[] = ['addasset', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--tagName', settings.milestone)\n }\n if (settings.assets && settings.assets.length > 0) {\n settings.assets = settings.assets.map(asset => {\n return path.join(settings.targetDirectory, asset)\n })\n\n args.push('--assets', settings.assets.join(','))\n }\n\n return args\n }\n\n protected async getRepoDir(settings: GitReleaseManagerSettings): Promise {\n return await this.getRepoPath(settings.targetDirectory)\n }\n}\n","import { type ExecResult, type IBuildAgent } from '@agents/common'\nimport { type IRunner } from '@tools/common'\nimport { type Commands } from './models'\nimport { GitReleaseManagerTool } from './tool'\n\nexport class Runner implements IRunner {\n private readonly gitReleaseManagerTool: GitReleaseManagerTool\n\n constructor(private readonly buildAgent: IBuildAgent) {\n this.gitReleaseManagerTool = new GitReleaseManagerTool(this.buildAgent)\n }\n\n async run(command: Commands): Promise {\n switch (command) {\n case 'setup':\n return await this.setup()\n case 'addasset':\n return await this.addAsset()\n case 'open':\n return await this.open()\n case 'close':\n return await this.close()\n case 'create':\n return await this.create()\n case 'discard':\n return await this.discard()\n case 'publish':\n return await this.publish()\n }\n }\n\n private async setup(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Installing GitReleaseManager')\n const toolPath = await this.gitReleaseManagerTool.install()\n\n const pathVariable = this.gitReleaseManagerTool.toolPathVariable\n this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`)\n this.buildAgent.setVariable(pathVariable, toolPath)\n\n this.buildAgent.setSucceeded('GitReleaseManager installed successfully', true)\n return {\n code: 0\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private async create(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Creating release')\n\n const result = await this.gitReleaseManagerTool.create()\n\n this.buildAgent.setSucceeded('GitReleaseManager created release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private async discard(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Discarding release')\n\n const result = await this.gitReleaseManagerTool.discard()\n\n this.buildAgent.setSucceeded('GitReleaseManager discarded release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private async close(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Closing release')\n\n const result = await this.gitReleaseManagerTool.close()\n\n this.buildAgent.setSucceeded('GitReleaseManager closed release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private async open(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Opening release')\n\n const result = await this.gitReleaseManagerTool.open()\n\n this.buildAgent.setSucceeded('GitReleaseManager opened release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private async publish(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Publishing release')\n\n const result = await this.gitReleaseManagerTool.publish()\n\n this.buildAgent.setSucceeded('GitReleaseManager published release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private async addAsset(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Adding asset to release')\n\n const result = await this.gitReleaseManagerTool.addAsset()\n\n this.buildAgent.setSucceeded('GitReleaseManager added assets to release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private disableTelemetry(): void {\n this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`)\n this.buildAgent.debug('Disabling telemetry')\n this.gitReleaseManagerTool.disableTelemetry()\n }\n}\n"],"names":["CommonFields","CreateFields","DiscardFields","CloseFields","OpenFields","PublishFields","AddAssetFields"],"mappings":";;;;;;;;AAEY,IAAA,YAAA,qBAAAA,aAAL,KAAA;AACH,EAAAA,cAAA,YAAa,CAAA,GAAA,YAAA,CAAA;AACb,EAAAA,cAAA,OAAQ,CAAA,GAAA,OAAA,CAAA;AACR,EAAAA,cAAA,OAAQ,CAAA,GAAA,OAAA,CAAA;AACR,EAAAA,cAAA,iBAAkB,CAAA,GAAA,iBAAA,CAAA;AAJV,EAAAA,OAAAA,aAAAA,CAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA,CAAA,CAAA;AAOA,IAAA,YAAA,qBAAAC,aAAL,KA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GAChD;AACJ;;;;"} \ No newline at end of file diff --git a/dist/tools/libs/gitversion.mjs b/dist/tools/libs/gitversion.mjs index 22b0044e2..ba09ad1a6 100644 --- a/dist/tools/libs/gitversion.mjs +++ b/dist/tools/libs/gitversion.mjs @@ -1,4 +1,4 @@ -import { S as SettingsProvider, D as DotnetTool, k as keysFn } from './tools.mjs'; +import { S as SettingsProvider, D as DotnetTool, k as keysOf } from './tools.mjs'; import 'node:crypto'; import 'node:fs/promises'; import 'node:os'; @@ -20,7 +20,7 @@ var ExecuteFields = /* @__PURE__ */ ((ExecuteFields2) => { })(ExecuteFields || {}); class GitVersionSettingsProvider extends SettingsProvider { - getGitVersionSettings() { + getGitVersionExecuteSettings() { const targetPath = this.buildAgent.getInput(ExecuteFields.targetPath); const disableCache = this.buildAgent.getBooleanInput(ExecuteFields.disableCache); const disableNormalization = this.buildAgent.getBooleanInput(ExecuteFields.disableNormalization); @@ -62,17 +62,16 @@ class GitVersionTool extends DotnetTool { get settingsProvider() { return new GitVersionSettingsProvider(this.buildAgent); } - async run() { - const settings = this.settingsProvider.getGitVersionSettings(); + async executeJson() { + const settings = this.settingsProvider.getGitVersionExecuteSettings(); const workDir = await this.getRepoDir(settings); await this.checkShallowClone(settings, workDir); - const args = await this.getArguments(workDir, settings); + const args = await this.getExecuteArguments(workDir, settings); await this.setDotnetRoot(); return await this.executeTool(args); } writeGitVersionToAgent(output) { - const keys = keysFn(output); - for (const property of keys) { + for (const property of keysOf(output)) { const name = this.toCamelCase(property); try { let value = output[property]?.toString(); @@ -91,7 +90,7 @@ class GitVersionTool extends DotnetTool { async getRepoDir(settings) { return await super.getRepoPath(settings.targetPath); } - async getArguments(workDir, options) { + async getExecuteArguments(workDir, options) { let args = [workDir, "/output", "json", "/output", "buildserver"]; const { useConfigFile, @@ -230,22 +229,27 @@ class Runner { this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`); this.buildAgent.setVariable(pathVariable, toolPath); this.buildAgent.setSucceeded("GitVersion installed successfully", true); - return 0; + return { + code: 0 + }; } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } async execute() { try { this.disableTelemetry(); this.buildAgent.info("Executing GitVersion"); - const result = await this.gitVersionTool.run(); + const result = await this.gitVersionTool.executeJson(); if (result.code === 0) { this.buildAgent.info("GitVersion executed successfully"); - const { stdout } = result; + const stdout = result.stdout; this.buildAgent.info("GitVersion output:"); this.buildAgent.info("-------------------"); this.buildAgent.info(stdout); @@ -254,13 +258,16 @@ class Runner { if (stdout.lastIndexOf("{") === -1 || stdout.lastIndexOf("}") === -1) { this.buildAgent.debug("GitVersion output is not valid JSON"); this.buildAgent.setFailed("GitVersion output is not valid JSON", true); - return -1; + return { + code: -1, + error: new Error("GitVersion output is not valid JSON") + }; } else { const jsonOutput = stdout.substring(stdout.lastIndexOf("{"), stdout.lastIndexOf("}") + 1); const gitVersionOutput = JSON.parse(jsonOutput); this.gitVersionTool.writeGitVersionToAgent(gitVersionOutput); this.buildAgent.setSucceeded("GitVersion executed successfully", true); - return 0; + return result; } } else { this.buildAgent.debug("GitVersion failed"); @@ -268,13 +275,16 @@ class Runner { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return result; } } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true); } - return -1; + return { + code: -1, + error + }; } } disableTelemetry() { diff --git a/dist/tools/libs/gitversion.mjs.map b/dist/tools/libs/gitversion.mjs.map index f0f55ca8a..b1a63c950 100644 --- a/dist/tools/libs/gitversion.mjs.map +++ b/dist/tools/libs/gitversion.mjs.map @@ -1 +1 @@ -{"version":3,"file":"gitversion.mjs","sources":["../../../src/tools/gitversion/models.ts","../../../src/tools/gitversion/settings.ts","../../../src/tools/gitversion/tool.ts","../../../src/tools/gitversion/runner.ts"],"sourcesContent":["export type Commands = 'setup' | 'execute'\n\nexport enum ExecuteFields {\n targetPath = 'targetPath',\n disableCache = 'disableCache',\n disableNormalization = 'disableNormalization',\n disableShallowCloneCheck = 'disableShallowCloneCheck',\n useConfigFile = 'useConfigFile',\n configFilePath = 'configFilePath',\n overrideConfig = 'overrideConfig',\n updateAssemblyInfo = 'updateAssemblyInfo',\n updateAssemblyInfoFilename = 'updateAssemblyInfoFilename',\n additionalArguments = 'additionalArguments'\n}\n\nexport type GitVersionSettings = {\n [ExecuteFields.targetPath]: string\n [ExecuteFields.disableCache]: boolean\n [ExecuteFields.disableNormalization]: boolean\n [ExecuteFields.disableShallowCloneCheck]: boolean\n [ExecuteFields.useConfigFile]: boolean\n [ExecuteFields.configFilePath]: string\n [ExecuteFields.overrideConfig]: string[]\n [ExecuteFields.updateAssemblyInfo]: boolean\n [ExecuteFields.updateAssemblyInfoFilename]: string\n [ExecuteFields.additionalArguments]: string\n}\n\nexport type GitVersionOutput = {\n Major: number\n Minor: number\n Patch: number\n PreReleaseTag: string\n PreReleaseTagWithDash: string\n PreReleaseLabel: string\n PreReleaseNumber: number\n WeightedPreReleaseNumber: number\n BuildMetaData: number\n FullBuildMetaData: string\n MajorMinorPatch: string\n SemVer: string\n AssemblySemVer: string\n AssemblySemFileVer: string\n FullSemVer: string\n InformationalVersion: string\n BranchName: string\n EscapedBranchName: string\n Sha: string\n ShortSha: string\n VersionSourceSha: string\n CommitsSinceVersionSource: number\n UncommittedChanges: number\n CommitDate: string\n}\n","import { type ISettingsProvider, SettingsProvider } from '@tools/common'\nimport { ExecuteFields, type GitVersionSettings } from './models'\n\nexport interface IGitVersionSettingsProvider extends ISettingsProvider {\n getGitVersionSettings(): GitVersionSettings\n}\n\nexport class GitVersionSettingsProvider extends SettingsProvider implements IGitVersionSettingsProvider {\n getGitVersionSettings(): GitVersionSettings {\n const targetPath = this.buildAgent.getInput(ExecuteFields.targetPath)\n\n const disableCache = this.buildAgent.getBooleanInput(ExecuteFields.disableCache)\n const disableNormalization = this.buildAgent.getBooleanInput(ExecuteFields.disableNormalization)\n const disableShallowCloneCheck = this.buildAgent.getBooleanInput(ExecuteFields.disableShallowCloneCheck)\n\n const useConfigFile = this.buildAgent.getBooleanInput(ExecuteFields.useConfigFile)\n const configFilePath = this.buildAgent.getInput(ExecuteFields.configFilePath)\n const overrideConfig = this.buildAgent.getListInput(ExecuteFields.overrideConfig)\n\n const updateAssemblyInfo = this.buildAgent.getBooleanInput(ExecuteFields.updateAssemblyInfo)\n const updateAssemblyInfoFilename = this.buildAgent.getInput(ExecuteFields.updateAssemblyInfoFilename)\n\n const additionalArguments = this.buildAgent.getInput(ExecuteFields.additionalArguments)\n\n return {\n targetPath,\n disableCache,\n disableNormalization,\n disableShallowCloneCheck,\n useConfigFile,\n configFilePath,\n overrideConfig,\n updateAssemblyInfo,\n updateAssemblyInfoFilename,\n additionalArguments\n }\n }\n}\n","import { type ExecResult } from '@agents/common'\nimport { DotnetTool, keysFn } from '@tools/common'\nimport { type GitVersionOutput, type GitVersionSettings } from './models'\nimport { GitVersionSettingsProvider, type IGitVersionSettingsProvider } from './settings'\n\nexport class GitVersionTool extends DotnetTool {\n get packageName(): string {\n return 'GitVersion.Tool'\n }\n\n get toolName(): string {\n return 'dotnet-gitversion'\n }\n\n get toolPathVariable(): string {\n return 'GITVERSION_PATH'\n }\n\n get versionRange(): string | null {\n return '>=5.2.0 <6.1.0'\n }\n\n get settingsProvider(): IGitVersionSettingsProvider {\n return new GitVersionSettingsProvider(this.buildAgent)\n }\n\n async run(): Promise {\n const settings = this.settingsProvider.getGitVersionSettings()\n const workDir = await this.getRepoDir(settings)\n\n await this.checkShallowClone(settings, workDir)\n\n const args = await this.getArguments(workDir, settings)\n\n await this.setDotnetRoot()\n return await this.executeTool(args)\n }\n\n writeGitVersionToAgent(output: GitVersionOutput): void {\n const keys = keysFn(output)\n for (const property of keys) {\n const name = this.toCamelCase(property)\n try {\n let value = output[property]?.toString()\n if (value === '0') {\n value = '0'\n }\n this.buildAgent.setOutput(name, value)\n this.buildAgent.setOutput(`GitVersion_${property}`, value)\n this.buildAgent.setVariable(name, value)\n this.buildAgent.setVariable(`GitVersion_${property}`, value)\n } catch (error) {\n this.buildAgent.error(`Unable to set output/variable for ${property}`)\n }\n }\n }\n\n protected async getRepoDir(settings: GitVersionSettings): Promise {\n return await super.getRepoPath(settings.targetPath)\n }\n\n protected async getArguments(workDir: string, options: GitVersionSettings): Promise {\n let args = [workDir, '/output', 'json', '/output', 'buildserver']\n\n const {\n useConfigFile,\n disableCache,\n disableNormalization,\n configFilePath,\n overrideConfig,\n updateAssemblyInfo,\n updateAssemblyInfoFilename,\n additionalArguments\n //\n } = options\n\n if (disableCache) {\n args.push('/nocache')\n }\n\n if (disableNormalization) {\n args.push('/nonormalize')\n }\n\n if (useConfigFile) {\n if (await this.isValidInputFile('configFilePath', configFilePath)) {\n args.push('/config', configFilePath)\n } else {\n throw new Error(`GitVersion configuration file not found at ${configFilePath}`)\n }\n }\n\n if (overrideConfig) {\n for (let config of overrideConfig) {\n config = config.trim()\n if (config.match(/([a-zA-Z0-9]+(-[a-zA-Z]+)*=[a-zA-Z0-9\\- :.']*)/)) {\n args.push('/overrideconfig', config)\n }\n }\n }\n\n if (updateAssemblyInfo) {\n args.push('/updateassemblyinfo')\n\n // You can specify 'updateAssemblyInfo' without 'updateAssemblyInfoFilename'.\n if (updateAssemblyInfoFilename?.length > 0) {\n if (await this.isValidInputFile('updateAssemblyInfoFilename', updateAssemblyInfoFilename)) {\n args.push(updateAssemblyInfoFilename)\n } else {\n throw new Error(`AssemblyInfoFilename file not found at ${updateAssemblyInfoFilename}`)\n }\n }\n }\n\n if (additionalArguments) {\n args = args.concat(this.argStringToArray(additionalArguments))\n }\n return args\n }\n\n private argStringToArray(argString: string): string[] {\n const args: string[] = []\n\n let inQuotes = false\n let escaped = false\n let lastCharWasSpace = true\n let arg = ''\n\n const append = (c: string): void => {\n // we only escape double quotes.\n if (escaped && c !== '\"') {\n arg += '\\\\'\n }\n\n arg += c\n escaped = false\n }\n\n for (let i = 0; i < argString.length; i++) {\n const c = argString.charAt(i)\n\n if (c === ' ' && !inQuotes) {\n if (!lastCharWasSpace) {\n args.push(arg)\n arg = ''\n }\n lastCharWasSpace = true\n continue\n } else {\n lastCharWasSpace = false\n }\n\n if (c === '\"') {\n if (!escaped) {\n inQuotes = !inQuotes\n } else {\n append(c)\n }\n continue\n }\n\n if (c === '\\\\' && escaped) {\n append(c)\n continue\n }\n\n if (c === '\\\\' && inQuotes) {\n escaped = true\n continue\n }\n\n append(c)\n lastCharWasSpace = false\n }\n\n if (!lastCharWasSpace) {\n args.push(arg.trim())\n }\n\n return args\n }\n\n private async checkShallowClone(settings: GitVersionSettings, workDir: string): Promise {\n if (!settings.disableShallowCloneCheck) {\n const isShallowResult = await this.execute('git', ['-C', workDir, 'rev-parse', '--is-shallow-repository'])\n if (isShallowResult.code === 0 && isShallowResult.stdout.trim() === 'true') {\n throw new Error(\n 'The repository is shallow. Consider disabling shallow clones. See https://github.com/GitTools/actions/blob/main/docs/cloning.md for more information.'\n )\n }\n }\n }\n\n private toCamelCase(input: string): string {\n return input.replace(/^\\w|[A-Z]|\\b\\w|\\s+/g, function (match, index) {\n if (+match === 0) return '' // or if (/\\s+/.test(match)) for white spaces\n return index === 0 ? match.toLowerCase() : match.toUpperCase()\n })\n }\n}\n","import { type IBuildAgent } from '@agents/common'\nimport { type IRunner } from '@tools/common'\nimport { type Commands, type GitVersionOutput } from './models'\nimport { GitVersionTool } from './tool'\n\nexport class Runner implements IRunner {\n private readonly gitVersionTool: GitVersionTool\n\n constructor(private readonly buildAgent: IBuildAgent) {\n this.gitVersionTool = new GitVersionTool(this.buildAgent)\n }\n\n async run(command: Commands): Promise {\n switch (command) {\n case 'setup':\n return await this.setup()\n case 'execute':\n return await this.execute()\n }\n }\n\n private async setup(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Installing GitVersion')\n const toolPath = await this.gitVersionTool.install()\n\n const pathVariable = this.gitVersionTool.toolPathVariable\n this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`)\n this.buildAgent.setVariable(pathVariable, toolPath)\n\n this.buildAgent.setSucceeded('GitVersion installed successfully', true)\n return 0\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private async execute(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.info('Executing GitVersion')\n\n const result = await this.gitVersionTool.run()\n\n if (result.code === 0) {\n this.buildAgent.info('GitVersion executed successfully')\n const { stdout } = result\n\n this.buildAgent.info('GitVersion output:')\n this.buildAgent.info('-------------------')\n this.buildAgent.info(stdout)\n this.buildAgent.info('-------------------')\n this.buildAgent.debug('Parsing GitVersion output')\n\n if (stdout.lastIndexOf('{') === -1 || stdout.lastIndexOf('}') === -1) {\n this.buildAgent.debug('GitVersion output is not valid JSON')\n this.buildAgent.setFailed('GitVersion output is not valid JSON', true)\n return -1\n } else {\n const jsonOutput = stdout.substring(stdout.lastIndexOf('{'), stdout.lastIndexOf('}') + 1)\n\n const gitVersionOutput = JSON.parse(jsonOutput) as GitVersionOutput\n this.gitVersionTool.writeGitVersionToAgent(gitVersionOutput)\n this.buildAgent.setSucceeded('GitVersion executed successfully', true)\n return 0\n }\n } else {\n this.buildAgent.debug('GitVersion failed')\n const error = result.error\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return -1\n }\n }\n\n private disableTelemetry(): void {\n this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`)\n this.buildAgent.debug('Disabling telemetry')\n this.gitVersionTool.disableTelemetry()\n }\n}\n"],"names":["ExecuteFields"],"mappings":";;;;;;;AAEY,IAAA,aAAA,qBAAAA,cAAL,KAAA;AACH,EAAAA,eAAA,YAAa,CAAA,GAAA,YAAA,CAAA;AACb,EAAAA,eAAA,cAAe,CAAA,GAAA,cAAA,CAAA;AACf,EAAAA,eAAA,sBAAuB,CAAA,GAAA,sBAAA,CAAA;AACvB,EAAAA,eAAA,0BAA2B,CAAA,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,EAAgB,IAAK,CAAA,UAAA,CAAW,SAAS,CAAG,CAAA,CAAA,CAAA,CAAA;AACjE,IAAK,IAAA,CAAA,UAAA,CAAW,MAAM,qBAAqB,CAAA,CAAA;AAC3C,IAAA,IAAA,CAAK,eAAe,gBAAiB,EAAA,CAAA;AAAA,GACzC;AACJ;;;;"} \ No newline at end of file +{"version":3,"file":"gitversion.mjs","sources":["../../../src/tools/gitversion/models.ts","../../../src/tools/gitversion/settings.ts","../../../src/tools/gitversion/tool.ts","../../../src/tools/gitversion/runner.ts"],"sourcesContent":["export type Commands = 'setup' | 'execute'\n\nexport enum ExecuteFields {\n targetPath = 'targetPath',\n disableCache = 'disableCache',\n disableNormalization = 'disableNormalization',\n disableShallowCloneCheck = 'disableShallowCloneCheck',\n useConfigFile = 'useConfigFile',\n configFilePath = 'configFilePath',\n overrideConfig = 'overrideConfig',\n updateAssemblyInfo = 'updateAssemblyInfo',\n updateAssemblyInfoFilename = 'updateAssemblyInfoFilename',\n additionalArguments = 'additionalArguments'\n}\n\nexport type GitVersionExecuteSettings = {\n [ExecuteFields.targetPath]: string\n [ExecuteFields.disableCache]: boolean\n [ExecuteFields.disableNormalization]: boolean\n [ExecuteFields.disableShallowCloneCheck]: boolean\n [ExecuteFields.useConfigFile]: boolean\n [ExecuteFields.configFilePath]: string\n [ExecuteFields.overrideConfig]: string[]\n [ExecuteFields.updateAssemblyInfo]: boolean\n [ExecuteFields.updateAssemblyInfoFilename]: string\n [ExecuteFields.additionalArguments]: string\n}\n\nexport type GitVersionOutput = {\n Major: number\n Minor: number\n Patch: number\n PreReleaseTag: string\n PreReleaseTagWithDash: string\n PreReleaseLabel: string\n PreReleaseNumber: number\n WeightedPreReleaseNumber: number\n BuildMetaData: number\n FullBuildMetaData: string\n MajorMinorPatch: string\n SemVer: string\n AssemblySemVer: string\n AssemblySemFileVer: string\n FullSemVer: string\n InformationalVersion: string\n BranchName: string\n EscapedBranchName: string\n Sha: string\n ShortSha: string\n VersionSourceSha: string\n CommitsSinceVersionSource: number\n UncommittedChanges: number\n CommitDate: string\n}\n","import { type ISettingsProvider, SettingsProvider } from '@tools/common'\nimport { ExecuteFields, type GitVersionExecuteSettings } from './models'\n\nexport interface IGitVersionSettingsProvider extends ISettingsProvider {\n getGitVersionExecuteSettings(): GitVersionExecuteSettings\n}\n\nexport class GitVersionSettingsProvider extends SettingsProvider implements IGitVersionSettingsProvider {\n getGitVersionExecuteSettings(): GitVersionExecuteSettings {\n const targetPath = this.buildAgent.getInput(ExecuteFields.targetPath)\n\n const disableCache = this.buildAgent.getBooleanInput(ExecuteFields.disableCache)\n const disableNormalization = this.buildAgent.getBooleanInput(ExecuteFields.disableNormalization)\n const disableShallowCloneCheck = this.buildAgent.getBooleanInput(ExecuteFields.disableShallowCloneCheck)\n\n const useConfigFile = this.buildAgent.getBooleanInput(ExecuteFields.useConfigFile)\n const configFilePath = this.buildAgent.getInput(ExecuteFields.configFilePath)\n const overrideConfig = this.buildAgent.getListInput(ExecuteFields.overrideConfig)\n\n const updateAssemblyInfo = this.buildAgent.getBooleanInput(ExecuteFields.updateAssemblyInfo)\n const updateAssemblyInfoFilename = this.buildAgent.getInput(ExecuteFields.updateAssemblyInfoFilename)\n\n const additionalArguments = this.buildAgent.getInput(ExecuteFields.additionalArguments)\n\n return {\n targetPath,\n disableCache,\n disableNormalization,\n disableShallowCloneCheck,\n useConfigFile,\n configFilePath,\n overrideConfig,\n updateAssemblyInfo,\n updateAssemblyInfoFilename,\n additionalArguments\n }\n }\n}\n","import { type ExecResult } from '@agents/common'\nimport { DotnetTool, keysOf } from '@tools/common'\nimport { type GitVersionExecuteSettings, type GitVersionOutput } from './models'\nimport { GitVersionSettingsProvider, type IGitVersionSettingsProvider } from './settings'\n\nexport class GitVersionTool extends DotnetTool {\n get packageName(): string {\n return 'GitVersion.Tool'\n }\n\n get toolName(): string {\n return 'dotnet-gitversion'\n }\n\n get toolPathVariable(): string {\n return 'GITVERSION_PATH'\n }\n\n get versionRange(): string | null {\n return '>=5.2.0 <6.1.0'\n }\n\n get settingsProvider(): IGitVersionSettingsProvider {\n return new GitVersionSettingsProvider(this.buildAgent)\n }\n\n async executeJson(): Promise {\n const settings = this.settingsProvider.getGitVersionExecuteSettings()\n const workDir = await this.getRepoDir(settings)\n\n await this.checkShallowClone(settings, workDir)\n\n const args = await this.getExecuteArguments(workDir, settings)\n\n await this.setDotnetRoot()\n return await this.executeTool(args)\n }\n\n writeGitVersionToAgent(output: GitVersionOutput): void {\n for (const property of keysOf(output)) {\n const name = this.toCamelCase(property)\n try {\n let value = output[property]?.toString()\n if (value === '0') {\n value = '0'\n }\n this.buildAgent.setOutput(name, value)\n this.buildAgent.setOutput(`GitVersion_${property}`, value)\n this.buildAgent.setVariable(name, value)\n this.buildAgent.setVariable(`GitVersion_${property}`, value)\n } catch (error) {\n this.buildAgent.error(`Unable to set output/variable for ${property}`)\n }\n }\n }\n\n protected async getRepoDir(settings: GitVersionExecuteSettings): Promise {\n return await super.getRepoPath(settings.targetPath)\n }\n\n protected async getExecuteArguments(workDir: string, options: GitVersionExecuteSettings): Promise {\n let args = [workDir, '/output', 'json', '/output', 'buildserver']\n\n const {\n useConfigFile,\n disableCache,\n disableNormalization,\n configFilePath,\n overrideConfig,\n updateAssemblyInfo,\n updateAssemblyInfoFilename,\n additionalArguments\n //\n } = options\n\n if (disableCache) {\n args.push('/nocache')\n }\n\n if (disableNormalization) {\n args.push('/nonormalize')\n }\n\n if (useConfigFile) {\n if (await this.isValidInputFile('configFilePath', configFilePath)) {\n args.push('/config', configFilePath)\n } else {\n throw new Error(`GitVersion configuration file not found at ${configFilePath}`)\n }\n }\n\n if (overrideConfig) {\n for (let config of overrideConfig) {\n config = config.trim()\n if (config.match(/([a-zA-Z0-9]+(-[a-zA-Z]+)*=[a-zA-Z0-9\\- :.']*)/)) {\n args.push('/overrideconfig', config)\n }\n }\n }\n\n if (updateAssemblyInfo) {\n args.push('/updateassemblyinfo')\n\n // You can specify 'updateAssemblyInfo' without 'updateAssemblyInfoFilename'.\n if (updateAssemblyInfoFilename?.length > 0) {\n if (await this.isValidInputFile('updateAssemblyInfoFilename', updateAssemblyInfoFilename)) {\n args.push(updateAssemblyInfoFilename)\n } else {\n throw new Error(`AssemblyInfoFilename file not found at ${updateAssemblyInfoFilename}`)\n }\n }\n }\n\n if (additionalArguments) {\n args = args.concat(this.argStringToArray(additionalArguments))\n }\n return args\n }\n\n private argStringToArray(argString: string): string[] {\n const args: string[] = []\n\n let inQuotes = false\n let escaped = false\n let lastCharWasSpace = true\n let arg = ''\n\n const append = (c: string): void => {\n // we only escape double quotes.\n if (escaped && c !== '\"') {\n arg += '\\\\'\n }\n\n arg += c\n escaped = false\n }\n\n for (let i = 0; i < argString.length; i++) {\n const c = argString.charAt(i)\n\n if (c === ' ' && !inQuotes) {\n if (!lastCharWasSpace) {\n args.push(arg)\n arg = ''\n }\n lastCharWasSpace = true\n continue\n } else {\n lastCharWasSpace = false\n }\n\n if (c === '\"') {\n if (!escaped) {\n inQuotes = !inQuotes\n } else {\n append(c)\n }\n continue\n }\n\n if (c === '\\\\' && escaped) {\n append(c)\n continue\n }\n\n if (c === '\\\\' && inQuotes) {\n escaped = true\n continue\n }\n\n append(c)\n lastCharWasSpace = false\n }\n\n if (!lastCharWasSpace) {\n args.push(arg.trim())\n }\n\n return args\n }\n\n private async checkShallowClone(settings: GitVersionExecuteSettings, workDir: string): Promise {\n if (!settings.disableShallowCloneCheck) {\n const isShallowResult = await this.execute('git', ['-C', workDir, 'rev-parse', '--is-shallow-repository'])\n if (isShallowResult.code === 0 && isShallowResult.stdout.trim() === 'true') {\n throw new Error(\n 'The repository is shallow. Consider disabling shallow clones. See https://github.com/GitTools/actions/blob/main/docs/cloning.md for more information.'\n )\n }\n }\n }\n\n private toCamelCase(input: string): string {\n return input.replace(/^\\w|[A-Z]|\\b\\w|\\s+/g, function (match, index) {\n if (+match === 0) return '' // or if (/\\s+/.test(match)) for white spaces\n return index === 0 ? match.toLowerCase() : match.toUpperCase()\n })\n }\n}\n","import { type ExecResult, type IBuildAgent } from '@agents/common'\nimport { type IRunner } from '@tools/common'\nimport { type Commands, type GitVersionOutput } from './models'\nimport { GitVersionTool } from './tool'\n\nexport class Runner implements IRunner {\n private readonly gitVersionTool: GitVersionTool\n\n constructor(private readonly buildAgent: IBuildAgent) {\n this.gitVersionTool = new GitVersionTool(this.buildAgent)\n }\n\n async run(command: Commands): Promise {\n switch (command) {\n case 'setup':\n return await this.setup()\n case 'execute':\n return await this.execute()\n }\n }\n\n private async setup(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Installing GitVersion')\n const toolPath = await this.gitVersionTool.install()\n\n const pathVariable = this.gitVersionTool.toolPathVariable\n this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`)\n this.buildAgent.setVariable(pathVariable, toolPath)\n\n this.buildAgent.setSucceeded('GitVersion installed successfully', true)\n return {\n code: 0\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private async execute(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.info('Executing GitVersion')\n\n const result = await this.gitVersionTool.executeJson()\n\n if (result.code === 0) {\n this.buildAgent.info('GitVersion executed successfully')\n const stdout: string = result.stdout as string\n\n this.buildAgent.info('GitVersion output:')\n this.buildAgent.info('-------------------')\n this.buildAgent.info(stdout)\n this.buildAgent.info('-------------------')\n this.buildAgent.debug('Parsing GitVersion output')\n\n if (stdout.lastIndexOf('{') === -1 || stdout.lastIndexOf('}') === -1) {\n this.buildAgent.debug('GitVersion output is not valid JSON')\n this.buildAgent.setFailed('GitVersion output is not valid JSON', true)\n return {\n code: -1,\n error: new Error('GitVersion output is not valid JSON')\n }\n } else {\n const jsonOutput = stdout.substring(stdout.lastIndexOf('{'), stdout.lastIndexOf('}') + 1)\n\n const gitVersionOutput = JSON.parse(jsonOutput) as GitVersionOutput\n this.gitVersionTool.writeGitVersionToAgent(gitVersionOutput)\n this.buildAgent.setSucceeded('GitVersion executed successfully', true)\n return result\n }\n } else {\n this.buildAgent.debug('GitVersion failed')\n const error = result.error\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return result\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error\n }\n }\n }\n\n private disableTelemetry(): void {\n this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`)\n this.buildAgent.debug('Disabling telemetry')\n this.gitVersionTool.disableTelemetry()\n }\n}\n"],"names":["ExecuteFields"],"mappings":";;;;;;;AAEY,IAAA,aAAA,qBAAAA,cAAL,KAAA;AACH,EAAAA,eAAA,YAAa,CAAA,GAAA,YAAA,CAAA;AACb,EAAAA,eAAA,cAAe,CAAA,GAAA,cAAA,CAAA;AACf,EAAAA,eAAA,sBAAuB,CAAA,GAAA,sBAAA,CAAA;AACvB,EAAAA,eAAA,0BAA2B,CAAA,GAAA,0BAAA,CAAA;AAC3B,EAAAA,eAAA,eAAgB,CAAA,GAAA,eAAA,CAAA;AAChB,EAAAA,eAAA,gBAAiB,CAAA,GAAA,gBAAA,CAAA;AACjB,EAAAA,eAAA,gBAAiB,CAAA,GAAA,gBAAA,CAAA;AACjB,EAAAA,eAAA,oBAAqB,CAAA,GAAA,oBAAA,CAAA;AACrB,EAAAA,eAAA,4BAA6B,CAAA,GAAA,4BAAA,CAAA;AAC7B,EAAAA,eAAA,qBAAsB,CAAA,GAAA,qBAAA,CAAA;AAVd,EAAAA,OAAAA,cAAAA,CAAAA;AAAA,CAAA,EAAA,aAAA,IAAA,EAAA,CAAA;;ACKL,MAAM,mCAAmC,gBAAwD,CAAA;AAAA,EACpG,4BAA0D,GAAA;AACtD,IAAA,MAAM,UAAa,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAAS,cAAc,UAAU,CAAA,CAAA;AAEpE,IAAA,MAAM,YAAe,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAAgB,c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A;AAC3D,UAAK,IAAA,CAAA,UAAA,CAAW,YAAa,CAAA,kCAAA,EAAoC,IAAI,CAAA,CAAA;AACrE,UAAO,OAAA,MAAA,CAAA;AAAA,SACX;AAAA,OACG,MAAA;AACH,QAAK,IAAA,CAAA,UAAA,CAAW,MAAM,mBAAmB,CAAA,CAAA;AACzC,QAAA,MAAM,QAAQ,MAAO,CAAA,KAAA,CAAA;AACrB,QAAA,IAAI,iBAAiB,KAAO,EAAA;AACxB,UAAA,IAAA,CAAK,UAAW,CAAA,SAAA,CAAU,KAAM,CAAA,OAAA,EAAS,IAAI,CAAA,CAAA;AAAA,SACjD;AACA,QAAO,OAAA,MAAA,CAAA;AAAA,OACX;AAAA,aACK,KAAO,EAAA;AACZ,MAAA,IAAI,iBAAiB,KAAO,EAAA;AACxB,QAAA,IAAA,CAAK,UAAW,CAAA,SAAA,CAAU,KAAM,CAAA,OAAA,EAAS,IAAI,CAAA,CAAA;AAAA,OACjD;AACA,MAAO,OAAA;AAAA,QACH,IAAM,EAAA,CAAA,CAAA;AAAA,QACN,KAAA;AAAA,OACJ,CAAA;AAAA,KACJ;AAAA,GACJ;AAAA,EAEQ,gBAAyB,GAAA;AAC7B,IAAA,IAAA,CAAK,WAAW,IAAK,CAAA,CAAA,aAAA,EAAgB,IAAK,CAAA,UAAA,CAAW,SAAS,CAAG,CAAA,CAAA,CAAA,CAAA;AACjE,IAAK,IAAA,CAAA,UAAA,CAAW,MAAM,qBAAqB,CAAA,CAAA;AAC3C,IAAA,IAAA,CAAK,eAAe,gBAAiB,EAAA,CAAA;AAAA,GACzC;AACJ;;;;"} \ No newline at end of file diff --git a/dist/tools/libs/tools.mjs b/dist/tools/libs/tools.mjs index 6c7c9b22f..6e6eaa0e6 100644 --- a/dist/tools/libs/tools.mjs +++ b/dist/tools/libs/tools.mjs @@ -198,7 +198,7 @@ class SettingsProvider { } } -const keysFn = Object.keys; +const keysOf = Object.keys; -export { DotnetTool as D, SettingsProvider as S, keysFn as k }; +export { DotnetTool as D, SettingsProvider as S, keysOf as k }; //# sourceMappingURL=tools.mjs.map diff --git a/dist/tools/libs/tools.mjs.map b/dist/tools/libs/tools.mjs.map index 12414accc..cbca0a425 100644 --- a/dist/tools/libs/tools.mjs.map +++ b/dist/tools/libs/tools.mjs.map @@ -1 +1 @@ -{"version":3,"file":"tools.mjs","sources":["../../../src/tools/common/models.ts","../../../src/tools/common/dotnet-tool.ts","../../../src/tools/common/settings.ts","../../../src/tools/common/index.ts"],"sourcesContent":["export enum SetupFields {\n includePrerelease = 'includePrerelease',\n versionSpec = 'versionSpec',\n ignoreFailedSources = 'ignoreFailedSources',\n preferLatestVersion = 'preferLatestVersion'\n}\n\nexport type SetupSettings = {\n [SetupFields.versionSpec]: string\n [SetupFields.includePrerelease]: boolean\n [SetupFields.ignoreFailedSources]: boolean\n [SetupFields.preferLatestVersion]: boolean\n}\n\nexport type IRunner = {\n run(command: string): Promise\n}\n\nexport type NugetVersions = { data: { versions: { version: string }[] }[] }\n","import * as crypto from 'node:crypto'\nimport * as fs from 'node:fs/promises'\nimport * as os from 'node:os'\nimport * as path from 'node:path'\n\nimport * as semver from 'semver'\nimport { type IBuildAgent, type ExecResult } from '@agents/common'\nimport { ISettingsProvider } from './settings'\nimport { NugetVersions } from './models'\n\nexport interface IDotnetTool {\n disableTelemetry(): void\n\n install(): Promise\n}\n\nexport abstract class DotnetTool implements IDotnetTool {\n private static readonly nugetRoot: string = 'https://azuresearch-usnc.nuget.org/query'\n\n constructor(protected buildAgent: IBuildAgent) {}\n\n abstract get packageName(): string\n\n abstract get toolName(): string\n\n abstract get toolPathVariable(): string\n\n abstract get versionRange(): string | null\n\n abstract get settingsProvider(): ISettingsProvider\n\n disableTelemetry(): void {\n this.buildAgent.info('Disable Telemetry')\n this.buildAgent.setVariable('DOTNET_CLI_TELEMETRY_OPTOUT', 'true')\n this.buildAgent.setVariable('DOTNET_NOLOGO', 'true')\n }\n\n async install(): Promise {\n const dotnetExePath = await this.buildAgent.which('dotnet', true)\n this.buildAgent.debug(`whichPath: ${dotnetExePath}`)\n await this.setDotnetRoot()\n\n const setupSettings = this.settingsProvider.getSetupSettings()\n\n let version: string | null = semver.clean(setupSettings.versionSpec) || setupSettings.versionSpec\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`Acquiring ${this.packageName} for version spec: ${version}`)\n this.buildAgent.info('--------------------------')\n\n if (!this.isExplicitVersion(version)) {\n version = await this.queryLatestMatch(this.packageName, version, setupSettings.includePrerelease)\n if (!version) {\n throw new Error(`Unable to find ${this.packageName} version '${version}'.`)\n }\n }\n\n if (this.versionRange && !semver.satisfies(version, this.versionRange, { includePrerelease: setupSettings.includePrerelease })) {\n throw new Error(\n `Version spec '${setupSettings.versionSpec}' resolved as '${version}' does not satisfy the range '${this.versionRange}'.` +\n 'See https://github.com/GitTools/actions/blob/main/docs/versions.md for more information.'\n )\n }\n\n let toolPath: string | null = null\n if (!setupSettings.preferLatestVersion) {\n // Let's try and resolve the version locally first\n toolPath = await this.buildAgent.findLocalTool(this.packageName, version)\n if (toolPath) {\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`${this.packageName} version: ${version} found in local cache at ${toolPath}.`)\n this.buildAgent.info('--------------------------')\n }\n }\n\n if (!toolPath) {\n // Download, extract, cache\n toolPath = await this.installTool(this.packageName, version, setupSettings.ignoreFailedSources)\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`${this.packageName} version: ${version} installed.`)\n this.buildAgent.info('--------------------------')\n }\n\n // Prepend the tool's path. This prepends the PATH for the current process and\n // instructs the agent to prepend for each task that follows.\n this.buildAgent.info(`Prepending ${toolPath} to PATH`)\n this.buildAgent.addPath(toolPath)\n\n return toolPath\n }\n\n protected async execute(cmd: string, args: string[]): Promise {\n this.buildAgent.info(`Command: ${cmd} ${args.join(' ')}`)\n return await this.buildAgent.exec(cmd, args)\n }\n\n protected async setDotnetRoot(): Promise {\n if (os.platform() !== 'win32' && !this.buildAgent.getVariable('DOTNET_ROOT')) {\n let dotnetPath = await this.buildAgent.which('dotnet', true)\n\n const stats = await fs.lstat(dotnetPath)\n if (stats.isSymbolicLink()) {\n dotnetPath = (await fs.readlink(dotnetPath)) || dotnetPath\n }\n const dotnetRoot = path.dirname(dotnetPath)\n this.buildAgent.setVariable('DOTNET_ROOT', dotnetRoot)\n }\n }\n\n protected async executeTool(args: string[]): Promise {\n let toolPath: string | undefined\n const gitVersionPath = this.buildAgent.getVariableAsPath(this.toolPathVariable)\n if (gitVersionPath) {\n toolPath = path.join(gitVersionPath, os.platform() === 'win32' ? `${this.toolName}.exe` : this.toolName)\n }\n if (!toolPath) {\n toolPath = await this.buildAgent.which(this.toolName, true)\n }\n return await this.execute(toolPath, args)\n }\n\n protected async isValidInputFile(input: string, file: string): Promise {\n return this.filePathSupplied(input) && (await this.buildAgent.fileExists(file))\n }\n\n protected filePathSupplied(file: string): boolean {\n const pathValue = path.resolve(this.buildAgent.getInput(file) || '')\n const repoRoot = this.buildAgent.sourceDir\n return pathValue !== repoRoot\n }\n\n protected async getRepoPath(targetPath: string): Promise {\n const srcDir = this.buildAgent.sourceDir || '.'\n let workDir: string\n if (!targetPath) {\n workDir = srcDir\n } else {\n if (await this.buildAgent.directoryExists(targetPath)) {\n workDir = targetPath\n } else {\n throw new Error(`Directory not found at ${targetPath}`)\n }\n }\n return workDir.replace(/\\\\/g, '/')\n }\n\n private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise {\n this.buildAgent.info(\n `Querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ''} ${includePrerelease ? 'including pre-releases' : ''}`\n )\n\n const toolNameParam = encodeURIComponent(toolName.toLowerCase())\n const prereleaseParam = includePrerelease ? 'true' : 'false'\n const downloadPath = `${DotnetTool.nugetRoot}?q=${toolNameParam}&prerelease=${prereleaseParam}&semVerLevel=2.0.0&take=1`\n\n const response = await fetch(downloadPath)\n\n if (!response || !response.ok) {\n this.buildAgent.info(`failed to query latest version for ${toolName} from ${downloadPath}. Status code: ${response ? response.status : 'unknown'}`)\n return null\n }\n\n const { data } = (await response.json()) as NugetVersions\n\n const versions = data[0].versions.map(x => x.version)\n if (!versions || !versions.length) {\n return null\n }\n\n this.buildAgent.debug(`got versions: ${versions.join(', ')}`)\n\n const version = semver.maxSatisfying(versions, versionSpec, { includePrerelease })\n if (version) {\n this.buildAgent.info(`Found matching version: ${version}`)\n } else {\n this.buildAgent.info('match not found')\n }\n\n return version\n }\n\n private async installTool(toolName: string, version: string, ignoreFailedSources: boolean): Promise {\n const semverVersion = semver.clean(version)\n if (!semverVersion) {\n throw new Error(`Invalid version spec: ${version}`)\n }\n\n const tempDirectory = await this.createTempDirectory()\n\n if (!tempDirectory) {\n throw new Error('Unable to create temp directory')\n }\n\n const args = ['tool', 'install', toolName, '--tool-path', tempDirectory, '--version', semverVersion]\n if (ignoreFailedSources) {\n args.push('--ignore-failed-sources')\n }\n\n const result = await this.execute('dotnet', args)\n const status = result.code === 0 ? 'success' : 'failure'\n const message = result.code === 0 ? result.stdout : result.stderr\n\n this.buildAgent.debug(`Tool install result: ${status} ${message}`)\n\n if (result.code !== 0) {\n throw new Error(message)\n }\n\n const toolPath = await this.buildAgent.cacheToolDirectory(tempDirectory, toolName, semverVersion)\n this.buildAgent.debug(`Cached tool path: ${toolPath}`)\n this.buildAgent.debug(`Cleaning up temp directory: ${tempDirectory}`)\n await this.buildAgent.removeDirectory(tempDirectory)\n\n return toolPath\n }\n\n async createTempDirectory(): Promise {\n const tempRootDir = this.buildAgent.tempDir\n if (!tempRootDir) {\n throw new Error('Temp directory not set')\n }\n\n const uuid = crypto.randomUUID()\n const tempPath = path.join(tempRootDir, uuid)\n this.buildAgent.debug(`Creating temp directory ${tempPath}`)\n await fs.mkdir(tempPath, { recursive: true })\n return tempPath\n }\n\n private isExplicitVersion(versionSpec: string): boolean {\n const cleanedVersionSpec = semver.clean(versionSpec)\n const valid = semver.valid(cleanedVersionSpec) != null\n this.buildAgent.debug(`Is version explicit? ${valid}`)\n\n return valid\n }\n}\n","import { type IBuildAgent } from '@agents/common'\nimport { type SetupSettings, SetupFields } from './models'\n\nexport interface ISettingsProvider {\n getSetupSettings(): SetupSettings\n}\n\nexport class SettingsProvider implements ISettingsProvider {\n constructor(protected buildAgent: IBuildAgent) {}\n\n getSetupSettings(): SetupSettings {\n const versionSpec = this.buildAgent.getInput(SetupFields.versionSpec)\n const includePrerelease = this.buildAgent.getBooleanInput(SetupFields.includePrerelease)\n const ignoreFailedSources = this.buildAgent.getBooleanInput(SetupFields.ignoreFailedSources)\n const preferLatestVersion = this.buildAgent.getBooleanInput(SetupFields.preferLatestVersion)\n\n return {\n versionSpec,\n includePrerelease,\n ignoreFailedSources,\n preferLatestVersion\n }\n }\n}\n","export * from './models'\nexport * from './dotnet-tool'\nexport * from './settings'\n\nexport const keysFn = Object.keys as (obj: T) => (keyof T)[]\n"],"names":["SetupFields","semver.clean","semver.satisfies","semver.maxSatisfying","semver.valid"],"mappings":";;;;;;AAAY,IAAA,WAAA,qBAAAA,YAAL,KAAA;AACH,EAAAA,aAAA,mBAAoB,CAAA,GAAA,mBAAA,CAAA;AACpB,EAAAA,aAAA,aAAc,CAAA,GAAA,aAAA,CAAA;AACd,EAAAA,aAAA,qBAAsB,CAAA,GAAA,qBAAA,CAAA;AACtB,EAAAA,aAAA,qBAAsB,CAAA,GAAA,qBAAA,CAAA;AAJd,EAAAA,OAAAA,YAAAA,CAAAA;AAAA,CAAA,EAAA,WAAA,IAAA,EAAA,CAAA;;ACgBL,MAAe,UAAkC,CAAA;AAAA,EAGpD,YAAsB,UAAyB,EAAA;AAAzB,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAA0B;AAAA,EAFhD,OAAwB,SAAoB,GAAA,0CAAA,CAAA;AAAA,EAc5C,gBAAyB,GAAA;AACrB,IAAK,IAAA,CAAA,UAAA,CAAW,KAAK,mBAAmB,CAAA,CAAA;AACxC,IAAK,IAAA,CAAA,UAAA,CAAW,WAAY,CAAA,6BAAA,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mB,CAAA,CAAA;AAE3F,IAAO,OAAA;AAAA,MACH,WAAA;AAAA,MACA,iBAAA;AAAA,MACA,mBAAA;AAAA,MACA,mBAAA;AAAA,KACJ,CAAA;AAAA,GACJ;AACJ;;ACnBO,MAAM,SAAS,MAAO,CAAA;;;;"} \ No newline at end of file +{"version":3,"file":"tools.mjs","sources":["../../../src/tools/common/models.ts","../../../src/tools/common/dotnet-tool.ts","../../../src/tools/common/settings.ts","../../../src/tools/common/index.ts"],"sourcesContent":["import { type ExecResult } from '@agents/common'\n\nexport enum SetupFields {\n includePrerelease = 'includePrerelease',\n versionSpec = 'versionSpec',\n ignoreFailedSources = 'ignoreFailedSources',\n preferLatestVersion = 'preferLatestVersion'\n}\n\nexport type SetupSettings = {\n [SetupFields.versionSpec]: string\n [SetupFields.includePrerelease]: boolean\n [SetupFields.ignoreFailedSources]: boolean\n [SetupFields.preferLatestVersion]: boolean\n}\n\nexport type IRunner = {\n run(command: string): Promise\n}\n\nexport type NugetVersions = { data: { versions: { version: string }[] }[] }\n","import * as crypto from 'node:crypto'\nimport * as fs from 'node:fs/promises'\nimport * as os from 'node:os'\nimport * as path from 'node:path'\n\nimport * as semver from 'semver'\nimport { type IBuildAgent, type ExecResult } from '@agents/common'\nimport { ISettingsProvider } from './settings'\nimport { NugetVersions } from './models'\n\nexport interface IDotnetTool {\n disableTelemetry(): void\n\n install(): Promise\n}\n\nexport abstract class DotnetTool implements IDotnetTool {\n private static readonly nugetRoot: string = 'https://azuresearch-usnc.nuget.org/query'\n\n constructor(protected buildAgent: IBuildAgent) {}\n\n abstract get packageName(): string\n\n abstract get toolName(): string\n\n abstract get toolPathVariable(): string\n\n abstract get versionRange(): string | null\n\n abstract get settingsProvider(): ISettingsProvider\n\n disableTelemetry(): void {\n this.buildAgent.info('Disable Telemetry')\n this.buildAgent.setVariable('DOTNET_CLI_TELEMETRY_OPTOUT', 'true')\n this.buildAgent.setVariable('DOTNET_NOLOGO', 'true')\n }\n\n async install(): Promise {\n const dotnetExePath = await this.buildAgent.which('dotnet', true)\n this.buildAgent.debug(`whichPath: ${dotnetExePath}`)\n await this.setDotnetRoot()\n\n const setupSettings = this.settingsProvider.getSetupSettings()\n\n let version: string | null = semver.clean(setupSettings.versionSpec) || setupSettings.versionSpec\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`Acquiring ${this.packageName} for version spec: ${version}`)\n this.buildAgent.info('--------------------------')\n\n if (!this.isExplicitVersion(version)) {\n version = await this.queryLatestMatch(this.packageName, version, setupSettings.includePrerelease)\n if (!version) {\n throw new Error(`Unable to find ${this.packageName} version '${version}'.`)\n }\n }\n\n if (this.versionRange && !semver.satisfies(version, this.versionRange, { includePrerelease: setupSettings.includePrerelease })) {\n throw new Error(\n `Version spec '${setupSettings.versionSpec}' resolved as '${version}' does not satisfy the range '${this.versionRange}'.` +\n 'See https://github.com/GitTools/actions/blob/main/docs/versions.md for more information.'\n )\n }\n\n let toolPath: string | null = null\n if (!setupSettings.preferLatestVersion) {\n // Let's try and resolve the version locally first\n toolPath = await this.buildAgent.findLocalTool(this.packageName, version)\n if (toolPath) {\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`${this.packageName} version: ${version} found in local cache at ${toolPath}.`)\n this.buildAgent.info('--------------------------')\n }\n }\n\n if (!toolPath) {\n // Download, extract, cache\n toolPath = await this.installTool(this.packageName, version, setupSettings.ignoreFailedSources)\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`${this.packageName} version: ${version} installed.`)\n this.buildAgent.info('--------------------------')\n }\n\n // Prepend the tool's path. This prepends the PATH for the current process and\n // instructs the agent to prepend for each task that follows.\n this.buildAgent.info(`Prepending ${toolPath} to PATH`)\n this.buildAgent.addPath(toolPath)\n\n return toolPath\n }\n\n protected async execute(cmd: string, args: string[]): Promise {\n this.buildAgent.info(`Command: ${cmd} ${args.join(' ')}`)\n return await this.buildAgent.exec(cmd, args)\n }\n\n protected async setDotnetRoot(): Promise {\n if (os.platform() !== 'win32' && !this.buildAgent.getVariable('DOTNET_ROOT')) {\n let dotnetPath = await this.buildAgent.which('dotnet', true)\n\n const stats = await fs.lstat(dotnetPath)\n if (stats.isSymbolicLink()) {\n dotnetPath = (await fs.readlink(dotnetPath)) || dotnetPath\n }\n const dotnetRoot = path.dirname(dotnetPath)\n this.buildAgent.setVariable('DOTNET_ROOT', dotnetRoot)\n }\n }\n\n protected async executeTool(args: string[]): Promise {\n let toolPath: string | undefined\n const gitVersionPath = this.buildAgent.getVariableAsPath(this.toolPathVariable)\n if (gitVersionPath) {\n toolPath = path.join(gitVersionPath, os.platform() === 'win32' ? `${this.toolName}.exe` : this.toolName)\n }\n if (!toolPath) {\n toolPath = await this.buildAgent.which(this.toolName, true)\n }\n return await this.execute(toolPath, args)\n }\n\n protected async isValidInputFile(input: string, file: string): Promise {\n return this.filePathSupplied(input) && (await this.buildAgent.fileExists(file))\n }\n\n protected filePathSupplied(file: string): boolean {\n const pathValue = path.resolve(this.buildAgent.getInput(file) || '')\n const repoRoot = this.buildAgent.sourceDir\n return pathValue !== repoRoot\n }\n\n protected async getRepoPath(targetPath: string): Promise {\n const srcDir = this.buildAgent.sourceDir || '.'\n let workDir: string\n if (!targetPath) {\n workDir = srcDir\n } else {\n if (await this.buildAgent.directoryExists(targetPath)) {\n workDir = targetPath\n } else {\n throw new Error(`Directory not found at ${targetPath}`)\n }\n }\n return workDir.replace(/\\\\/g, '/')\n }\n\n private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise {\n this.buildAgent.info(\n `Querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ''} ${includePrerelease ? 'including pre-releases' : ''}`\n )\n\n const toolNameParam = encodeURIComponent(toolName.toLowerCase())\n const prereleaseParam = includePrerelease ? 'true' : 'false'\n const downloadPath = `${DotnetTool.nugetRoot}?q=${toolNameParam}&prerelease=${prereleaseParam}&semVerLevel=2.0.0&take=1`\n\n const response = await fetch(downloadPath)\n\n if (!response || !response.ok) {\n this.buildAgent.info(`failed to query latest version for ${toolName} from ${downloadPath}. Status code: ${response ? response.status : 'unknown'}`)\n return null\n }\n\n const { data } = (await response.json()) as NugetVersions\n\n const versions = data[0].versions.map(x => x.version)\n if (!versions || !versions.length) {\n return null\n }\n\n this.buildAgent.debug(`got versions: ${versions.join(', ')}`)\n\n const version = semver.maxSatisfying(versions, versionSpec, { includePrerelease })\n if (version) {\n this.buildAgent.info(`Found matching version: ${version}`)\n } else {\n this.buildAgent.info('match not found')\n }\n\n return version\n }\n\n private async installTool(toolName: string, version: string, ignoreFailedSources: boolean): Promise {\n const semverVersion = semver.clean(version)\n if (!semverVersion) {\n throw new Error(`Invalid version spec: ${version}`)\n }\n\n const tempDirectory = await this.createTempDirectory()\n\n if (!tempDirectory) {\n throw new Error('Unable to create temp directory')\n }\n\n const args = ['tool', 'install', toolName, '--tool-path', tempDirectory, '--version', semverVersion]\n if (ignoreFailedSources) {\n args.push('--ignore-failed-sources')\n }\n\n const result = await this.execute('dotnet', args)\n const status = result.code === 0 ? 'success' : 'failure'\n const message = result.code === 0 ? result.stdout : result.stderr\n\n this.buildAgent.debug(`Tool install result: ${status} ${message}`)\n\n if (result.code !== 0) {\n throw new Error(message)\n }\n\n const toolPath = await this.buildAgent.cacheToolDirectory(tempDirectory, toolName, semverVersion)\n this.buildAgent.debug(`Cached tool path: ${toolPath}`)\n this.buildAgent.debug(`Cleaning up temp directory: ${tempDirectory}`)\n await this.buildAgent.removeDirectory(tempDirectory)\n\n return toolPath\n }\n\n async createTempDirectory(): Promise {\n const tempRootDir = this.buildAgent.tempDir\n if (!tempRootDir) {\n throw new Error('Temp directory not set')\n }\n\n const uuid = crypto.randomUUID()\n const tempPath = path.join(tempRootDir, uuid)\n this.buildAgent.debug(`Creating temp directory ${tempPath}`)\n await fs.mkdir(tempPath, { recursive: true })\n return tempPath\n }\n\n private isExplicitVersion(versionSpec: string): boolean {\n const cleanedVersionSpec = semver.clean(versionSpec)\n const valid = semver.valid(cleanedVersionSpec) != null\n this.buildAgent.debug(`Is version explicit? ${valid}`)\n\n return valid\n }\n}\n","import { type IBuildAgent } from '@agents/common'\nimport { type SetupSettings, SetupFields } from './models'\n\nexport interface ISettingsProvider {\n getSetupSettings(): SetupSettings\n}\n\nexport class SettingsProvider implements ISettingsProvider {\n constructor(protected buildAgent: IBuildAgent) {}\n\n getSetupSettings(): SetupSettings {\n const versionSpec = this.buildAgent.getInput(SetupFields.versionSpec)\n const includePrerelease = this.buildAgent.getBooleanInput(SetupFields.includePrerelease)\n const ignoreFailedSources = this.buildAgent.getBooleanInput(SetupFields.ignoreFailedSources)\n const preferLatestVersion = this.buildAgent.getBooleanInput(SetupFields.preferLatestVersion)\n\n return {\n versionSpec,\n includePrerelease,\n ignoreFailedSources,\n preferLatestVersion\n }\n }\n}\n","export * from './models'\nexport * from './dotnet-tool'\nexport * from './settings'\n\nexport const keysOf = Object.keys as (obj: T) => (keyof T)[]\n"],"names":["SetupFields","semver.clean","semver.satisfies","semver.maxSatisfying","semver.valid"],"mappings":";;;;;;AAEY,IAAA,WAAA,qBAAAA,YAAL,KAAA;AACH,EAAAA,aAAA,mBAAoB,CAAA,GAAA,mBAAA,CAAA;AACpB,EAAAA,aAAA,aAAc,CAAA,GAAA,aAAA,CAAA;AACd,EAAAA,aAAA,qBAAsB,CAAA,GAAA,qBAAA,CAAA;AACtB,EAAAA,aAAA,qBAAsB,CAAA,GAAA,qBAAA,CAAA;AAJd,EAAAA,OAAAA,YAAAA,CAAAA;AAAA,CAAA,EAAA,WAAA,IAAA,EAAA,CAAA;;ACcL,MAAe,UAAkC,CAAA;AAAA,EAGpD,YAAsB,UAAyB,EAAA;AAAzB,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAA0B;AAAA,EAFhD,OAAwB,SAAoB,GAAA,0CAAA,CAAA;AAAA,EAc5C,gBAAyB,GAAA;AACrB,IAAK,IAAA,CAAA,UAAA,CAAW,KAAK,mBAAmB,CAAA,CAAA;AACxC,IAAK,IAAA,CAAA,UAAA,C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eAAA,CAAgB,YAAY,mBAAmB,CAAA,CAAA;AAE3F,IAAO,OAAA;AAAA,MACH,WAAA;AAAA,MACA,iBAAA;AAAA,MACA,mBAAA;AAAA,MACA,mBAAA;AAAA,KACJ,CAAA;AAAA,GACJ;AACJ;;ACnBO,MAAM,SAAS,MAAO,CAAA;;;;"} \ No newline at end of file diff --git a/docs/examples/azure/gitversion/execute.md b/docs/examples/azure/gitversion/execute.md index e476ad885..83702b733 100644 --- a/docs/examples/azure/gitversion/execute.md +++ b/docs/examples/azure/gitversion/execute.md @@ -130,12 +130,12 @@ steps:
Calculate the version for the build using a config file with the default name GitVersion.yml. - + ```yaml steps: # gitversion/setup@2.0.1 task omitted for brevity. -- task: gitversion/execute@2.0.1 + - task: gitversion/execute@2.0.1 displayName: Determine Version inputs: useConfigFile: true diff --git a/docs/examples/azure/gitversion/index.md b/docs/examples/azure/gitversion/index.md index ab13dcbb4..a800b31d6 100644 --- a/docs/examples/azure/gitversion/index.md +++ b/docs/examples/azure/gitversion/index.md @@ -6,8 +6,8 @@ Note: You need to run the Setup step before the Execute step, otherwise the Exec ## Setup GitVersion (gitversion/setup) -- [Usage examples](setup.md) +- [Setup](setup.md) ## Execute GitVersion (gitversion/execute) -- [Usage examples](execute.md) +- [Execute](execute.md) diff --git a/docs/examples/github/gitversion/index.md b/docs/examples/github/gitversion/index.md index b60f74465..00140a6f6 100644 --- a/docs/examples/github/gitversion/index.md +++ b/docs/examples/github/gitversion/index.md @@ -6,8 +6,8 @@ Note: You need to run the Setup step before the Execute step, otherwise the Exec ## Setup GitVersion (gitversion/setup) -- [Usage examples](setup.md) +- [Setup](setup.md) ## Execute GitVersion (gitversion/execute) -- [Usage examples](execute.md) +- [Execute](execute.md) diff --git a/gitreleasemanager/setup/action.yml b/gitreleasemanager/setup/action.yml index 5bedfa6a8..2e875ff91 100644 --- a/gitreleasemanager/setup/action.yml +++ b/gitreleasemanager/setup/action.yml @@ -9,7 +9,7 @@ runs: main: main.mjs inputs: versionSpec: - description: Required version in the form of 0.17.x or exact version like 0.17.0 + description: Required version in the form of 0.18.x or exact version like 0.18.0 required: true default: '' includePrerelease: diff --git a/src/__tests__/tools/common/settings.spec.ts b/src/__tests__/tools/common/settings.spec.ts index da0dc4dcf..7272c6581 100644 --- a/src/__tests__/tools/common/settings.spec.ts +++ b/src/__tests__/tools/common/settings.spec.ts @@ -1,15 +1,16 @@ -import { describe, expect, it } from 'vitest' +import { describe, it } from 'vitest' import { IBuildAgent } from '@agents/common' import { SettingsProvider, type SetupSettings } from '@tools/common' +import { expectValidSettings } from './utils' describe('SettingsProvider', () => { it('should return SetupSettings', () => { - const settings = { + const settings: SetupSettings = { versionSpec: '6.x', includePrerelease: false, ignoreFailedSources: true, preferLatestVersion: false - } as SetupSettings + } const buildAgent = { getInput: (input: keyof SetupSettings) => settings[input] as string, @@ -20,9 +21,6 @@ describe('SettingsProvider', () => { const setupSettings = settingsProvider.getSetupSettings() - expect(setupSettings.versionSpec).toBe(settings.versionSpec) - expect(setupSettings.includePrerelease).toBe(settings.includePrerelease) - expect(setupSettings.ignoreFailedSources).toBe(settings.ignoreFailedSources) - expect(setupSettings.preferLatestVersion).toBe(settings.preferLatestVersion) + expectValidSettings(settings, setupSettings) }) }) diff --git a/src/__tests__/tools/common/utils.ts b/src/__tests__/tools/common/utils.ts new file mode 100644 index 000000000..f33f98ae3 --- /dev/null +++ b/src/__tests__/tools/common/utils.ts @@ -0,0 +1,35 @@ +import process from 'node:process' +import { expect } from 'vitest' +import { keysOf } from '@tools/common' +import { IBuildAgent } from '@agents/common' + +export function setEnv(key: string, value: string): void { + process.env[key.toUpperCase()] = value +} + +export function getEnv(key: string): string { + return process.env[key] || '' +} + +export function resetEnv(agent: IBuildAgent, toolPathVariable: string): void { + const envName = process.platform === 'win32' ? 'Path' : 'PATH' + process.env.PATH = process.env[envName] // workaround for windows + setEnv(toolPathVariable, '') + setEnv(agent.sourceDirVariable, '') + setEnv(agent.tempDirVariable, '') + setEnv(agent.cacheDirVariable, '') + + setInputs({}) +} + +export function setInputs(inputs: Partial): void { + for (const property of keysOf(inputs)) { + setEnv(`INPUT_${property as string}`, inputs[property]?.toString() || '') + } +} + +export const expectValidSettings = (expectedSettings: T, actualSettings: T): void => { + for (const key of keysOf(expectedSettings)) { + expect(actualSettings[key]).toBe(expectedSettings[key]) + } +} diff --git a/src/__tests__/tools/gitreleasemanager/runner.spec.ts b/src/__tests__/tools/gitreleasemanager/runner.spec.ts index d25f499e8..2fc8506a8 100644 --- a/src/__tests__/tools/gitreleasemanager/runner.spec.ts +++ b/src/__tests__/tools/gitreleasemanager/runner.spec.ts @@ -1,4 +1,3 @@ -import * as process from 'node:process' import * as path from 'node:path' import * as fs from 'node:fs' @@ -8,66 +7,44 @@ import { Runner } from '@tools/gitreleasemanager' import { BuildAgent as AzurePipelinesAgent } from '@agents/azure' import { BuildAgent as LocalBuildAgent } from '@agents/local' import { BuildAgent as GitHubActionsAgent } from '@agents/github' -import { keysFn, type SetupSettings } from '@tools/common' +import { getEnv, resetEnv, setEnv, setInputs } from '../common/utils' describe('GitReleaseManager Runner', () => { const baseDir = path.resolve(__dirname, '../../../../.test') - const envName = process.platform === 'win32' ? 'Path' : 'PATH' - const version = '0.17.0' + const version = '0.18.0' const toolPath = path.resolve(baseDir, 'tools', 'GitReleaseManager.Tool', version) const toolPathVariable = 'GITRELEASEMANAGER_PATH' const toolName = 'dotnet-gitreleasemanager' - function setEnv(key: string, value: string): void { - process.env[key.toUpperCase()] = value - } - - function getEnv(key: string): string { - return process.env[key] || '' - } - - function setInputs(inputs: Partial): void { - const keys = keysFn>(inputs) - for (const property of keys) { - setEnv(`INPUT_${property}`, inputs[property]?.toString() || '') - } - } - function testOnAgent(agent: IBuildAgent): void { - function resetEnv(): void { - process.env.PATH = process.env[envName] // workaround for windows - setEnv(toolPathVariable, '') - setEnv(agent.sourceDirVariable, '') - setEnv(agent.tempDirVariable, '') - setEnv(agent.cacheDirVariable, '') - - setInputs({}) - } - let runner!: Runner beforeEach(() => { runner = new Runner(agent) - resetEnv() + resetEnv(agent, toolPathVariable) setEnv(agent.sourceDirVariable, path.resolve(baseDir)) setEnv(agent.tempDirVariable, path.resolve(baseDir, 'temp')) setEnv(agent.cacheDirVariable, path.resolve(baseDir, 'tools')) }) afterEach(() => { - resetEnv() + resetEnv(agent, toolPathVariable) }) it.sequential('should run setup GitReleaseManager', async () => { setInputs({ - versionSpec: '0.17.x', + versionSpec: '0.18.x', includePrerelease: false, ignoreFailedSources: false, preferLatestVersion: false }) - const exitCode = await runner.run('setup') + const result = await runner.run('setup') + + expect(result.code).toBe(0) + expect(result.error).toBeUndefined() + expect(result.stdout).toBeUndefined() + expect(result.stderr).toBeUndefined() - expect(exitCode).toBe(0) expect(fs.existsSync(path.resolve(baseDir))).toBe(true) expect(fs.existsSync(path.resolve(baseDir, 'tools'))).toBe(true) expect(fs.existsSync(toolPath)).toBe(true) diff --git a/src/__tests__/tools/gitreleasemanager/settings.spec.ts b/src/__tests__/tools/gitreleasemanager/settings.spec.ts index 126955020..e21d7b686 100644 --- a/src/__tests__/tools/gitreleasemanager/settings.spec.ts +++ b/src/__tests__/tools/gitreleasemanager/settings.spec.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from 'vitest' +import { describe, it } from 'vitest' import { IBuildAgent } from '@agents/common' import { type GitReleaseManagerCloseSettings, @@ -9,10 +9,11 @@ import { type GitReleaseManagerAddAssetSettings, GitReleaseManagerSettingsProvider } from '@tools/gitreleasemanager' +import { expectValidSettings } from '../common/utils' describe('GitReleaseManager settings', () => { it('should return GitReleaseManagerCreateSettings', () => { - const settings = { + const settings: GitReleaseManagerCreateSettings = { repository: 'repo', owner: 'owner', token: 'token', @@ -23,7 +24,7 @@ describe('GitReleaseManager settings', () => { isPreRelease: false, commit: 'commit', assets: ['asset'] - } as GitReleaseManagerCreateSettings + } const buildAgent = { getInput: (input: keyof GitReleaseManagerCreateSettings) => settings[input] as string, @@ -35,26 +36,17 @@ describe('GitReleaseManager settings', () => { const createSettings = settingsProvider.getCreateSettings() - expect(createSettings.repository).toBe(settings.repository) - expect(createSettings.owner).toBe(settings.owner) - expect(createSettings.token).toBe(settings.token) - expect(createSettings.targetDirectory).toBe(settings.targetDirectory) - expect(createSettings.milestone).toBe(settings.milestone) - expect(createSettings.name).toBe(settings.name) - expect(createSettings.inputFileName).toBe(settings.inputFileName) - expect(createSettings.isPreRelease).toBe(settings.isPreRelease) - expect(createSettings.commit).toBe(settings.commit) - expect(createSettings.assets).toBe(settings.assets) + expectValidSettings(settings, createSettings) }) it('should return GitReleaseManagerOpenSettings', () => { - const settings = { + const settings: GitReleaseManagerOpenSettings = { repository: 'repo', owner: 'owner', token: 'token', targetDirectory: 'path', milestone: 'milestone' - } as GitReleaseManagerOpenSettings + } const buildAgent = { getInput: (input: keyof GitReleaseManagerOpenSettings) => settings[input] @@ -64,21 +56,17 @@ describe('GitReleaseManager settings', () => { const openSettings = settingsProvider.getOpenSettings() - expect(openSettings.repository).toBe(settings.repository) - expect(openSettings.owner).toBe(settings.owner) - expect(openSettings.token).toBe(settings.token) - expect(openSettings.targetDirectory).toBe(settings.targetDirectory) - expect(openSettings.milestone).toBe(settings.milestone) + expectValidSettings(settings, openSettings) }) it('should return GitReleaseManagerCloseSettings', () => { - const settings = { + const settings: GitReleaseManagerCloseSettings = { repository: 'repo', owner: 'owner', token: 'token', targetDirectory: 'path', milestone: 'milestone' - } as GitReleaseManagerCloseSettings + } const buildAgent = { getInput: (input: keyof GitReleaseManagerCloseSettings) => settings[input] @@ -88,21 +76,17 @@ describe('GitReleaseManager settings', () => { const closeSettings = settingsProvider.getCloseSettings() - expect(closeSettings.repository).toBe(settings.repository) - expect(closeSettings.owner).toBe(settings.owner) - expect(closeSettings.token).toBe(settings.token) - expect(closeSettings.targetDirectory).toBe(settings.targetDirectory) - expect(closeSettings.milestone).toBe(settings.milestone) + expectValidSettings(settings, closeSettings) }) it('should return GitReleaseManagerDiscardSettings', () => { - const settings = { + const settings: GitReleaseManagerDiscardSettings = { repository: 'repo', owner: 'owner', token: 'token', targetDirectory: 'path', milestone: 'milestone' - } as GitReleaseManagerDiscardSettings + } const buildAgent = { getInput: (input: keyof GitReleaseManagerDiscardSettings) => settings[input] @@ -112,21 +96,17 @@ describe('GitReleaseManager settings', () => { const discardSettings = settingsProvider.getDiscardSettings() - expect(discardSettings.repository).toBe(settings.repository) - expect(discardSettings.owner).toBe(settings.owner) - expect(discardSettings.token).toBe(settings.token) - expect(discardSettings.targetDirectory).toBe(settings.targetDirectory) - expect(discardSettings.milestone).toBe(settings.milestone) + expectValidSettings(settings, discardSettings) }) it('should return GitReleaseManagerPublishSettings', () => { - const settings = { + const settings: GitReleaseManagerPublishSettings = { repository: 'repo', owner: 'owner', token: 'token', targetDirectory: 'path', milestone: 'milestone' - } as GitReleaseManagerPublishSettings + } const buildAgent = { getInput: (input: keyof GitReleaseManagerPublishSettings) => settings[input] @@ -136,22 +116,18 @@ describe('GitReleaseManager settings', () => { const publishSettings = settingsProvider.getPublishSettings() - expect(publishSettings.repository).toBe(settings.repository) - expect(publishSettings.owner).toBe(settings.owner) - expect(publishSettings.token).toBe(settings.token) - expect(publishSettings.targetDirectory).toBe(settings.targetDirectory) - expect(publishSettings.milestone).toBe(settings.milestone) + expectValidSettings(settings, publishSettings) }) it('should return GitReleaseManagerAddAssetSettings', () => { - const settings = { + const settings: GitReleaseManagerAddAssetSettings = { repository: 'repo', owner: 'owner', token: 'token', targetDirectory: 'path', milestone: 'milestone', assets: ['asset'] - } as GitReleaseManagerAddAssetSettings + } const buildAgent = { getInput: (input: keyof GitReleaseManagerAddAssetSettings) => settings[input] as string, @@ -162,11 +138,6 @@ describe('GitReleaseManager settings', () => { const addAssetSettings = settingsProvider.getAddAssetSettings() - expect(addAssetSettings.repository).toBe(settings.repository) - expect(addAssetSettings.owner).toBe(settings.owner) - expect(addAssetSettings.token).toBe(settings.token) - expect(addAssetSettings.targetDirectory).toBe(settings.targetDirectory) - expect(addAssetSettings.milestone).toBe(settings.milestone) - expect(addAssetSettings.assets).toBe(settings.assets) + expectValidSettings(settings, addAssetSettings) }) }) diff --git a/src/__tests__/tools/gitreleasemanager/tool.spec.ts b/src/__tests__/tools/gitreleasemanager/tool.spec.ts index 5cbcc0ff6..5fbcf82f0 100644 --- a/src/__tests__/tools/gitreleasemanager/tool.spec.ts +++ b/src/__tests__/tools/gitreleasemanager/tool.spec.ts @@ -1,13 +1,13 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { IBuildAgent } from '@agents/common' import { - GitReleaseManagerAddAssetSettings, - GitReleaseManagerCloseSettings, - GitReleaseManagerCreateSettings, - GitReleaseManagerDiscardSettings, - GitReleaseManagerOpenSettings, - GitReleaseManagerPublishSettings, - GitReleaseManagerSettings, + type GitReleaseManagerAddAssetSettings, + type GitReleaseManagerCloseSettings, + type GitReleaseManagerCreateSettings, + type GitReleaseManagerDiscardSettings, + type GitReleaseManagerOpenSettings, + type GitReleaseManagerPublishSettings, + type GitReleaseManagerSettings, GitReleaseManagerTool } from '@tools/gitreleasemanager' import * as path from 'node:path' diff --git a/src/__tests__/tools/gitversion/runner.spec.ts b/src/__tests__/tools/gitversion/runner.spec.ts index eb218fe38..8beb1e83a 100644 --- a/src/__tests__/tools/gitversion/runner.spec.ts +++ b/src/__tests__/tools/gitversion/runner.spec.ts @@ -1,4 +1,3 @@ -import * as process from 'node:process' import * as path from 'node:path' import * as fs from 'node:fs' @@ -8,53 +7,27 @@ import { Runner } from '@tools/gitversion' import { BuildAgent as AzurePipelinesAgent } from '@agents/azure' import { BuildAgent as LocalBuildAgent } from '@agents/local' import { BuildAgent as GitHubActionsAgent } from '@agents/github' -import { keysFn, type SetupSettings } from '@tools/common' +import { getEnv, resetEnv, setEnv, setInputs } from '../common/utils' describe('GitVersion Runner', () => { const baseDir = path.resolve(__dirname, '../../../../.test') - const envName = process.platform === 'win32' ? 'Path' : 'PATH' const version = '6.0.0' const toolPath = path.resolve(baseDir, 'tools', 'GitVersion.Tool', version) const toolPathVariable = 'GITVERSION_PATH' const toolName = 'dotnet-gitversion' - function setEnv(key: string, value: string): void { - process.env[key.toUpperCase()] = value - } - - function getEnv(key: string): string { - return process.env[key] || '' - } - - function setInputs(inputs: Partial): void { - const keys = keysFn>(inputs) - for (const property of keys) { - setEnv(`INPUT_${property}`, inputs[property]?.toString() || '') - } - } - function testOnAgent(agent: IBuildAgent): void { - function resetEnv(): void { - process.env.PATH = process.env[envName] // workaround for windows - setEnv(toolPathVariable, '') - setEnv(agent.sourceDirVariable, '') - setEnv(agent.tempDirVariable, '') - setEnv(agent.cacheDirVariable, '') - - setInputs({}) - } - let runner!: Runner beforeEach(() => { runner = new Runner(agent) - resetEnv() + resetEnv(agent, toolPathVariable) setEnv(agent.sourceDirVariable, path.resolve(baseDir)) setEnv(agent.tempDirVariable, path.resolve(baseDir, 'temp')) setEnv(agent.cacheDirVariable, path.resolve(baseDir, 'tools')) }) afterEach(() => { - resetEnv() + resetEnv(agent, toolPathVariable) }) it.sequential('should run setup GitVersion', async () => { @@ -65,9 +38,13 @@ describe('GitVersion Runner', () => { preferLatestVersion: false }) - const exitCode = await runner.run('setup') + const result = await runner.run('setup') + + expect(result.code).toBe(0) + expect(result.error).toBeUndefined() + expect(result.stdout).toBeUndefined() + expect(result.stderr).toBeUndefined() - expect(exitCode).toBe(0) expect(fs.existsSync(path.resolve(baseDir))).toBe(true) expect(fs.existsSync(path.resolve(baseDir, 'tools'))).toBe(true) expect(fs.existsSync(toolPath)).toBe(true) @@ -81,9 +58,9 @@ describe('GitVersion Runner', () => { it.sequential('should execute GitVersion', async () => { setEnv(toolPathVariable, toolPath) - const exitCode = await runner.run('execute') + const result = await runner.run('execute') - expect(exitCode).toBe(0) + expect(result.code).toBe(0) expect(getEnv('GitVersion_Major')).toBeDefined() expect(getEnv('GitVersion_Minor')).toBeDefined() @@ -92,6 +69,9 @@ describe('GitVersion Runner', () => { expect(getEnv('major')).toBeDefined() expect(getEnv('minor')).toBeDefined() expect(getEnv('patch')).toBeDefined() + + expect(result.stdout).toContain('Executing GenerateSetVersionMessage') + expect(result.stdout).toContain('Executing GenerateBuildLogOutput') }) } diff --git a/src/__tests__/tools/gitversion/settings.spec.ts b/src/__tests__/tools/gitversion/settings.spec.ts index c7f618ac3..7f2fcdbda 100644 --- a/src/__tests__/tools/gitversion/settings.spec.ts +++ b/src/__tests__/tools/gitversion/settings.spec.ts @@ -1,10 +1,11 @@ -import { describe, expect, it } from 'vitest' +import { describe, it } from 'vitest' import { IBuildAgent } from '@agents/common' -import { type GitVersionSettings, GitVersionSettingsProvider } from '@tools/gitversion' +import { type GitVersionExecuteSettings, GitVersionSettingsProvider } from '@tools/gitversion' +import { expectValidSettings } from '../common/utils' describe('GitVersion settings', () => { - it('should return GitVersionSettings', () => { - const settings = { + it('should return GitVersionExecuteSettings', () => { + const settings: GitVersionExecuteSettings = { targetPath: 'path', disableCache: true, disableNormalization: true, @@ -14,29 +15,19 @@ describe('GitVersion settings', () => { overrideConfig: ['update-build-number=false'], updateAssemblyInfo: true, updateAssemblyInfoFilename: 'path', - additionalArguments: 'args', - srcDir: 'path' - } as GitVersionSettings + additionalArguments: 'args' + } const buildAgent = { - getInput: (input: keyof GitVersionSettings) => settings[input] as string, - getBooleanInput: (input: keyof GitVersionSettings) => settings[input] as boolean, - getListInput: (input: keyof GitVersionSettings) => settings[input] as string[] + getInput: (input: keyof GitVersionExecuteSettings) => settings[input] as string, + getBooleanInput: (input: keyof GitVersionExecuteSettings) => settings[input] as boolean, + getListInput: (input: keyof GitVersionExecuteSettings) => settings[input] as string[] } as IBuildAgent const settingsProvider = new GitVersionSettingsProvider(buildAgent) - const gitVersionSettings = settingsProvider.getGitVersionSettings() + const gitVersionExecuteSettings = settingsProvider.getGitVersionExecuteSettings() - expect(gitVersionSettings.targetPath).toBe(settings.targetPath) - expect(gitVersionSettings.disableCache).toBe(settings.disableCache) - expect(gitVersionSettings.disableNormalization).toBe(settings.disableNormalization) - expect(gitVersionSettings.disableShallowCloneCheck).toBe(settings.disableShallowCloneCheck) - expect(gitVersionSettings.useConfigFile).toBe(settings.useConfigFile) - expect(gitVersionSettings.configFilePath).toBe(settings.configFilePath) - expect(gitVersionSettings.overrideConfig).toBe(settings.overrideConfig) - expect(gitVersionSettings.updateAssemblyInfo).toBe(settings.updateAssemblyInfo) - expect(gitVersionSettings.updateAssemblyInfoFilename).toBe(settings.updateAssemblyInfoFilename) - expect(gitVersionSettings.additionalArguments).toBe(settings.additionalArguments) + expectValidSettings(settings, gitVersionExecuteSettings) }) }) diff --git a/src/__tests__/tools/gitversion/tool.spec.ts b/src/__tests__/tools/gitversion/tool.spec.ts index e784c4c08..3026d0187 100644 --- a/src/__tests__/tools/gitversion/tool.spec.ts +++ b/src/__tests__/tools/gitversion/tool.spec.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { IBuildAgent } from '@agents/common' -import { type GitVersionOutput, type GitVersionSettings, GitVersionTool } from '@tools/gitversion' +import { type GitVersionOutput, type GitVersionExecuteSettings, GitVersionTool } from '@tools/gitversion' class TestGitVersionTool extends GitVersionTool { private _isValidInputFile = false @@ -13,12 +13,12 @@ class TestGitVersionTool extends GitVersionTool { return Promise.resolve(this._isValidInputFile) } - async getRepoDir(settings: GitVersionSettings): Promise { + async getRepoDir(settings: GitVersionExecuteSettings): Promise { return super.getRepoDir(settings) } - async getArguments(workDir: string, options: GitVersionSettings): Promise { - return super.getArguments(workDir, options) + async getExecuteArguments(workDir: string, options: GitVersionExecuteSettings): Promise { + return super.getExecuteArguments(workDir, options) } } @@ -101,7 +101,7 @@ describe('GitVersionTool', () => { tool = new TestGitVersionTool(buildAgent) const repoDir = await tool.getRepoDir({ targetPath: '' - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(repoDir).toBe('workdir') }) @@ -112,7 +112,7 @@ describe('GitVersionTool', () => { tool = new TestGitVersionTool(buildAgent) const repoDir = await tool.getRepoDir({ targetPath: '' - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(repoDir).toBe('.') }) @@ -125,7 +125,7 @@ describe('GitVersionTool', () => { tool = new TestGitVersionTool(buildAgent) const repoDir = await tool.getRepoDir({ targetPath: 'targetDir' - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(repoDir).toBe('targetDir') }) @@ -140,37 +140,37 @@ describe('GitVersionTool', () => { await expect( tool.getRepoDir({ targetPath: wrongDir - } as GitVersionSettings) + } as GitVersionExecuteSettings) ).rejects.toThrowError(`Directory not found at ${wrongDir}`) }) }) - describe('getArguments', () => { + describe('getExecuteArguments', () => { it('should return correct arguments for empty settings', async () => { - const args = await tool.getArguments('workdir', {} as GitVersionSettings) + const args = await tool.getExecuteArguments('workdir', {} as GitVersionExecuteSettings) expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver']) }) it('should return correct arguments for settings with cache', async () => { - const args = await tool.getArguments('workdir', { + const args = await tool.getExecuteArguments('workdir', { disableCache: true - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '/nocache']) }) it('should return correct arguments for settings with normalization', async () => { - const args = await tool.getArguments('workdir', { + const args = await tool.getExecuteArguments('workdir', { disableNormalization: true - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '/nonormalize']) }) it('should return correct arguments for settings with config', async () => { tool.init(true) - const args = await tool.getArguments('workdir', { + const args = await tool.getExecuteArguments('workdir', { useConfigFile: true, configFilePath: 'workdir/GitVersion.yml' - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '/config', 'workdir/GitVersion.yml']) }) @@ -178,17 +178,17 @@ describe('GitVersionTool', () => { tool.init(false) const configFile = 'workdir/WrongConfig.yml' await expect( - tool.getArguments('workdir', { + tool.getExecuteArguments('workdir', { useConfigFile: true, configFilePath: configFile - } as GitVersionSettings) + } as GitVersionExecuteSettings) ).rejects.toThrowError(`GitVersion configuration file not found at ${configFile}`) }) it('should return correct arguments for settings with override config', async () => { - const args = await tool.getArguments('workdir', { + const args = await tool.getExecuteArguments('workdir', { overrideConfig: ['tag-prefix=release-', 'next-version=1.0.0'] - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(args).toEqual([ 'workdir', '/output', @@ -204,10 +204,10 @@ describe('GitVersionTool', () => { it('should return correct arguments for settings with assembly info', async () => { tool.init(true) - const args = await tool.getArguments('workdir', { + const args = await tool.getExecuteArguments('workdir', { updateAssemblyInfo: true, updateAssemblyInfoFilename: 'AssemblyInfo.cs' - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '/updateassemblyinfo', 'AssemblyInfo.cs']) }) @@ -215,21 +215,21 @@ describe('GitVersionTool', () => { tool.init(false) const assemblyInfoFile = 'WrongAssemblyInfo.cs' await expect( - tool.getArguments('workdir', { + tool.getExecuteArguments('workdir', { updateAssemblyInfo: true, updateAssemblyInfoFilename: assemblyInfoFile - } as GitVersionSettings) + } as GitVersionExecuteSettings) ).rejects.toThrowError(`AssemblyInfoFilename file not found at ${assemblyInfoFile}`) }) it('should return correct arguments for settings with config and assembly info', async () => { tool.init(true) - const args = await tool.getArguments('workdir', { + const args = await tool.getExecuteArguments('workdir', { useConfigFile: true, configFilePath: 'workdir/GitVersion.yml', updateAssemblyInfo: true, updateAssemblyInfoFilename: 'AssemblyInfo.cs' - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(args).toEqual([ 'workdir', '/output', @@ -244,9 +244,9 @@ describe('GitVersionTool', () => { }) it('should return correct arguments for settings with additional arguments', async () => { - const args = await tool.getArguments('workdir', { + const args = await tool.getExecuteArguments('workdir', { additionalArguments: '--some-arg --another-arg' - } as GitVersionSettings) + } as GitVersionExecuteSettings) expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '--some-arg', '--another-arg']) }) }) diff --git a/src/agents/common/models.ts b/src/agents/common/models.ts index c7292c909..0c0e6f308 100644 --- a/src/agents/common/models.ts +++ b/src/agents/common/models.ts @@ -1,6 +1,6 @@ export type ExecResult = { - stdout: string - stderr: string code: number - error?: Error | null + stdout?: string + stderr?: string + error?: Error | null | unknown } diff --git a/src/tools/common/index.ts b/src/tools/common/index.ts index 224a80d2d..26c10a8ce 100644 --- a/src/tools/common/index.ts +++ b/src/tools/common/index.ts @@ -2,4 +2,4 @@ export * from './models' export * from './dotnet-tool' export * from './settings' -export const keysFn = Object.keys as (obj: T) => (keyof T)[] +export const keysOf = Object.keys as (obj: T) => (keyof T)[] diff --git a/src/tools/common/models.ts b/src/tools/common/models.ts index 71a8fa82f..8e73e3811 100644 --- a/src/tools/common/models.ts +++ b/src/tools/common/models.ts @@ -1,3 +1,5 @@ +import { type ExecResult } from '@agents/common' + export enum SetupFields { includePrerelease = 'includePrerelease', versionSpec = 'versionSpec', @@ -13,7 +15,7 @@ export type SetupSettings = { } export type IRunner = { - run(command: string): Promise + run(command: string): Promise } export type NugetVersions = { data: { versions: { version: string }[] }[] } diff --git a/src/tools/gitreleasemanager/runner.ts b/src/tools/gitreleasemanager/runner.ts index ec2b63276..a3af6d375 100644 --- a/src/tools/gitreleasemanager/runner.ts +++ b/src/tools/gitreleasemanager/runner.ts @@ -1,4 +1,4 @@ -import { type IBuildAgent } from '@agents/common' +import { type ExecResult, type IBuildAgent } from '@agents/common' import { type IRunner } from '@tools/common' import { type Commands } from './models' import { GitReleaseManagerTool } from './tool' @@ -10,7 +10,7 @@ export class Runner implements IRunner { this.gitReleaseManagerTool = new GitReleaseManagerTool(this.buildAgent) } - async run(command: Commands): Promise { + async run(command: Commands): Promise { switch (command) { case 'setup': return await this.setup() @@ -29,7 +29,7 @@ export class Runner implements IRunner { } } - private async setup(): Promise { + private async setup(): Promise { try { this.disableTelemetry() @@ -41,120 +41,143 @@ export class Runner implements IRunner { this.buildAgent.setVariable(pathVariable, toolPath) this.buildAgent.setSucceeded('GitReleaseManager installed successfully', true) - return 0 + return { + code: 0 + } } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } - private async create(): Promise { + private async create(): Promise { try { this.disableTelemetry() this.buildAgent.debug('Creating release') - await this.gitReleaseManagerTool.create() + const result = await this.gitReleaseManagerTool.create() this.buildAgent.setSucceeded('GitReleaseManager created release successfully', true) - return 0 + return result } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } - private async discard(): Promise { + private async discard(): Promise { try { this.disableTelemetry() this.buildAgent.debug('Discarding release') - await this.gitReleaseManagerTool.discard() + const result = await this.gitReleaseManagerTool.discard() this.buildAgent.setSucceeded('GitReleaseManager discarded release successfully', true) - return 0 + return result } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } - private async close(): Promise { + private async close(): Promise { try { this.disableTelemetry() this.buildAgent.debug('Closing release') - await this.gitReleaseManagerTool.close() + const result = await this.gitReleaseManagerTool.close() this.buildAgent.setSucceeded('GitReleaseManager closed release successfully', true) - return 0 + return result } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } - private async open(): Promise { + private async open(): Promise { try { this.disableTelemetry() this.buildAgent.debug('Opening release') - await this.gitReleaseManagerTool.open() + const result = await this.gitReleaseManagerTool.open() this.buildAgent.setSucceeded('GitReleaseManager opened release successfully', true) - return 0 + return result } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } - private async publish(): Promise { + private async publish(): Promise { try { this.disableTelemetry() this.buildAgent.debug('Publishing release') - await this.gitReleaseManagerTool.publish() + const result = await this.gitReleaseManagerTool.publish() this.buildAgent.setSucceeded('GitReleaseManager published release successfully', true) - return 0 + return result } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } - private async addAsset(): Promise { + private async addAsset(): Promise { try { this.disableTelemetry() this.buildAgent.debug('Adding asset to release') - await this.gitReleaseManagerTool.addAsset() + const result = await this.gitReleaseManagerTool.addAsset() this.buildAgent.setSucceeded('GitReleaseManager added assets to release successfully', true) - return 0 + return result } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } diff --git a/src/tools/gitversion/models.ts b/src/tools/gitversion/models.ts index f3c723e3b..a99b23c0c 100644 --- a/src/tools/gitversion/models.ts +++ b/src/tools/gitversion/models.ts @@ -13,7 +13,7 @@ export enum ExecuteFields { additionalArguments = 'additionalArguments' } -export type GitVersionSettings = { +export type GitVersionExecuteSettings = { [ExecuteFields.targetPath]: string [ExecuteFields.disableCache]: boolean [ExecuteFields.disableNormalization]: boolean diff --git a/src/tools/gitversion/runner.ts b/src/tools/gitversion/runner.ts index d7ab791f7..689fa0ab0 100644 --- a/src/tools/gitversion/runner.ts +++ b/src/tools/gitversion/runner.ts @@ -1,4 +1,4 @@ -import { type IBuildAgent } from '@agents/common' +import { type ExecResult, type IBuildAgent } from '@agents/common' import { type IRunner } from '@tools/common' import { type Commands, type GitVersionOutput } from './models' import { GitVersionTool } from './tool' @@ -10,7 +10,7 @@ export class Runner implements IRunner { this.gitVersionTool = new GitVersionTool(this.buildAgent) } - async run(command: Commands): Promise { + async run(command: Commands): Promise { switch (command) { case 'setup': return await this.setup() @@ -19,7 +19,7 @@ export class Runner implements IRunner { } } - private async setup(): Promise { + private async setup(): Promise { try { this.disableTelemetry() @@ -31,26 +31,31 @@ export class Runner implements IRunner { this.buildAgent.setVariable(pathVariable, toolPath) this.buildAgent.setSucceeded('GitVersion installed successfully', true) - return 0 + return { + code: 0 + } } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } - private async execute(): Promise { + private async execute(): Promise { try { this.disableTelemetry() this.buildAgent.info('Executing GitVersion') - const result = await this.gitVersionTool.run() + const result = await this.gitVersionTool.executeJson() if (result.code === 0) { this.buildAgent.info('GitVersion executed successfully') - const { stdout } = result + const stdout: string = result.stdout as string this.buildAgent.info('GitVersion output:') this.buildAgent.info('-------------------') @@ -61,14 +66,17 @@ export class Runner implements IRunner { if (stdout.lastIndexOf('{') === -1 || stdout.lastIndexOf('}') === -1) { this.buildAgent.debug('GitVersion output is not valid JSON') this.buildAgent.setFailed('GitVersion output is not valid JSON', true) - return -1 + return { + code: -1, + error: new Error('GitVersion output is not valid JSON') + } } else { const jsonOutput = stdout.substring(stdout.lastIndexOf('{'), stdout.lastIndexOf('}') + 1) const gitVersionOutput = JSON.parse(jsonOutput) as GitVersionOutput this.gitVersionTool.writeGitVersionToAgent(gitVersionOutput) this.buildAgent.setSucceeded('GitVersion executed successfully', true) - return 0 + return result } } else { this.buildAgent.debug('GitVersion failed') @@ -76,13 +84,16 @@ export class Runner implements IRunner { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return result } } catch (error) { if (error instanceof Error) { this.buildAgent.setFailed(error.message, true) } - return -1 + return { + code: -1, + error + } } } diff --git a/src/tools/gitversion/settings.ts b/src/tools/gitversion/settings.ts index ad390d4fe..49076aa43 100644 --- a/src/tools/gitversion/settings.ts +++ b/src/tools/gitversion/settings.ts @@ -1,12 +1,12 @@ import { type ISettingsProvider, SettingsProvider } from '@tools/common' -import { ExecuteFields, type GitVersionSettings } from './models' +import { ExecuteFields, type GitVersionExecuteSettings } from './models' export interface IGitVersionSettingsProvider extends ISettingsProvider { - getGitVersionSettings(): GitVersionSettings + getGitVersionExecuteSettings(): GitVersionExecuteSettings } export class GitVersionSettingsProvider extends SettingsProvider implements IGitVersionSettingsProvider { - getGitVersionSettings(): GitVersionSettings { + getGitVersionExecuteSettings(): GitVersionExecuteSettings { const targetPath = this.buildAgent.getInput(ExecuteFields.targetPath) const disableCache = this.buildAgent.getBooleanInput(ExecuteFields.disableCache) diff --git a/src/tools/gitversion/tool.ts b/src/tools/gitversion/tool.ts index bff52f834..8a4094549 100644 --- a/src/tools/gitversion/tool.ts +++ b/src/tools/gitversion/tool.ts @@ -1,6 +1,6 @@ import { type ExecResult } from '@agents/common' -import { DotnetTool, keysFn } from '@tools/common' -import { type GitVersionOutput, type GitVersionSettings } from './models' +import { DotnetTool, keysOf } from '@tools/common' +import { type GitVersionExecuteSettings, type GitVersionOutput } from './models' import { GitVersionSettingsProvider, type IGitVersionSettingsProvider } from './settings' export class GitVersionTool extends DotnetTool { @@ -24,21 +24,20 @@ export class GitVersionTool extends DotnetTool { return new GitVersionSettingsProvider(this.buildAgent) } - async run(): Promise { - const settings = this.settingsProvider.getGitVersionSettings() + async executeJson(): Promise { + const settings = this.settingsProvider.getGitVersionExecuteSettings() const workDir = await this.getRepoDir(settings) await this.checkShallowClone(settings, workDir) - const args = await this.getArguments(workDir, settings) + const args = await this.getExecuteArguments(workDir, settings) await this.setDotnetRoot() return await this.executeTool(args) } writeGitVersionToAgent(output: GitVersionOutput): void { - const keys = keysFn(output) - for (const property of keys) { + for (const property of keysOf(output)) { const name = this.toCamelCase(property) try { let value = output[property]?.toString() @@ -55,11 +54,11 @@ export class GitVersionTool extends DotnetTool { } } - protected async getRepoDir(settings: GitVersionSettings): Promise { + protected async getRepoDir(settings: GitVersionExecuteSettings): Promise { return await super.getRepoPath(settings.targetPath) } - protected async getArguments(workDir: string, options: GitVersionSettings): Promise { + protected async getExecuteArguments(workDir: string, options: GitVersionExecuteSettings): Promise { let args = [workDir, '/output', 'json', '/output', 'buildserver'] const { @@ -180,7 +179,7 @@ export class GitVersionTool extends DotnetTool { return args } - private async checkShallowClone(settings: GitVersionSettings, workDir: string): Promise { + private async checkShallowClone(settings: GitVersionExecuteSettings, workDir: string): Promise { if (!settings.disableShallowCloneCheck) { const isShallowResult = await this.execute('git', ['-C', workDir, 'rev-parse', '--is-shallow-repository']) if (isShallowResult.code === 0 && isShallowResult.stdout.trim() === 'true') {