Ejemplo n.º 1
0
        /// <summary>
        /// Creates a build job for a new commit received by a push event.
        /// Returns the job ID for the build job.
        /// </summary>
        public async Task <string> CreateBuildJobAsync(
            Project project,
            PushEventCommit newCommit,
            string buildResultCallbackUrl)
        {
            var projectJob = new ProjectJob
                             (
                newCommit.Commit.BuildRequestToken,
                newCommit.PushEvent.Repository.Owner.Name,
                project.Name,
                newCommit.PushEvent.Repository.Name,
                $"{project.Name}_Template",
                newCommit.Commit.Sha,
                project.PrivateFilePaths
                .Select(p => p.Path)
                .Concat(project.ImmutableFilePaths.Select(p => p.Path))
                .ToList(),
                project.TestClasses
                .OrderBy(tc => tc.Order)
                .Select(tc => tc.ClassName)
                .ToList(),
                buildResultCallbackUrl
                             );

            var jobId = await _jobQueueClient.EnqueueAsync <IProjectRunnerService>
                        (
                service => service.ExecuteProjectJobAsync
                (
                    projectJob,
                    _operationIdProvider.OperationId
                )
                        );

            return(jobId);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Creates a build job for a new commit received by a push event.
		/// Returns the job ID for the build job.
		/// </summary>
		public async Task<string> CreateBuildJobAsync(
			Project project,
			PushEventCommit newCommit,
			string buildResultCallbackUrl)
		{
			var projectJob = new ProjectJob
			(
				newCommit.Commit.BuildRequestToken,
				newCommit.PushEvent.Repository.Owner.Name,
				project.Name,
				newCommit.PushEvent.Repository.Name,
				$"{project.Name}_Template",
				newCommit.Commit.Sha,
				project.PrivateFilePaths
					.Select(p => p.Path)
					.Concat(project.ImmutableFilePaths.Select(p => p.Path))
					.ToList(),
				project.TestClasses
					.Select(tc => tc.ClassName)
					.ToList(),
				buildResultCallbackUrl
			);

			var jobId = await _jobQueueClient.EnqueueAsync<IProjectRunnerService>
			(
				service => service.ExecuteProjectJobAsync
				(
					projectJob,
					_operationIdProvider.OperationId
				)
			);

			return jobId;
		}