public VstsArtifactsHelper(IBuildClient buildClient, IReleaseClient releaseClient, IGitClient gitClient, Guid projectId, string repoName)
 {
     this.buildClient   = buildClient;
     this.releaseClient = releaseClient;
     this.gitClient     = gitClient;
     this.projectId     = projectId;
     this.repoName      = repoName;
 }
Esempio n. 2
0
 public TestableServiceBusQueueMessageHandler(IServiceBusQueueMessageListener serviceBusQueueMessageListener, IVstsScheduleHandler <TestVstsMessage> handler, ServiceBusQueueMessageHandlerSettings settings, ILogger logger, ITaskClient taskClient, IBuildClient buildClient, IJobStatusReportingHelper jobStatusReportingHelper, IReleaseClient releaseClient)
     : base(serviceBusQueueMessageListener, handler, settings, logger)
 {
     this.taskClient               = taskClient;
     this.buildClient              = buildClient;
     this.releaseClient            = releaseClient;
     this.jobStatusReportingHelper = jobStatusReportingHelper;
 }
Esempio n. 3
0
 public static async Task DeleteAppDirectoryAsync(this IBuildClient buildClient)
 {
     if (buildClient is BuildClient client)
     {
         await client
         .RunSshAsync(ssh => ssh.DeleteDirectoryAsync(buildClient.AppName))
         .ConfigureAwait(continueOnCapturedContext: false);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Creates a new <see cref="Gw2WebApiV2Client"/>.
        /// </summary>
        /// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param>
        /// <param name="gw2Client">The Guild Wars 2 client.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connection"/> or <paramref name="gw2Client"/> is <c>null</c>.</exception>
        protected internal Gw2WebApiV2Client(IConnection connection, IGw2Client gw2Client)
            : base(connection, gw2Client)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }
            if (gw2Client == null)
            {
                throw new ArgumentNullException(nameof(gw2Client));
            }

            this.account        = new AccountClient(connection, gw2Client);
            this.achievements   = new AchievementsClient(connection, gw2Client);
            this.backstory      = new BackstoryClient(connection, gw2Client);
            this.build          = new BuildClient(connection, gw2Client);
            this.characters     = new CharactersClient(connection, gw2Client);
            this.colors         = new ColorsClient(connection, gw2Client);
            this.commerce       = new CommerceClient(connection, gw2Client);
            this.continents     = new ContinentsClient(connection, gw2Client);
            this.createSubtoken = new CreateSubtokenClient(connection, gw2Client);
            this.currencies     = new CurrenciesClient(connection, gw2Client);
            this.dailyCrafting  = new DailyCraftingClient(connection, gw2Client);
            this.dungeons       = new DungeonsClient(connection, gw2Client);
            this.emblem         = new EmblemClient(connection, gw2Client);
            this.emotes         = new EmotesClient(connection, gw2Client);
            this.files          = new FilesClient(connection, gw2Client);
            this.finishers      = new FinishersClient(connection, gw2Client);
            this.gliders        = new GlidersClient(connection, gw2Client);
            this.guild          = new GuildClient(connection, gw2Client);
            this.home           = new HomeClient(connection, gw2Client);
            this.items          = new ItemsClient(connection, gw2Client);
            this.itemstats      = new ItemstatsClient(connection, gw2Client);
            this.legends        = new LegendsClient(connection, gw2Client);
            this.mailCarriers   = new MailCarriersClient(connection, gw2Client);
            this.mapChests      = new MapChestsClient(connection, gw2Client);
            this.maps           = new MapsClient(connection, gw2Client);
            this.masteries      = new MasteriesClient(connection, gw2Client);
            this.materials      = new MaterialsClient(connection, gw2Client);
            this.minis          = new MinisClient(connection, gw2Client);
            this.mounts         = new MountsClient(connection, gw2Client);
            this.novelties      = new NoveltiesClient(connection, gw2Client);
            this.outfits        = new OutfitsClient(connection, gw2Client);
            this.pets           = new PetsClient(connection, gw2Client);
            this.professions    = new ProfessionsClient(connection, gw2Client);
            this.pvp            = new PvpClient(connection, gw2Client);
            this.quaggans       = new QuaggansClient(connection, gw2Client);
            this.quests         = new QuestsClient(connection, gw2Client);
            this.races          = new RacesClient(connection, gw2Client);
            this.raids          = new RaidsClient(connection, gw2Client);
            this.recipes        = new RecipesClient(connection, gw2Client);
            this.skills         = new SkillsClient(connection, gw2Client);
            this.tokenInfo      = new TokenInfoClient(connection, gw2Client);
            this.worldBosses    = new WorldBossesClient(connection, gw2Client);
        }
