Add '--ignore-failed-sources' to options
This commit is contained in:
8
dist/azure/gitreleasemanager/setup/task.json
vendored
8
dist/azure/gitreleasemanager/setup/task.json
vendored
@@ -36,6 +36,14 @@
|
|||||||
"defaultValue": "false",
|
"defaultValue": "false",
|
||||||
"required": false,
|
"required": false,
|
||||||
"helpMarkDown": "Include pre-release versions when matching a version"
|
"helpMarkDown": "Include pre-release versions when matching a version"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ignoreFailedSources",
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Treat package source failures as warnings",
|
||||||
|
"defaultValue": "false",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Treat package source failures as warnings"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
8
dist/azure/gitversion/setup/task.json
vendored
8
dist/azure/gitversion/setup/task.json
vendored
@@ -36,6 +36,14 @@
|
|||||||
"defaultValue": "false",
|
"defaultValue": "false",
|
||||||
"required": false,
|
"required": false,
|
||||||
"helpMarkDown": "Include pre-release versions when matching a version"
|
"helpMarkDown": "Include pre-release versions when matching a version"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ignoreFailedSources",
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Treat package source failures as warnings",
|
||||||
|
"defaultValue": "false",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Treat package source failures as warnings"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,15 @@ import * as path from 'path'
|
|||||||
import * as http from 'typed-rest-client/HttpClient'
|
import * as http from 'typed-rest-client/HttpClient'
|
||||||
|
|
||||||
import { inject, injectable } from 'inversify'
|
import { inject, injectable } from 'inversify'
|
||||||
import { TYPES, IExecResult, IBuildAgent } from './models'
|
import { TYPES, IExecResult, IBuildAgent, ISetupSettings } from './models'
|
||||||
import { IVersionManager } from './versionManager'
|
import { IVersionManager } from './versionManager'
|
||||||
|
|
||||||
export interface IDotnetTool {
|
export interface IDotnetTool {
|
||||||
disableTelemetry(): void
|
disableTelemetry(): void
|
||||||
toolInstall(
|
toolInstall(
|
||||||
toolName: string,
|
toolName: string,
|
||||||
versionSpec: string,
|
|
||||||
checkLatest: boolean,
|
checkLatest: boolean,
|
||||||
includePre: boolean
|
setupSettings: ISetupSettings
|
||||||
): Promise<string>
|
): Promise<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,16 +50,17 @@ export class DotnetTool implements IDotnetTool {
|
|||||||
|
|
||||||
public async toolInstall(
|
public async toolInstall(
|
||||||
toolName: string,
|
toolName: string,
|
||||||
versionSpec: string,
|
|
||||||
checkLatest: boolean,
|
checkLatest: boolean,
|
||||||
includePre: boolean
|
setupSettings: ISetupSettings
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
console.log('')
|
console.log('')
|
||||||
console.log('--------------------------')
|
console.log('--------------------------')
|
||||||
console.log(`Installing ${toolName} version ` + versionSpec)
|
console.log(
|
||||||
|
`Installing ${toolName} version ` + setupSettings.versionSpec
|
||||||
|
)
|
||||||
console.log('--------------------------')
|
console.log('--------------------------')
|
||||||
|
|
||||||
if (this.versionManager.isExplicitVersion(versionSpec)) {
|
if (this.versionManager.isExplicitVersion(setupSettings.versionSpec)) {
|
||||||
checkLatest = false // check latest doesn't make sense when explicit version
|
checkLatest = false // check latest doesn't make sense when explicit version
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,16 +69,18 @@ export class DotnetTool implements IDotnetTool {
|
|||||||
//
|
//
|
||||||
// Let's try and resolve the version spec locally first
|
// Let's try and resolve the version spec locally first
|
||||||
//
|
//
|
||||||
toolPath = this.buildAgent.find(toolName, versionSpec)
|
toolPath = this.buildAgent.find(toolName, setupSettings.versionSpec)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!toolPath) {
|
if (!toolPath) {
|
||||||
let version: string
|
let version: string
|
||||||
if (this.versionManager.isExplicitVersion(versionSpec)) {
|
if (
|
||||||
|
this.versionManager.isExplicitVersion(setupSettings.versionSpec)
|
||||||
|
) {
|
||||||
//
|
//
|
||||||
// Explicit version was specified. No need to query for list of versions.
|
// Explicit version was specified. No need to query for list of versions.
|
||||||
//
|
//
|
||||||
version = versionSpec
|
version = setupSettings.versionSpec
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Let's query and resolve the latest version for the versionSpec.
|
// Let's query and resolve the latest version for the versionSpec.
|
||||||
@@ -88,12 +90,12 @@ export class DotnetTool implements IDotnetTool {
|
|||||||
//
|
//
|
||||||
version = await this.queryLatestMatch(
|
version = await this.queryLatestMatch(
|
||||||
toolName,
|
toolName,
|
||||||
versionSpec,
|
setupSettings.versionSpec,
|
||||||
includePre
|
setupSettings.includePrerelease
|
||||||
)
|
)
|
||||||
if (!version) {
|
if (!version) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unable to find ${toolName} version '${versionSpec}'.`
|
`Unable to find ${toolName} version '${setupSettings.versionSpec}'.`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +108,11 @@ export class DotnetTool implements IDotnetTool {
|
|||||||
//
|
//
|
||||||
// Download, extract, cache
|
// Download, extract, cache
|
||||||
//
|
//
|
||||||
toolPath = await this.acquireTool(toolName, version)
|
toolPath = await this.acquireTool(
|
||||||
|
toolName,
|
||||||
|
version,
|
||||||
|
setupSettings.ignoreFailedSources
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,11 +176,16 @@ export class DotnetTool implements IDotnetTool {
|
|||||||
|
|
||||||
private async acquireTool(
|
private async acquireTool(
|
||||||
toolName: string,
|
toolName: string,
|
||||||
version: string
|
version: string,
|
||||||
|
ignoreFailedSources: boolean
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const tempDirectory = await this.buildAgent.createTempDir()
|
const tempDirectory = await this.buildAgent.createTempDir()
|
||||||
let args = ['tool', 'install', toolName, '--tool-path', tempDirectory]
|
let args = ['tool', 'install', toolName, '--tool-path', tempDirectory]
|
||||||
|
|
||||||
|
if (ignoreFailedSources) {
|
||||||
|
args.push('--ignore-failed-sources')
|
||||||
|
}
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
version = this.versionManager.cleanVersion(version)
|
version = this.versionManager.cleanVersion(version)
|
||||||
args = args.concat(['--version', version])
|
args = args.concat(['--version', version])
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ export const TYPES = {
|
|||||||
|
|
||||||
export enum SetupFields {
|
export enum SetupFields {
|
||||||
includePrerelease = 'includePrerelease',
|
includePrerelease = 'includePrerelease',
|
||||||
versionSpec = 'versionSpec'
|
versionSpec = 'versionSpec',
|
||||||
|
ignoreFailedSources = 'ignoreFailedSources'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISetupSettings {
|
export interface ISetupSettings {
|
||||||
[SetupFields.versionSpec]: string
|
[SetupFields.versionSpec]: string
|
||||||
[SetupFields.includePrerelease]: boolean
|
[SetupFields.includePrerelease]: boolean
|
||||||
|
[SetupFields.ignoreFailedSources]: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IExecResult {
|
export interface IExecResult {
|
||||||
|
|||||||
@@ -6,10 +6,14 @@ export class Settings {
|
|||||||
const includePrerelease = buildAgent.getBooleanInput(
|
const includePrerelease = buildAgent.getBooleanInput(
|
||||||
SetupFields.includePrerelease
|
SetupFields.includePrerelease
|
||||||
)
|
)
|
||||||
|
const ignoreFailedSources = buildAgent.getBooleanInput(
|
||||||
|
SetupFields.ignoreFailedSources
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
versionSpec,
|
versionSpec,
|
||||||
includePrerelease
|
includePrerelease,
|
||||||
|
ignoreFailedSources
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,7 @@ export async function setup() {
|
|||||||
|
|
||||||
const settings = CommonSettings.getSetupSettings(buildAgent)
|
const settings = CommonSettings.getSetupSettings(buildAgent)
|
||||||
|
|
||||||
await gitReleaseManagerTool.install(
|
await gitReleaseManagerTool.install(settings)
|
||||||
settings.versionSpec,
|
|
||||||
settings.includePrerelease
|
|
||||||
)
|
|
||||||
|
|
||||||
buildAgent.setSucceeded(
|
buildAgent.setSucceeded(
|
||||||
'GitVersionManager installed successfully',
|
'GitVersionManager installed successfully',
|
||||||
|
|||||||
@@ -20,10 +20,7 @@ export async function setup() {
|
|||||||
|
|
||||||
const settings = CommonSettings.getSetupSettings(buildAgent)
|
const settings = CommonSettings.getSetupSettings(buildAgent)
|
||||||
|
|
||||||
await gitVersionTool.install(
|
await gitVersionTool.install(settings)
|
||||||
settings.versionSpec,
|
|
||||||
settings.includePrerelease
|
|
||||||
)
|
|
||||||
|
|
||||||
buildAgent.setSucceeded('GitVersion installed successfully', true)
|
buildAgent.setSucceeded('GitVersion installed successfully', true)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import path = require('path')
|
import path = require('path')
|
||||||
|
|
||||||
import { TYPES, IBuildAgent, IExecResult } from '../../core/models'
|
import { TYPES, IBuildAgent, IExecResult, ISetupSettings } from '../../core/models'
|
||||||
import { injectable, inject } from 'inversify'
|
import { injectable, inject } from 'inversify'
|
||||||
import { DotnetTool, IDotnetTool } from '../../core/dotnet-tool'
|
import { DotnetTool, IDotnetTool } from '../../core/dotnet-tool'
|
||||||
import { IVersionManager } from '../../core/versionManager'
|
import { IVersionManager } from '../../core/versionManager'
|
||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
} from './models'
|
} from './models'
|
||||||
|
|
||||||
export interface IGitReleaseManagerTool extends IDotnetTool {
|
export interface IGitReleaseManagerTool extends IDotnetTool {
|
||||||
install(versionSpec: string, includePrerelease: boolean): Promise<void>
|
install(setupSettings: ISetupSettings): Promise<void>
|
||||||
create(settings: GitReleaseManagerCreateSettings): Promise<IExecResult>
|
create(settings: GitReleaseManagerCreateSettings): Promise<IExecResult>
|
||||||
discard(settings: GitReleaseManagerDiscardSettings): Promise<IExecResult>
|
discard(settings: GitReleaseManagerDiscardSettings): Promise<IExecResult>
|
||||||
close(settings: GitReleaseManagerCloseSettings): Promise<IExecResult>
|
close(settings: GitReleaseManagerCloseSettings): Promise<IExecResult>
|
||||||
@@ -36,15 +36,11 @@ export class GitReleaseManagerTool
|
|||||||
super(buildAgent, versionManager)
|
super(buildAgent, versionManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async install(
|
public async install(setupSettings: ISetupSettings): Promise<void> {
|
||||||
versionSpec: string,
|
|
||||||
includePrerelease: boolean
|
|
||||||
): Promise<void> {
|
|
||||||
await this.toolInstall(
|
await this.toolInstall(
|
||||||
'GitReleaseManager.Tool',
|
'GitReleaseManager.Tool',
|
||||||
versionSpec,
|
|
||||||
false,
|
false,
|
||||||
includePrerelease
|
setupSettings
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import path = require('path')
|
import path = require('path')
|
||||||
|
|
||||||
import { injectable, inject } from 'inversify'
|
import { injectable, inject } from 'inversify'
|
||||||
import { IExecResult, IBuildAgent, TYPES } from '../../core/models'
|
import { IExecResult, IBuildAgent, TYPES, ISetupSettings } from '../../core/models'
|
||||||
import { DotnetTool, IDotnetTool } from '../../core/dotnet-tool'
|
import { DotnetTool, IDotnetTool } from '../../core/dotnet-tool'
|
||||||
import { GitVersionSettings, GitVersionOutput } from './models'
|
import { GitVersionSettings, GitVersionOutput } from './models'
|
||||||
import { IVersionManager } from '../../core/versionManager'
|
import { IVersionManager } from '../../core/versionManager'
|
||||||
|
|
||||||
export interface IGitVersionTool extends IDotnetTool {
|
export interface IGitVersionTool extends IDotnetTool {
|
||||||
install(versionSpec: string, includePrerelease: boolean): Promise<void>
|
install(setupSettings: ISetupSettings): Promise<void>
|
||||||
run(options: GitVersionSettings): Promise<IExecResult>
|
run(options: GitVersionSettings): Promise<IExecResult>
|
||||||
writeGitVersionToAgent(gitversion: GitVersionOutput): void
|
writeGitVersionToAgent(gitversion: GitVersionOutput): void
|
||||||
}
|
}
|
||||||
@@ -21,15 +21,11 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
|
|||||||
super(buildAgent, versionManager)
|
super(buildAgent, versionManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async install(
|
public async install(setupSettings: ISetupSettings): Promise<void> {
|
||||||
versionSpec: string,
|
|
||||||
includePrerelease: boolean
|
|
||||||
): Promise<void> {
|
|
||||||
await this.toolInstall(
|
await this.toolInstall(
|
||||||
'GitVersion.Tool',
|
'GitVersion.Tool',
|
||||||
versionSpec,
|
|
||||||
false,
|
false,
|
||||||
includePrerelease
|
setupSettings
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user