示例#1
0
        private static async Task Run(DeployArgs parsedArgs)
        {
            var deploymentRepository = new BlobStorageDeploymentRepository(parsedArgs.YamsStorage);
            var appIdentity          = new AppIdentity(parsedArgs.AppId, parsedArgs.AppVersion);

            Console.WriteLine("Uploading binaries from: \"{0}\", to {1}", parsedArgs.BinariesPath, appIdentity);

            await deploymentRepository.UploadApplicationBinaries(appIdentity, parsedArgs.BinariesPath, ConflictResolutionMode.FailIfBinariesExist);

            Console.WriteLine("Binaries uploaded");

            var config = await deploymentRepository.FetchDeploymentConfig();

            Console.WriteLine("Current DeploymentConfig.json is:\n\r{0}", config.RawData());

            if (config.HasApplication(parsedArgs.AppId))
            {
                config = config.RemoveApplication(parsedArgs.AppId);
            }
            config = config.AddApplication(appIdentity, parsedArgs.ClusterId);
            Console.WriteLine("Writing new config:\n\r{0}", config.RawData());
            await deploymentRepository.PublishDeploymentConfig(config);

            Console.WriteLine("DeploymentConfig uploaded");
        }
示例#2
0
        private DeploymentStatus GetAllClustersDeploymentStatus(BlobStorageDeploymentRepository deploymentRepository)
        {
            var deploymentConfig             = deploymentRepository.FetchDeploymentConfig().Result;
            IEnumerable <string> clustersIds = deploymentConfig.ListClusters();
            var apps = new List <AppDeploymentStatus>();

            foreach (string clusterId in clustersIds)
            {
                var clusterStatus = deploymentRepository.FetchClusterDeploymentStatus(clusterId, ttlSeconds: ActiveSince).Result;
                apps.AddRange(clusterStatus.ListAll());
            }
            return(new DeploymentStatus(apps));
        }
        public async Task TestGetDeploymentConfigWhenTheFileIsNotThere()
        {
            DeploymentConfig deploymentConfig = await _deploymentRepository.FetchDeploymentConfig();

            Assert.False(deploymentConfig.ListApplications().Any());
        }