Esempio n. 5
0
        public BuildJob(ICloudStampyLogger logger, CloudStampyParameters cloudStampyArgs)
        {
            _logger = logger;
            _args   = cloudStampyArgs;

            if (!string.IsNullOrWhiteSpace(_args.DpkPath))
            {
                _buildClient = new LabMachineBuildClient(_logger, _args);
            }
            else
            {
                _buildClient = new OneBranchBuildClient(_logger, _args);
            }
        }
        public static async Task <bool> IsBuildValid(IBuildClient buildClient, Guid projectId, int buildId, CancellationToken cancellationToken)
        {
            try
            {
                var build = await buildClient.GetBuildAsync(projectId, buildId, cancellationToken).ConfigureAwait(false);

                if (build != null && build.Status.HasValue && build.Status.Value != BuildStatus.Cancelling && build.Status.Value != BuildStatus.Completed && build.Status.Value != BuildStatus.Postponed)
                {
                    return(true);
                }
            }
            catch (BuildNotFoundException)
            {
            }

            return(false);
        }
Esempio n. 7
0
        internal static async Task <bool> IsSessionValid(VstsMessage vstsMessage, IBuildClient buildClient, IReleaseClient releaseClient, CancellationToken cancellationToken)
        {
            var projectId = vstsMessage.ProjectId;

            if (vstsMessage.VstsHub == HubType.Build)
            {
                var buildId = vstsMessage.BuildProperties.BuildId;
                return(await BuildClient.IsBuildValid(buildClient, projectId, buildId, cancellationToken).ConfigureAwait(false));
            }

            if (vstsMessage.VstsHub == HubType.Release)
            {
                var releaseId = vstsMessage.ReleaseProperties.ReleaseId;
                return(await ReleaseClient.IsReleaseValid(releaseClient, projectId, releaseId, cancellationToken).ConfigureAwait(false));
            }

            throw new NotSupportedException(string.Format("VstsHub {0} is not supported", vstsMessage.VstsHub));
        }
Esempio n. 8
0
 public TeamCityBuildMonitor(IBuildClient client, params string[] buildTypeIds)
 {
     Client = client;
     BuildTypeIds = buildTypeIds;
 }
Esempio n. 9
0
        public BuildChain(IBuildClient buildClient, Build rootBuild)
        {
            _buildClient = buildClient;

            InitGraph(rootBuild);
        }
Esempio n. 10
0
 internal void SetBuildClient(IBuildClient buildClient)
 {
     _buildClient = buildClient;
 }
