Skip to content

Commit

Permalink
Remove buildserver output argument from GitVersion tool as it's dupli…
Browse files Browse the repository at this point in the history
…cating the actions behavior

Removed the '/output buildserver' argument from the `gitversion` tool execution. Updated all related unit tests to reflect this change, ensuring consistency and correctness across different configurations.
  • Loading branch information
arturcic committed Dec 6, 2024
1 parent d832d56 commit 2f29300
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 33 deletions.
2 changes: 1 addition & 1 deletion dist/tools/libs/gitversion.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class GitVersionTool extends DotnetTool {
return await super.getRepoPath(settings.targetPath);
}
async getExecuteArguments(workDir, options) {
const args = [workDir, "/output", "json", "/output", "buildserver"];
const args = [workDir, "/output", "json"];
const {
useConfigFile,
disableCache,
Expand Down
6 changes: 5 additions & 1 deletion dist/tools/libs/gitversion.mjs.map

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions src/__tests__/tools/gitversion/runner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ 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')
})

it.sequential('should output Major variable', async () => {
Expand Down
34 changes: 7 additions & 27 deletions src/__tests__/tools/gitversion/tool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,21 @@ describe('GitVersionTool', () => {
describe('getExecuteArguments', () => {
it('should return correct arguments for empty settings', async () => {
const args = await tool.getExecuteArguments('workdir', {} as ExecuteSettings)
expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver'])
expect(args).toEqual(['workdir', '/output', 'json'])
})

it('should return correct arguments for settings with cache', async () => {
const args = await tool.getExecuteArguments('workdir', {
disableCache: true
} as ExecuteSettings)
expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '/nocache'])
expect(args).toEqual(['workdir', '/output', 'json', '/nocache'])
})

it('should return correct arguments for settings with normalization', async () => {
const args = await tool.getExecuteArguments('workdir', {
disableNormalization: true
} as ExecuteSettings)
expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '/nonormalize'])
expect(args).toEqual(['workdir', '/output', 'json', '/nonormalize'])
})

it('should return correct arguments for settings with config', async () => {
Expand All @@ -175,7 +175,7 @@ describe('GitVersionTool', () => {
useConfigFile: true,
configFilePath: 'workdir/GitVersion.yml'
} as ExecuteSettings)
expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '/config', 'workdir/GitVersion.yml'])
expect(args).toEqual(['workdir', '/output', 'json', '/config', 'workdir/GitVersion.yml'])
})

it('should return correct arguments for settings with wrong config file', async () => {
Expand All @@ -193,17 +193,7 @@ describe('GitVersionTool', () => {
const args = await tool.getExecuteArguments('workdir', {
overrideConfig: ['tag-prefix=release-', 'next-version=1.0.0']
} as ExecuteSettings)
expect(args).toEqual([
'workdir',
'/output',
'json',
'/output',
'buildserver',
'/overrideconfig',
'tag-prefix=release-',
'/overrideconfig',
'next-version=1.0.0'
])
expect(args).toEqual(['workdir', '/output', 'json', '/overrideconfig', 'tag-prefix=release-', '/overrideconfig', 'next-version=1.0.0'])
})

it('should return correct arguments for settings with assembly info', async () => {
Expand All @@ -212,7 +202,7 @@ describe('GitVersionTool', () => {
updateAssemblyInfo: true,
updateAssemblyInfoFilename: 'AssemblyInfo.cs'
} as ExecuteSettings)
expect(args).toEqual(['workdir', '/output', 'json', '/output', 'buildserver', '/updateassemblyinfo', 'AssemblyInfo.cs'])
expect(args).toEqual(['workdir', '/output', 'json', '/updateassemblyinfo', 'AssemblyInfo.cs'])
})

it('should return correct arguments for settings with wrong assembly info', async () => {
Expand All @@ -234,17 +224,7 @@ describe('GitVersionTool', () => {
updateAssemblyInfo: true,
updateAssemblyInfoFilename: 'AssemblyInfo.cs'
} as ExecuteSettings)
expect(args).toEqual([
'workdir',
'/output',
'json',
'/output',
'buildserver',
'/config',
'workdir/GitVersion.yml',
'/updateassemblyinfo',
'AssemblyInfo.cs'
])
expect(args).toEqual(['workdir', '/output', 'json', '/config', 'workdir/GitVersion.yml', '/updateassemblyinfo', 'AssemblyInfo.cs'])
})
})

Expand Down
2 changes: 1 addition & 1 deletion src/tools/gitversion/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class GitVersionTool extends DotnetTool {
}

protected async getExecuteArguments(workDir: string, options: ExecuteSettings): Promise<string[]> {
const args = [workDir, '/output', 'json', '/output', 'buildserver']
const args = [workDir, '/output', 'json']

const {
useConfigFile,
Expand Down

0 comments on commit 2f29300

Please sign in to comment.