Beispiel #1
0
        public async Task <HttpResponseMessage> GetBuildDetails(string jobName, int buildNo)
        {
            try
            {
                MLPExecutionLogger.Info("CTPhantom", "Getting build details, Params:" + jobName + "," + buildNo + ", IP: " + HttpContext.Current.Request.UserHostAddress + ", Client: " + HttpContext.Current.Request.Url.AbsoluteUri);

                var jenkins_client = Client.Create(MLPConstants.JenkinsHost, MLPConstants.JenkinsUsername, MLPConstants.JenkinsPassword);

                var response = await jenkins_client.GetBuildDetails(jobName, buildNo);

                return(Request.CreateResponse(HttpStatusCode.OK, response));
            }
            catch (Exception ex)
            {
                MLPExecutionLogger.Error("CTPhantom", ex.Message);

                return(Request.CreateResponse(HttpStatusCode.OK, ex.Message));
            }
        }
Beispiel #2
0
        public async Task <HttpResponseMessage> RunCTAlgorithm(HttpRequestMessage request)
        {
            try
            {
                //Logging Info
                MLPExecutionLogger.Info("CTPhantom", "Calling Jenkins Job, IP: " + HttpContext.Current.Request.UserHostAddress + ", Client: " + HttpContext.Current.Request.Url.AbsoluteUri);

                MongoDBWrapper mongoBase = new MongoDBWrapper();

                var jsonString = await request.Content.ReadAsStringAsync();

                BsonDocument collection = BsonDocument.Parse(jsonString);

                var result = await mongoBase.RunJenkinsJob(collection);

                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (Exception ex)
            {
                MLPExecutionLogger.Error("CTPhantom", ex.Message);

                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }