ado_in.groovy
workItem.attachments = attachmentHelper.mergeAttachments(workItem, replica) store(issue) def await = { f -> scala.concurrent.Await$.MODULE$.result(f, scala.concurrent.duration.Duration.apply(1, java.util.concurrent.TimeUnit.MINUTES)) } def creds = await(httpClient.azureClient.getCredentials()) def issueTrackerUrl = creds.issueTrackerUrl() def project = connection.trackerSettings.fieldValues."project" def imageReplace = { desc -> def _desc = desc def descMatcher = _desc =~ /<!-- inline image filename=#([^#]+)# -->/ def matches = descMatcher.size() for (def i=0; i<matches; i++) { if (!descMatcher.iterator().hasNext()) { return _desc } def match = descMatcher.iterator().next(); def matchGroup0 = match[0] def matchGroup1 = match[1] def attId = issue.attachments.find { a -> a.filename == matchGroup1 }?.idStr if (attId) { //$issueTrackerUrl/$organizationName/$projectId/_apis/wit/attachments/$localId?fileName=$attName _desc = _desc.replaceAll(matchGroup0, "<img src=\"$issueTrackerUrl/${project}/_apis/wit/attachments/${attId}?fileName=$matchGroup1\"/>") } } _desc }