private AppVeyorBuildStatus GetBuildStatus(BuildDefinitionSetting buildDefinitionSetting,
            CiEntryPointSetting ciEntryPointSetting)
        {
            var token = ciEntryPointSetting.GetPassword();
            var projectInfo = AppVeyorBuildDefinition.FromId(buildDefinitionSetting.Id);


            var serviceClient = CreateClient(ciEntryPointSetting.Url, token);

            var request = new GetProjectLastBuild
            {
                AccountName = projectInfo.AccountName,
                ProjectSlug = projectInfo.Slug
            };

            try
            {
                var response = serviceClient.Get(request);
                if (response.Build == null)
                {
                    throw new BuildDefinitionNotFoundException(buildDefinitionSetting);
                }

                return new AppVeyorBuildStatus(CreateProjectUrl(projectInfo), response.Project, response.Build,
                    buildDefinitionSetting);
            }
            catch (WebServiceException)
            {
                throw new BuildDefinitionNotFoundException(buildDefinitionSetting);
            }
        }
        public ConfigureServer(SirenOfShameSettings settings, CiEntryPointSetting ciEntryPointSetting)
        {
            _adding = ciEntryPointSetting == null;
            if (_adding)
            {
                ciEntryPointSetting = new CiEntryPointSetting();
            }

            Settings = settings;
            _ciEntryPointSetting = ciEntryPointSetting;

            IocContainer.Instance.Compose(this);

            InitializeComponent();

            _ciServerPanel.Visible = _adding;
            ICiEntryPoint[] ciEntryPoints = CIEntryPoints.ToArray();
            if (_adding)
            {
                _serverType.DataSource = ciEntryPoints;
            }
            else
            {
                SetServerType(ciEntryPointSetting.GetCiEntryPoint(settings));
            }

            _add.Text = _adding ? "Add" : "Update";
            _cancel.Visible = _adding;
        }
 public IEnumerable<AppVeyorBuildStatus> GetBuildsStatuses(CiEntryPointSetting ciEntryPointSetting,
     IEnumerable<BuildDefinitionSetting> watchedBuildDefinitions)
 {
     var parallelResult = from buildDefinitionSetting in watchedBuildDefinitions
         select GetBuildStatus(buildDefinitionSetting, ciEntryPointSetting);
     return parallelResult.AsParallel().ToList();
 }
 public ConfigureMock(SirenOfShameSettings settings, MockCiEntryPoint mockCiEntryPoint, CiEntryPointSetting ciEntryPointSetting)
     : base(settings)
 {
     InitializeComponent();
     _mockCiEntryPoint = mockCiEntryPoint;
     _ciEntryPointSetting = ciEntryPointSetting;
 }
 public ConfigureTravisCi(SirenOfShameSettings sosSettings, TravisCiEntryPoint travisCiEntryPoint, CiEntryPointSetting ciEntryPointSetting)
     : base(sosSettings)
 {
     _travisCiEntryPoint = travisCiEntryPoint;
     _ciEntryPointSetting = ciEntryPointSetting;
     InitializeComponent();
     LoadProjectList();
 }
 public ConfigureAppVeyor(SirenOfShameSettings sosSettings, AppVeyorCiEntryPoint appVeyorCiEntryPoint,
     CiEntryPointSetting ciEntryPointSetting)
     : base(sosSettings)
 {
     _appVeyorCiEntryPoint = appVeyorCiEntryPoint;
     InitializeComponent();
     _ciEntryPointSetting = ciEntryPointSetting;
     _url.Text = _ciEntryPointSetting.Url;
     _password.Text = _ciEntryPointSetting.GetPassword();
 }
 public MyTfsServer(CiEntryPointSetting ciEntryPointSetting)
 {
     try {
         _tfsConfigurationServer = GetTfsConfigurationServer(ciEntryPointSetting.Url, ciEntryPointSetting.UserName, ciEntryPointSetting.GetPassword());
         _tfsConfigurationServer.EnsureAuthenticated();
     } catch (TeamFoundationServiceUnavailableException ex) {
         _log.Debug(ex);
         throw new ServerUnavailableException(ex.Message, ex);
     }
 }
 public ConfigureTeamCity(SirenOfShameSettings sosSettings, TeamCityCiEntryPoint teamCityCiEntryPoint, CiEntryPointSetting ciEntryPointSetting)
     : base(sosSettings)
 {
     _teamCityCiEntryPoint = teamCityCiEntryPoint;
     InitializeComponent();
     _ciEntryPointSetting = ciEntryPointSetting;
     _url.Text = _ciEntryPointSetting.Url;
     _userName.Text = _ciEntryPointSetting.UserName;
     _password.Text = _ciEntryPointSetting.GetPassword();
     Load += OnLoad;
 }
Beispiel #9
0
 public ConfigureTfs(SirenOfShameSettings settings, TfsCiEntryPoint tfsCiEntryPoint, CiEntryPointSetting ciEntryPointSetting)
     : base(settings)
 {
     _tfsCiEntryPoint = tfsCiEntryPoint;
     InitializeComponent();
     _ciEntryPointSetting = ciEntryPointSetting;
     _url.Text = _ciEntryPointSetting.Url;
     someoneElse.Checked = !string.IsNullOrEmpty(_ciEntryPointSetting.UserName);
     username.Text = _ciEntryPointSetting.UserName;
     password.Text = _ciEntryPointSetting.GetPassword();
     DataBindAsync();
 }
 public ConfigureBuildBot(SirenOfShameSettings sosSettings, BuildBotCIEntryPoint BuildBotCiEntryPoint, CiEntryPointSetting ciEntryPointSetting)
     : base(sosSettings)
 {
     _BuildBotCiEntryPoint = BuildBotCiEntryPoint;
     InitializeComponent();
     _ciEntryPointSetting = ciEntryPointSetting;
     _url.Text = _ciEntryPointSetting.Url;
     _userName.Text = _ciEntryPointSetting.UserName;
     _password.Text = _ciEntryPointSetting.GetPassword();
     if (!string.IsNullOrEmpty(_url.Text))
     {
         ReloadProjects();
     }
 }
 public ConfigureHudson(SirenOfShameSettings sosSettings, HudsonCIEntryPoint hudsonCiEntryPoint, CiEntryPointSetting ciEntryPointSetting)
     : base(sosSettings)
 {
     _hudsonCiEntryPoint = hudsonCiEntryPoint;
     InitializeComponent();
     _ciEntryPointSetting = ciEntryPointSetting;
     _url.Text = _ciEntryPointSetting.Url;
     _userName.Text = _ciEntryPointSetting.UserName;
     _password.Text = _ciEntryPointSetting.GetPassword();
     _treatUnstableAsSuccess.Checked = _ciEntryPointSetting.TreatUnstableAsSuccess;
     if (!string.IsNullOrEmpty(_url.Text))
     {
         ReloadProjects();
     }
 }
 public async Task<IEnumerable<TfsRestBuildStatus>> GetBuildsStatuses(CiEntryPointSetting ciEntryPointSetting, BuildDefinitionSetting[] watchedBuildDefinitions)
 {
     var connection = new TfsConnectionDetails(ciEntryPointSetting);
     var buildDefinitionsByProjectCollection = watchedBuildDefinitions.GroupBy(bd => bd.Parent);
     List<TfsRestBuildStatus> resultingBuildStatuses = new List<TfsRestBuildStatus>();
     foreach (var buildDefinitionGroup in buildDefinitionsByProjectCollection)
     {
         var projectCollection = buildDefinitionGroup.Key;
         var buildQueryParams = GetBuildQueryParams(buildDefinitionGroup.ToArray());
         var projects = await _tfsJsonService.GetBuildsStatuses(connection, buildQueryParams, projectCollection);
         await _commentsCache.FetchNewComments(projects, connection, tfsJsonBuilds => GetComment(tfsJsonBuilds, connection, projectCollection));
         var buildStatuses = projects.Select(i => new TfsRestBuildStatus(i, _commentsCache));
         resultingBuildStatuses.AddRange(buildStatuses);
     }
     return resultingBuildStatuses;
 }
        private TravisCiBuildStatus GetBuildStatus(CiEntryPointSetting ciEntryPointSetting, BuildDefinitionSetting buildDefinitionSetting)
        {
            var webClient = new WebClient();
            var authToken = ciEntryPointSetting.GetPassword();
            AddTravisHeaders(webClient, authToken);
            var travisBuildDef = TravisCiBuildDefinition.FromIdString(buildDefinitionSetting.Id);
            var buildDefinitionUrl = GetUrl(ciEntryPointSetting.Url, travisBuildDef.OwnerName, travisBuildDef.ProjectName);

            try
            {
                var json = webClient.DownloadString(buildDefinitionUrl);
                var lastBuildId = GetJsonValue(json, "last_build_id");
                var buildUrl = string.Format("{0}builds/{1}", ciEntryPointSetting.Url, lastBuildId);
                json = webClient.DownloadString(buildUrl);
                return new TravisCiBuildStatus(travisBuildDef, json, buildDefinitionSetting);
            }
            catch (WebException webException)
            {
                throw WebClientXml.ToServerUnavailableException(buildDefinitionUrl, webException);
            }
        }
 private HudsonBuildStatus GetBuildStatus(BuildDefinitionSetting buildDefinitionSetting, CiEntryPointSetting ciEntryPointSetting)
 {
     string userName = ciEntryPointSetting.UserName;
     string password = ciEntryPointSetting.GetPassword();
     var rootUrl = GetRootUrl(ciEntryPointSetting.Url);
     var treatUnstableAsSuccess = ciEntryPointSetting.TreatUnstableAsSuccess;
     
     string url = rootUrl + "/job/" + buildDefinitionSetting.Id + "/api/xml";
     try
     {
         XDocument doc = DownloadXml(url, userName, password);
         if (doc.Root == null)
         {
             return new HudsonBuildStatus(null, buildDefinitionSetting, "Could not get project status", treatUnstableAsSuccess);
         }
         var lastBuildElem = doc.Root.Element("lastBuild");
         if (lastBuildElem == null)
         {
             return new HudsonBuildStatus(null, buildDefinitionSetting, "No project builds found", treatUnstableAsSuccess);
         }
         var buildNumber = lastBuildElem.ElementValueOrDefault("number");
         var buildUrl = rootUrl + "/job/" + buildDefinitionSetting.Id + "/" + buildNumber;
         if (string.IsNullOrWhiteSpace(buildUrl)) throw new Exception("Could not get build url");
         buildUrl += "/api/xml";
         doc = DownloadXml(buildUrl, userName, password);
         if (doc.Root == null) throw new Exception("Could not get project build status");
         return GetBuildStatusAndCommentsFromXDocument(buildDefinitionSetting, doc, treatUnstableAsSuccess);
     }
     catch (SosException ex)
     {
         if (ex.Message.ToLower(CultureInfo.CurrentCulture).Contains("not_found"))
         {
             throw new BuildDefinitionNotFoundException(buildDefinitionSetting);
         }
         throw;
     }
 }
 public IEnumerable<TravisCiBuildStatus> GetBuildsStatuses(CiEntryPointSetting ciEntryPointSetting, IEnumerable<BuildDefinitionSetting> watchedBuildDefinitions)
 {
     var parallelResult = watchedBuildDefinitions.Select(buildDefinitionSetting => GetBuildStatus(ciEntryPointSetting, buildDefinitionSetting));
     return parallelResult.AsParallel().ToList();
 }
 public ConfigureServerBase CreateConfigurationWindow(SirenOfShameSettings settings, CiEntryPointSetting ciEntryPointSetting)
 {
     return new ConfigureHudson(settings, this, ciEntryPointSetting);
 }
 public static bool Show(SirenOfShameSettings settings, CiEntryPointSetting ciEntryPointSetting)
 {
     ConfigureServer configureServer = new ConfigureServer(settings, ciEntryPointSetting);
     var anyChanges = configureServer.ShowDialog() != DialogResult.Cancel;
     return anyChanges;
 }
 public TfsConnectionDetails(CiEntryPointSetting ciEntryPointSetting)
 {
     BaseUrl = ciEntryPointSetting.Url;
     Username = ciEntryPointSetting.UserName;
     Password = ciEntryPointSetting.GetPassword();
 }
 public ConfigureServerBase CreateConfigurationWindow(SirenOfShameSettings settings,
     CiEntryPointSetting ciEntryPointSetting)
 {
     ciEntryPointSetting.Url = APP_VEYOR_API_BASE_URL;
     return new ConfigureAppVeyor(settings, this, ciEntryPointSetting);
 }