in src/configure/configure.ts [543:582]
private async checkInPipelineFileToRepository(): Promise<void> {
try {
const fileName = await LocalGitRepoHelper.GetAvailableFileName("azure-pipelines.yml", this.inputs.sourceRepository.localPath);
const filePath = path.join(this.inputs.sourceRepository.localPath, fileName);
const content = await templateHelper.renderContent(this.inputs.pipelineParameters.pipelineTemplate.path, this.inputs);
await fs.writeFile(filePath, content);
await vscode.workspace.saveAll(true);
await vscode.window.showTextDocument(vscode.Uri.file(path.join(this.inputs.sourceRepository.localPath, this.inputs.pipelineParameters.pipelineFileName)));
}
catch (error) {
telemetryHelper.logError(Layer, TracePoints.AddingContentToPipelineFileFailed, error);
throw error;
}
try {
while (!this.inputs.sourceRepository.commitId) {
let commitOrDiscard = await vscode.window.showInformationMessage(utils.format(Messages.modifyAndCommitFile, Messages.commitAndPush, this.inputs.sourceRepository.branch, this.inputs.sourceRepository.remoteName), Messages.commitAndPush, Messages.discardPipeline);
if (commitOrDiscard && commitOrDiscard.toLowerCase() === Messages.commitAndPush.toLowerCase()) {
await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: Messages.configuringPipelineAndDeployment }, async (progress) => {
try {
// handle when the branch is not upto date with remote branch and push fails
this.inputs.sourceRepository.commitId = await this.localGitRepoHelper.commitAndPushPipelineFile(this.inputs.pipelineParameters.pipelineFileName, this.inputs.sourceRepository);
}
catch (error) {
telemetryHelper.logError(Layer, TracePoints.CheckInPipelineFailure, error);
vscode.window.showErrorMessage(utils.format(Messages.commitFailedErrorMessage, error.message));
}
});
}
else {
telemetryHelper.setTelemetry(TelemetryKeys.PipelineDiscarded, 'true');
throw new UserCancelledError();
}
}
}
catch (error) {
telemetryHelper.logError(Layer, TracePoints.PipelineFileCheckInFailed, error);
throw error;
}
}