TFS build

redredredredredred Posts: 9
edited September 1, 2016 5:04AM in DLM Automation
Hi

Trying to setup a TFS to use the 'RedGate DLM Automation Build Plugin'. I have it added to the build step but getting an error:

2016-08-26T22:14:04.0938138Z Executing the powershell script: C:TfsDataAgentsAgent-Main asksRedgateSqlCiBuild1.0.21SqlCiTask.ps1
2016-08-26T22:14:04.2466899Z Entering script SqlCiTask.ps1
2016-08-26T22:14:18.6873313Z sqlCI.exe -- Red Gate's SQL Continuous Integration v2.1.33.387
2016-08-26T22:14:18.6902632Z Unexpected exception failed with error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2016-08-26T22:14:18.7107924Z ##[error]SQL CI exitcode was 533. See console output for details.

I'm using a clean install of the AdventureWorks2014 DB which is in TFS via RedGate Source Control.

Please can you advise?

Thanks

Comments

  • Alex BAlex B Posts: 1,131 Diamond 4
    Hi redredred,

    I think this has to do with the scripts folder file path - please see this from the SQL Source Control Documentation, which points to this.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • Hi I've moved the working base to C: emp but the build still fails with the output below.

    Any ideas?

    Thanks

    2016-08-29T16:37:12.0328548Z ##[debug]nugetPackageVersionUseBuildNumber = true
    2016-08-29T16:37:12.0688775Z ##[debug]Using SQL CI arguments BUILD /scriptsFolder="." /packageId="AW" /packageVersion="1.0.14" /outputFolder="C:TfsDataAgentsAgent-Main_work1s"
    2016-08-29T16:37:33.2646491Z sqlCI.exe -- Red Gate's SQL Continuous Integration v2.1.33.387
    2016-08-29T16:37:33.2675838Z Unexpected exception failed with error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
    2016-08-29T16:37:33.2858436Z ##[error]System.Management.Automation.RuntimeException: SQL CI exitcode was 533. See console output for details. ---> System.Management.Automation.RuntimeException: SQL CI exitcode was 533. See console output for details.
    2016-08-29T16:37:33.2863438Z ##[error] --- End of inner exception stack trace ---
    2016-08-29T16:37:33.2868452Z ##[error] at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
    2016-08-29T16:37:33.2873442Z ##[error] at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
    2016-08-29T16:37:33.2878471Z ##[error] at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
    2016-08-29T16:37:33.2880674Z ##[error] at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
    2016-08-29T16:37:33.2880674Z ##[error] at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
    2016-08-29T16:37:33.2885697Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext context, CancellationToken cancellationToken)
    2016-08-29T16:37:33.2890699Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext context, TaskWrapper task, CancellationTokenSource tokenSource)
    2016-08-29T16:37:33.3106942Z Finishing task: RedgateSqlCiBuild
    2016-08-29T16:37:33.3116711Z ##[error]System.Exception: Task RedgateSqlCiBuild failed. This caused the job to fail. Look at the logs for the task for more details.
    2016-08-29T16:37:33.3126494Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.Run(IJobContext jobContext, IJobRequest job, IJobExtension jobExtension, CancellationTokenSource tokenSource)
    2016-08-29T16:37:33.3146036Z Entering OnFinalizeJob
    2016-08-29T16:37:33.3146036Z Leaving OnFinalizeJob
  • Hi,

    Are you using VSTS or TFS 2015? If it's VSTS, is the build agent hosted or on-premsises?

    Are you able to see if any long folder structures are getting created in C:TfsDataAgentsAgent-Main_work1s ?
    Software Engineer
    Redgate Software
  • Hi

    It is an on premise install of TFS 2015 (latest version from the MS site).

    I can't see any long paths there and even tried setting the work directory to C:B which didn't seem to solve the issue?

    Thanks
  • Could you try enabling verbose output? To do this you'll need to set the system.debug variable to true in TFS Build. For more information, have a look at this blog post - http://blog.devmatter.com/enabling-verb ... uild-logs/

    Once you've done that, try running the build again and posting the log that it outputs.
    Software Engineer
    Redgate Software
  • Hi

    The log above has that turned on, but I can post the lines of the log which were displayed before those above.

    Thanks
  • Ah, OK. Not to worry then.

    I think this may have been caused by a temporary file somewhere in the %TMP%SQL CI directory that has exceeded the maximum path length. Do you have any database objects with long names? This can often come up when building scripts folders that contain tSQLt unit tests as they can often have long names.
    Software Engineer
    Redgate Software
  • It is a clean install of the Adventure Works 2014 database from the Microsoft site.

    Thanks
  • If you change the TMP and TEMP environment variables to point to something like c: emp, does that help?
    Software Engineer
    Redgate Software
  • That didn't seem to help. Same error.

    Thanks


    2016-08-31T17:42:42.5228574Z Entering OnPrepareEnvironment

    2
    2016-08-31T17:42:42.5323633Z Primary repository: ADTest1

    3
    2016-08-31T17:42:42.5338642Z Calculating build folder hash key.

    4
    2016-08-31T17:42:42.5363666Z Loading tracking config if exists: C:BSourceRootMapping284ac3f9-07f7-4482-a406-f5860abfd8d51SourceFolder.json

    5
    2016-08-31T17:42:42.5373666Z Parsing tracking config file version 2 format.

    6
    2016-08-31T17:42:42.5493755Z Writing config to file: C:BSourceRootMapping284ac3f9-07f7-4482-a406-f5860abfd8d51SourceFolder.json

    7
    2016-08-31T17:42:42.5884015Z Checking if artifacts directory exists: C:B1a

    8
    2016-08-31T17:42:42.5889008Z Deleting artifacts directory.

    9
    2016-08-31T17:42:42.5949051Z Creating artifacts directory.

    10
    2016-08-31T17:42:42.5949051Z Checking if test results directory exists: C:B1TestResults

    11
    2016-08-31T17:42:42.5954059Z Deleting test results directory.

    12
    2016-08-31T17:42:42.5959054Z Creating test results directory.

    13
    2016-08-31T17:42:42.5964065Z Setting local variables.

    14
    2016-08-31T17:42:42.5969064Z Create the initial timeline records for the tasks

    15
    2016-08-31T17:42:42.5989080Z Preparing repositories

    16
    2016-08-31T17:42:42.5989080Z repo clean = False

    17
    2016-08-31T17:42:42.5994082Z Found 2 endpoints to consider

    18
    2016-08-31T17:42:42.6149184Z Found 1 repositories to sync

    19
    2016-08-31T17:42:42.6254261Z Starting: Get sources

    20
    2016-08-31T17:42:42.6284278Z build.fetchtags=false

    21
    2016-08-31T17:42:42.6329301Z Entering TfvcSourceProvider.PrepareRepositoryAsync

    22
    2016-08-31T17:42:42.6339307Z localPath=C:B1s

    23
    2016-08-31T17:42:42.6339307Z clean=False

    24
    2016-08-31T17:42:42.6349323Z sourceVersion=15

    25
    2016-08-31T17:42:42.6349323Z mappingJson={"mappings":[{"serverPath":"$/ADTest1","mappingType":"map","localPath":"\"},{"serverPath":"$/ADTest1/Drops","mappingType":"cloak","localPath":"\"}]}

    26
    2016-08-31T17:42:42.6364326Z Syncing repository: ADTest1 (TFVC)

    27
    2016-08-31T17:42:42.6369330Z workspaceName=ws_1_2

    28
    2016-08-31T17:42:43.3632305Z Workspace Name: ws_1_2;Build284ac3f9-07f7-4482-a406-f5860abfd8d5

    29
    2016-08-31T17:42:43.3842448Z tf get /version:15

    30
    2016-08-31T17:42:43.5133307Z Done syncing repository ADTest1 to version 15 (workspace version C15)

    31
    2016-08-31T17:42:43.5138312Z Leaving TfvcSourceProvider.PrepareRepositoryAsync

    32
    2016-08-31T17:42:43.5348443Z Leaving OnPrepareEnvironment

    33
    2016-08-31T17:42:43.6003977Z Running tasks

    34
    2016-08-31T17:42:43.6169089Z Starting task: Build AW

    35
    2016-08-31T17:42:43.6759491Z Executing the powershell script: C:TfsDataAgentsAgent-Main asksRedgateSqlCiBuild1.0.21SqlCiTask.ps1

    36
    2016-08-31T17:42:43.8340546Z Entering script SqlCiTask.ps1

    37
    2016-08-31T17:42:43.8370569Z ##[debug]dbFolder = RootFolder

    38
    2016-08-31T17:42:43.8375570Z ##[debug]subFolderPath = C:B1s

    39
    2016-08-31T17:42:43.8380560Z ##[debug]packageName = AW

    40
    2016-08-31T17:42:43.8385568Z ##[debug]tempServerTypeBuild = localDB

    41
    2016-08-31T17:42:43.8390582Z ##[debug]tempServerNameBuild =

    42
    2016-08-31T17:42:43.8390582Z ##[debug]tempDatabaseNameBuild =

    43
    2016-08-31T17:42:43.8395578Z ##[debug]authMethodBuild = sqlServerAuth

    44
    2016-08-31T17:42:43.8400574Z ##[debug]usernameBuild =

    45
    2016-08-31T17:42:43.8400574Z ##[debug]passwordBuild = *********

    46
    2016-08-31T17:42:43.8405575Z ##[debug]packageId =

    47
    2016-08-31T17:42:43.8410583Z ##[debug]tempServerType = localDB

    48
    2016-08-31T17:42:43.8410583Z ##[debug]tempServerName =

    49
    2016-08-31T17:42:43.8415591Z ##[debug]tempDatabaseName =

    50
    2016-08-31T17:42:43.8415591Z ##[debug]authMethod = sqlServerAuth

    51
    2016-08-31T17:42:43.8420593Z ##[debug]username =

    52
    2016-08-31T17:42:43.8420593Z ##[debug]password = *********

    53
    2016-08-31T17:42:43.8425595Z ##[debug]useSqlDataGenerator = false

    54
    2016-08-31T17:42:43.8430597Z ##[debug]autoSqlDataGenerator = true

    55
    2016-08-31T17:42:43.8435601Z ##[debug]runOnly =

    56
    2016-08-31T17:42:43.8435601Z ##[debug]packageIdPublish =

    57
    2016-08-31T17:42:43.8440600Z ##[debug]nugetFeedUrl =

    58
    2016-08-31T17:42:43.8440600Z ##[debug]nugetFeedApiKey =

    59
    2016-08-31T17:42:43.8445602Z ##[debug]packageIdSync =

    60
    2016-08-31T17:42:43.8450613Z ##[debug]targetServerName =

    61
    2016-08-31T17:42:43.8450613Z ##[debug]targetDatabaseName =

    62
    2016-08-31T17:42:43.8455618Z ##[debug]authMethodSync = sqlServerAuth

    63
    2016-08-31T17:42:43.8460613Z ##[debug]usernameSync =

    64
    2016-08-31T17:42:43.8460613Z ##[debug]passwordSync = *********

    65
    2016-08-31T17:42:43.8465624Z ##[debug]additionalParams =

    66
    2016-08-31T17:42:43.8465624Z ##[debug]nugetPackageVersion = 1.0

    67
    2016-08-31T17:42:43.8470626Z ##[debug]nugetPackageVersionUseBuildNumber = true

    68
    2016-08-31T17:42:43.8710777Z ##[debug]Using SQL CI arguments BUILD /scriptsFolder="." /packageId="AW" /packageVersion="1.0.19" /outputFolder="C:B1s"

    69
    2016-08-31T17:43:04.4341160Z sqlCI.exe -- Red Gate's SQL Continuous Integration v2.1.33.387

    70
    2016-08-31T17:43:04.4366175Z Unexpected exception failed with error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

    71
    2016-08-31T17:43:04.4541309Z ##[error]System.Management.Automation.RuntimeException: SQL CI exitcode was 533. See console output for details. ---> System.Management.Automation.RuntimeException: SQL CI exitcode was 533. See console output for details.

    72
    2016-08-31T17:43:04.4546307Z ##[error] --- End of inner exception stack trace ---

    73
    2016-08-31T17:43:04.4546307Z ##[error] at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)

    74
    2016-08-31T17:43:04.4551312Z ##[error] at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)

    75
    2016-08-31T17:43:04.4556308Z ##[error] at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)

    76
    2016-08-31T17:43:04.4561316Z ##[error] at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)

    77
    2016-08-31T17:43:04.4566315Z ##[error] at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)

    78
    2016-08-31T17:43:04.4566315Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext context, CancellationToken cancellationToken)

    79
    2016-08-31T17:43:04.4571316Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext context, TaskWrapper task, CancellationTokenSource tokenSource)

    80
    2016-08-31T17:43:04.4886528Z Finishing task: RedgateSqlCiBuild

    81
    2016-08-31T17:43:04.4896537Z ##[error]System.Exception: Task RedgateSqlCiBuild failed. This caused the job to fail. Look at the logs for the task for more details.

    82
    2016-08-31T17:43:04.4901542Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.Run(IJobContext jobContext, IJobRequest job, IJobExtension jobExtension, CancellationTokenSource tokenSource)

    83
    2016-08-31T17:43:04.4916554Z Entering OnFinalizeJob

    84
    2016-08-31T17:43:04.4926554Z Leaving OnFinalizeJob
  • I'm going to create a support ticket for you so we can look at this there. You'll receive an email shortly.
    Software Engineer
    Redgate Software
  • Any news on this? I moved both my repo and the working base to very short folders, with no change. All paths and file names in the report were already well under the maximum length mentioned in the error message.

    What worked for me was to shorten the names of all .sql files that were longer than 110 characters. (I didn't check if longer named would work, since I saw something on this forum elsewhere that mentioned 114 characters).

    I used dir /s/b >dir.txt, then loaded that into Excel, and made a bunch of rename statements. Voila

  • PS: This was still a problem with RG Source Control 7.1.10.10317. Note that some of the files were created by SQL Compare, so it obviously doesn't respect the length limitation of Source Control.
    PPS: I've long had paths/file names enabled in Windows 10 (as per here), but SC doesn't be to be manifested for that.
Sign In or Register to comment.