Exemple #1
0
        internal string GetBranchPlanKey(string branch)
        {
            string bambooBranchName = ConvertBranchToBambooFormat(branch);

            try
            {
                string relUri = string.Join(
                    AuthenticatedWebClient.URI_SEPARATOR,
                    REST_API_BASE_URI,
                    string.Format(BRANCH_URI, mConfig.BambooPlan, bambooBranchName));

                string result = AuthenticatedWebClient.Get(
                    mConfig.BambooServer,
                    relUri,
                    mConfig.BambooUser,
                    mConfig.BambooPassword,
                    mQueryParams);

                if (string.IsNullOrEmpty(result))
                {
                    return(string.Empty);
                }

                BambooBranch bambooBranch =
                    JsonConvert.DeserializeObject <BambooBranch>(result);

                return(bambooBranch.Key);
            }
            catch (WebException e)
            {
                mLog.ErrorFormat(
                    "Unable to find the plan key for branch {0}: {1}",
                    bambooBranchName, e.Message);
                if (e.Response != null)
                {
                    mLog.ErrorFormat("Queried URI: {0}", e.Response.ResponseUri);
                }
                mLog.DebugFormat("Stack trace:{0}{1}", Environment.NewLine, e.StackTrace);
                return(string.Empty);
            }
        }
 string RetrieveTaskPage(string taskNumber)
 {
     try
     {
         return(AuthenticatedWebClient.Get(
                    mConfig.TtsServer,
                    TTS_TASK_RELATIVE_URI,
                    mConfig.TtsUser,
                    mConfig.TtsPassword,
                    BuildQueryParams(taskNumber)));
     }
     catch (WebException e)
     {
         mLog.ErrorFormat(
             "Unable to query TTS for task {0}: {1}", taskNumber, e.Message);
         if (e.Response != null)
         {
             mLog.ErrorFormat("Queried URI: {0}", e.Response.ResponseUri);
         }
         mLog.DebugFormat("Stack trace:{0}{1}", Environment.NewLine, e.StackTrace);
         return(string.Empty);
     }
 }
Exemple #3
0
        internal void EnqueueBuild(string branchPlanKey)
        {
            try
            {
                string relUri = string.Join(
                    AuthenticatedWebClient.URI_SEPARATOR,
                    REST_API_BASE_URI,
                    string.Format(QUEUE_URI, branchPlanKey));

                string result = AuthenticatedWebClient.Post(
                    mConfig.BambooServer,
                    relUri,
                    mConfig.BambooUser,
                    mConfig.BambooPassword,
                    mQueryParams);
            }
            catch (WebException e)
            {
                mLog.ErrorFormat(
                    "Unable to enqueue build for plan {0}: {1}", branchPlanKey, e.Message);
                mLog.DebugFormat("Stack trace:{0}{1}", Environment.NewLine, e.StackTrace);
                throw;
            }
        }