use of jetbrains.buildServer.parameters.ProcessingResult in project teamcity-rest by JetBrains.
the class BuildTypeRequest method getResolvedIfNecessary.
@NotNull
private String getResolvedIfNecessary(@NotNull final BuildTypeEx buildType, @Nullable final String value, @Nullable final Boolean resolveSupported) {
if (resolveSupported == null || !resolveSupported || StringUtil.isEmpty(value)) {
return value == null ? "" : value;
}
myPermissionChecker.checkProjectPermission(Permission.VIEW_BUILD_RUNTIME_DATA, buildType.getProjectId());
final ProcessingResult resolveResult = buildType.getValueResolver().resolve(value);
return resolveResult.getResult();
}
use of jetbrains.buildServer.parameters.ProcessingResult in project teamcity-rest by JetBrains.
the class BuildRequest method getResolvedIfNecessary.
@NotNull
private String getResolvedIfNecessary(@NotNull final BuildPromotion buildPromotion, @Nullable final String value, @Nullable final Boolean resolveSupported) {
// TeamCity API issue: no way to resolve params by promotion
final SBuild build = buildPromotion.getAssociatedBuild();
if (build == null || resolveSupported == null || !resolveSupported || StringUtil.isEmpty(value)) {
return value == null ? "" : value;
}
try {
// TeamCity API issue: ideally, API can check the permission inside build.getValueResolver() and allow to reference properties which are visible to viewer
myPermissionChecker.checkPermission(Permission.VIEW_BUILD_RUNTIME_DATA, buildPromotion);
} catch (AuthorizationFailedException e) {
// handle build number special case since it is visible to project viewer
String withResolvedBuildNumber = StringUtil.replace(value, ReferencesResolverUtil.makeReference(ServerProvidedProperties.BUILD_NUMBER_PROP), build.getBuildNumber());
if (!withResolvedBuildNumber.equals(value)) {
// there was a reference to build number
if (!build.getValueResolver().resolve(withResolvedBuildNumber).isModified()) {
// no other references
return withResolvedBuildNumber;
}
}
ProcessingResult resolveResult = build.getValueResolver().resolve(value);
if (!resolveResult.isModified() && resolveResult.isFullyResolved()) {
// no references found
return value;
}
// report original error
myPermissionChecker.checkPermission(Permission.VIEW_BUILD_RUNTIME_DATA, buildPromotion);
}
final ProcessingResult resolveResult = build.getValueResolver().resolve(value);
return resolveResult.getResult();
}
use of jetbrains.buildServer.parameters.ProcessingResult in project teamcity-git by JetBrains.
the class GitPathResolverImpl method resolveGitPath.
public String resolveGitPath(final BuildAgentConfiguration agentConfiguration, String pathToResolve) throws VcsException {
ValueResolver resolver = agentConfiguration.getParametersResolver();
ProcessingResult result = resolver.resolve(pathToResolve);
if (!result.isFullyResolved()) {
throw new VcsException("The value is not fully resolved: " + result.getResult());
}
return result.getResult();
}
Aggregations