Esempio n. 1
0
        public TriggeredBuildDto TriggerBuild(BuildRepository builds, UserDto user, TriggerBuildRequestDto request)
        {
            int newId    = builds.All().Items.Max(i => Int32.Parse(i.Id)) + 1;
            var newBuild = new BuildDto
            {
                Id            = newId.ToString(),
                BuildTypeId   = request.BuildType.Id,
                Status        = BuildStatus.UNKNOWN,
                State         = "queued",
                BranchName    = request.BranchName,
                DefaultBranch = true,
                BuildType     = request.BuildType,
                QueuedDate    = DateTime.UtcNow.ToString(Constants.TEAMCITY_DATETIME_FORMAT),
                Triggered     = new TriggeredDto
                {
                    User = user
                },
                Comment = new BuildCommentDto
                {
                    User      = user,
                    Timestamp = DateTime.UtcNow.ToString(Constants.TEAMCITY_DATETIME_FORMAT),
                    Text      = request.Comment?.Text
                },
                Properties = request.Properties
            };

            this.Add(newBuild);
            builds.Add(newBuild);

            return(new TriggeredBuildDto
            {
                Id = newId,
                BuildTypeId = request.BuildType.Id
            });
        }
Esempio n. 2
0
        #pragma warning disable IDE0060
        public TagsDto Tags(BuildRepository builds, string id)
        {
            var tags = builds.All().Items
                       .Where(build => build.Tags != null)
                       .SelectMany(build => build.Tags.Tag);

            return(new TagsDto
            {
                Tag = tags.ToList()
            });
        }
Esempio n. 3
0
 public DataBuilder()
 {
     Builds             = new BuildRepository();
     BuildAgents        = new BuildAgentRepository();
     BuildAgentPools    = new BuildAgentPoolRepository();
     BuildQueue         = new BuildQueue();
     BuildTypes         = new BuildTypeRepository();
     Changes            = new ChangeRepository();
     Investigations     = new InvestigationRepository();
     ProblemOccurrences = new ProblemOccurrenceRepository();
     Projects           = new ProjectRepository();
     TestOccurrences    = new TestOccurrenceRepository();
     Users            = new UserRepository();
     VcsRoots         = new VcsRootRepository();
     VcsRootInstances = new VcsRootInstanceRepository();
 }