Esempio n. 11
0
        private static async Task ProcessTestMessage(MockServiceBusMessage mockServiceBusMessage = null, MockServiceBusQueueMessageListener mockMessageListener = null, MockTaskClient mockTaskClient = null, MockVstsHandler handler = null, MockVstsReportingHelper mockReportingHelper = null, IBrokerInstrumentation instrumentation = null, int maxRetryAttempts = 1, IBuildClient mockBuildClient = null, IGitClient mockGitClient = null)
        {
            mockServiceBusMessage = mockServiceBusMessage ?? CreateMockMessage(CreateValidTestVstsMessage());
            mockTaskClient        = mockTaskClient ?? new MockTaskClient();
            mockBuildClient       = mockBuildClient ?? new MockBuildClient()
            {
                MockBuild = new Build()
                {
                    Status = BuildStatus.InProgress
                }
            };
            mockReportingHelper = mockReportingHelper ?? new MockVstsReportingHelper(new TestVstsMessage());
            var mockReleaseClient = new MockReleaseClient()
            {
                MockRelease = new Release()
                {
                    Status = ReleaseStatus.Active
                }
            };

            handler = handler ?? new MockVstsHandler {
                MockExecuteFunc = (vstsMessage) => Task.FromResult(new VstsScheduleResult()
                {
                    Message = "(test) mock execute requested", ScheduledId = "someId", ScheduleFailed = false
                })
            };
            instrumentation = instrumentation ?? new TraceBrokerInstrumentation();
            var settings = new ServiceBusQueueMessageHandlerSettings {
                MaxRetryAttempts = maxRetryAttempts, TimeLineNamePrefix = "someTimeline", WorkerName = "someWorker"
            };

            mockMessageListener = mockMessageListener ?? new MockServiceBusQueueMessageListener();
            var schedulingBroker = new ServiceBusQueueMessageHandler <TestVstsMessage>(queueClient: mockMessageListener, baseInstrumentation: instrumentation, scheduleHandler: handler, settings: settings);

            schedulingBroker.CreateTaskClient          = (uri, creds, instrumentationHandler, skipRaisePlanEvents) => mockTaskClient;
            schedulingBroker.CreateBuildClient         = (uri, creds) => mockBuildClient;
            schedulingBroker.CreateReleaseClient       = (uri, creds) => mockReleaseClient;
            schedulingBroker.CreateVstsReportingHelper = (vstsMessage, inst, props) => mockReportingHelper;
            var cancelSource = new CancellationTokenSource();
            await schedulingBroker.ReceiveAsync(mockServiceBusMessage, cancelSource.Token);
        }
        private static async Task ProcessTestMessage(MockServiceBusMessage mockServiceBusMessage = null, MockServiceBusQueueMessageListener mockMessageListener = null, MockTaskClient mockTaskClient = null, MockVstsHandler handler = null, MockJobStatusReportingHelper mockReportingHelper = null, ILogger logger = null, int maxRetryAttempts = 1, IBuildClient mockBuildClient = null)
        {
            mockServiceBusMessage = mockServiceBusMessage ?? CreateMockMessage(CreateValidTestVstsMessage());
            mockTaskClient        = mockTaskClient ?? new MockTaskClient();
            mockBuildClient       = mockBuildClient ?? new MockBuildClient()
            {
                MockBuild = new Build()
                {
                    Status = BuildStatus.InProgress
                }
            };
            mockReportingHelper = mockReportingHelper ?? new MockJobStatusReportingHelper(new TestVstsMessage());
            var mockReleaseClient = new MockReleaseClient()
            {
                MockRelease = new Release()
                {
                    Status = ReleaseStatus.Active
                }
            };

            handler = handler ?? new MockVstsHandler {
                MockExecuteFunc = (vstsMessage) => Task.FromResult(new VstsScheduleResult()
                {
                    Message = "(test) mock execute requested", ScheduledId = "someId", ScheduleFailed = false
                })
            };
            logger = logger ?? new TraceLogger();
            var settings = new ServiceBusQueueMessageHandlerSettings {
                MaxRetryAttempts = maxRetryAttempts, TimeLineNamePrefix = "someTimeline", WorkerName = "someWorker"
            };

            mockMessageListener = mockMessageListener ?? new MockServiceBusQueueMessageListener();
            var schedulingBroker = new TestableServiceBusQueueMessageHandler(mockMessageListener, handler, settings, logger, mockTaskClient, mockBuildClient, mockReportingHelper, mockReleaseClient);
            var cancelSource     = new CancellationTokenSource();
            await schedulingBroker.ReceiveAsync(mockServiceBusMessage, cancelSource.Token);
        }