blob: c9be5dcf30fb773e0d9eaf1103405fc191ccc27b [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.ci;
import org.apache.ignite.ci.analysis.LogCheckResult;
import org.apache.ignite.ci.analysis.SingleBuildRunCtx;
import org.apache.ignite.ci.tcmodel.agent.Agent;
import org.apache.ignite.ci.tcmodel.conf.BuildType;
import org.apache.ignite.ci.tcmodel.hist.BuildRef;
import org.apache.ignite.ci.tcmodel.result.Build;
import org.apache.ignite.ci.tcmodel.user.User;
import org.apache.ignite.ci.teamcity.pure.ITeamcityConn;
import org.apache.ignite.ci.util.Base64Util;
import org.apache.ignite.ci.util.FutureUtil;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
/**
* API for calling methods from REST service:
* https://confluence.jetbrains.com/display/TCD10/REST+API
*/
public interface ITeamcity extends ITeamcityConn {
public String DEFAULT = "<default>";
public String REFS_HEADS_MASTER = "refs/heads/master";
CompletableFuture<File> unzipFirstFile(CompletableFuture<File> fut);
CompletableFuture<File> downloadBuildLogZip(int id);
/**
* Returns log analysis. Does not keep not zipped logs on disk.
* @param buildId Build ID.
* @param ctx Build results.
* @return
*/
CompletableFuture<LogCheckResult> analyzeBuildLog(Integer buildId, SingleBuildRunCtx ctx);
void setExecutor(ExecutorService pool);
Executor getExecutor();
/**
* @param tok TeamCity authorization token.
*/
void setAuthToken(String tok);
/**
* @return {@code True} if TeamCity authorization token is available.
*/
boolean isTeamCityTokenAvailable();
default void setAuthData(String user, String pwd) {
setAuthToken(
Base64Util.encodeUtf8String(user + ":" + pwd));
}
User getUserByUsername(String username);
}