jetbrains.buildServer.serverSide.SBuild Java Examples
The following examples show how to use
jetbrains.buildServer.serverSide.SBuild.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DownloadSymbolsController.java From teamcity-symbol-server with Apache License 2.0 | 6 votes |
@Nullable private BuildArtifact findArtifact(@NotNull BuildMetadataEntry entry) { final Map<String,String> metadata = entry.getMetadata(); final String storedArtifactPath = metadata.get(BuildSymbolsIndexProvider.ARTIFACT_PATH_KEY); if(storedArtifactPath == null){ LOG.debug(String.format("Metadata stored for guid '%s' is invalid.", entry.getKey())); return null; } final long buildId = entry.getBuildId(); final SBuild build = myServer.findBuildInstanceById(buildId); if(build == null){ LOG.debug(String.format("Build not found by id %d.", buildId)); return null; } final BuildArtifact buildArtifact = build.getArtifacts(BuildArtifactsViewMode.VIEW_ALL_WITH_ARCHIVES_CONTENT).getArtifact(storedArtifactPath); if(buildArtifact == null){ LOG.debug(String.format("Artifact not found by path %s for build with id %d.", storedArtifactPath, buildId)); } return buildArtifact; }
Example #2
Source File: BuildSummaryLinkExtension.java From TeamCity.SonarQubePlugin with Apache License 2.0 | 6 votes |
@Override public void fillModel(@NotNull final Map<String, Object> model, @NotNull final HttpServletRequest request) { final SBuild build = BuildDataExtensionUtil.retrieveBuild(request, myServer); if (build == null) { return; } final BuildArtifact artifact = build.getArtifacts(BuildArtifactsViewMode.VIEW_HIDDEN_ONLY).getArtifact(Constants.SONAR_SERVER_URL_ARTIF_LOCATION_FULL); if (artifact == null) { model.put("sonar_noArtifact", Boolean.TRUE); return; } if (artifact.getSize() > ABSOLUTE_FILESIZE_THRESHOLD) { model.put("sonar_bigUrlFile", artifact.getSize()); } else { try { model.put("sonar_url", readUrl(artifact)); } catch (IOException e) { model.put("sonar_IOException", e); } } super.fillModel(model, request); }
Example #3
Source File: AllureReportBuildSummaryExtension.java From allure-teamcity with Apache License 2.0 | 6 votes |
@Override public void fillModel(@NotNull final Map<String, Object> model, @NotNull final HttpServletRequest request) { final SBuild build = BuildDataExtensionUtil.retrieveBuild(request, server); if (Objects.isNull(build)) { return; } final BuildArtifact artifact = build.getArtifacts(BuildArtifactsViewMode.VIEW_HIDDEN_ONLY) .getArtifact(AllureConstants.ALLURE_ARTIFACT_SUMMARY_LOCATION); if (Objects.isNull(artifact)) { return; } try { final AllureReportSummary summary = readSummary(artifact); model.put("allure_summary", summary); } catch (IOException e) { model.put("allure_error", e.getMessage()); } }
Example #4
Source File: DownloadSymbolsController.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
@Nullable private String findRelatedProjectId(@NotNull BuildMetadataEntry metadataEntry) { long buildId = metadataEntry.getBuildId(); final SBuild build = myServer.findBuildInstanceById(buildId); if(build == null) { LOG.debug(String.format("Failed to find build by id %d. Requested symbol file with id %s expected to be produced by that build.", buildId, metadataEntry.getKey())); return null; } return build.getProjectId(); }
Example #5
Source File: BuildSymbolsIndexProvider.java From teamcity-symbol-server with Apache License 2.0 | 5 votes |
@Nullable private String locateArtifact(@NotNull SBuild build, final @NotNull String artifactName) { final AtomicReference<String> locatedArtifactPath = new AtomicReference<String>(null); build.getArtifacts(BuildArtifactsViewMode.VIEW_ALL_WITH_ARCHIVES_CONTENT).iterateArtifacts(artifact -> { if(artifact.getName().equals(artifactName)){ locatedArtifactPath.set(artifact.getRelativePath()); return BuildArtifacts.BuildArtifactsProcessor.Continuation.BREAK; } else return BuildArtifacts.BuildArtifactsProcessor.Continuation.CONTINUE; }); return locatedArtifactPath.get(); }
Example #6
Source File: SQRPasswordProvider.java From TeamCity.SonarQubePlugin with Apache License 2.0 | 5 votes |
@NotNull public Collection<Parameter> getPasswordParameters(@NotNull final SBuild build) { final List<SQSInfo> servers = findSQSInfos(build.getBuildType()); final List<Parameter> list = new ArrayList<Parameter>(); for (final SQSInfo server : servers) { addParameterIfNeeded(list, server.getId(), server.getPassword(), Constants.SONAR_PASSWORD); addParameterIfNeeded(list, server.getId(), server.getJDBCPassword(), Constants.SONAR_SERVER_JDBC_PASSWORD); } return list; }
Example #7
Source File: BuildSummaryLinkExtension.java From TeamCity.SonarQubePlugin with Apache License 2.0 | 5 votes |
@Override public boolean isAvailable(@NotNull final HttpServletRequest request) { final SBuild build = BuildDataExtensionUtil.retrieveBuild(request, myServer); if (build == null) { return false; } final BuildArtifactHolder artifact = build.getArtifacts(BuildArtifactsViewMode.VIEW_HIDDEN_ONLY).findArtifact(Constants.SONAR_SERVER_URL_ARTIF_LOCATION_FULL); return artifact.isAvailable(); }
Example #8
Source File: AllureReportBuildSummaryExtension.java From allure-teamcity with Apache License 2.0 | 5 votes |
public boolean isAvailable(@NotNull final HttpServletRequest request) { final SBuild build = BuildDataExtensionUtil.retrieveBuild(request, server); if (Objects.isNull(build)) { return false; } final BuildArtifact artifact = build.getArtifacts(BuildArtifactsViewMode.VIEW_HIDDEN_ONLY) .getArtifact(AllureConstants.ALLURE_ARTIFACT_SUMMARY_LOCATION); return Objects.nonNull(artifact); }
Example #9
Source File: BuildSymbolsIndexProvider.java From teamcity-symbol-server with Apache License 2.0 | 4 votes |
public void generateMedatadata(@NotNull SBuild sBuild, @NotNull MetadataStorageWriter metadataStorageWriter) { final BuildArtifact symbols = sBuild.getArtifacts(BuildArtifactsViewMode.VIEW_HIDDEN_ONLY).getArtifact(".teamcity/symbols"); final long buildId = sBuild.getBuildId(); final Set<String> processedSymbols = new HashSet<>(); if(symbols != null){ for (BuildArtifact symbolSignaturesSource : symbols.getChildren()){ if (!symbolSignaturesSource.getName().startsWith(SymbolsConstants.SYMBOL_SIGNATURES_FILE_NAME_PREFIX) && !symbolSignaturesSource.getName().startsWith(SymbolsConstants.BINARY_SIGNATURES_FILE_NAME_PREFIX)) continue; final Set<PdbSignatureIndexEntry> indexEntries; try { indexEntries = PdbSignatureIndexUtil.read(symbolSignaturesSource.getInputStream(), false); } catch (Exception e) { LOG.warnAndDebugDetails(String.format( "Failed to read symbols index file %s of build %s", symbolSignaturesSource.getRelativePath(), LogUtil.describe(sBuild)), e); continue; } LOG.debug(String.format("Build with id %d provides %d symbol file signatures.", buildId, indexEntries.size())); for (final PdbSignatureIndexEntry indexEntry : indexEntries) { final String signature = indexEntry.getGuid(); final String fileName = indexEntry.getFileName(); final String metadataKey = getMetadataKey(signature, fileName); if (processedSymbols.contains(metadataKey)) continue; String artifactPath = indexEntry.getArtifactPath(); if(artifactPath == null){ LOG.debug(String.format("Artifact path is not provided for artifact %s, locating it by name in build %s artifacts.", fileName, LogUtil.describe(sBuild))); artifactPath = locateArtifact(sBuild, fileName); if(artifactPath != null){ LOG.debug(String.format("Located artifact by name %s, path - %s. Build - %s", fileName, artifactPath, LogUtil.describe(sBuild))); } } LOG.info(String.format( "Indexing symbol file %s with signature %s of build %s", fileName, signature, LogUtil.describe(sBuild) )); final HashMap<String, String> data = new HashMap<>(); data.put(SIGNATURE_KEY, signature); data.put(FILE_NAME_KEY, fileName); data.put(ARTIFACT_PATH_KEY, artifactPath); metadataStorageWriter.addParameters(metadataKey, data); mySymbolsCache.removeEntry(metadataKey); processedSymbols.add(metadataKey); } } } if (processedSymbols.isEmpty()) { LOG.debug("Build with id " + buildId + " doesn't provide symbols index data."); } }
Example #10
Source File: AnsibleRunResultsTab.java From tc-ansible-runner with MIT License | 4 votes |
@Override protected void fillModel(Map<String, Object> model, HttpServletRequest request, SBuild build) { // TODO Auto-generated method stub }
Example #11
Source File: AnsibleRunResultsTab.java From tc-ansible-runner with MIT License | 4 votes |
protected boolean isAvailable(@NotNull final HttpServletRequest request, @NotNull final SBuild build) { return build.getBuildType().getRunnerTypes().contains(AnsibleRunnerConstants.RUN_TYPE); }
Example #12
Source File: ReportsMain.java From appengine-tck with Apache License 2.0 | 4 votes |
@Nullable @Override public SBuild getSequenceBuild() { return null; }