Example #1
0
        public static AppVeyorProjectBuild AppVeyorProjectLastSuccessfulBuild(this ICakeContext context, AppVeyorSettings settings, string accountName, string projectSlug, string branch = null, int?beforeBuildId = null)
        {
            var appVeyor = AppVeyorClient.Create(settings.ApiToken);

            AppVeyorProjectBuild lastSuccess = null;
            int?startBuildId = beforeBuildId;

            while (lastSuccess == null)
            {
                var history = appVeyor.GetProjectHistory(accountName, projectSlug, 2, startBuildId: startBuildId).Result;

                if (history == null || history.Builds == null || history.Builds.Count <= 0)
                {
                    break;
                }

                foreach (var build in history.Builds)
                {
                    if (build.Status.Equals("success", StringComparison.OrdinalIgnoreCase))
                    {
                        lastSuccess = new AppVeyorProjectBuild {
                            Project = history.Project,
                            Build   = build,
                        };
                        break;
                    }
                }

                startBuildId = history.Builds.Last().BuildId;
            }

            return(lastSuccess);
        }
Example #2
0
        /// <summary>
        /// Cancels a Deployment
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="deploymentId">The identifier of the Deployment to cancel.</param>
        public static void AppVeyorCancelDeployment(this ICakeContext context, string appVeyorApiToken, int deploymentId)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            appVeyor.CancelDeployment(new AppVeyorCancelDeploymentRequest {
                DeploymentId = deploymentId
            }).Wait();
        }
Example #3
0
        /// <summary>
        /// Starts a build for the given GitHub pull request
        /// </summary>
        /// <returns>The build that was started.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="accountName">The account name.</param>
        /// <param name="projectSlug">The project slug.</param>
        /// <param name="pullRequestId">The GitHub pull request id.</param>
        public static AppVeyorBuild AppVeyorStartBuildPullRequest(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug, int pullRequestId)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.StartBuildPullRequest(new AppVeyorBuildRequestPullRequest {
                AccountName = accountName,
                PullRequestId = pullRequestId,
                ProjectSlug = projectSlug
            }).Result);
        }
Example #4
0
        /// <summary>
        /// Starts a build for a specific commit
        /// </summary>
        /// <returns>The build that was started.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="accountName">The account name.</param>
        /// <param name="projectSlug">The project slug.</param>
        /// <param name="commitId">The commit hash to build.</param>
        /// <param name="branch">The branch.</param>
        public static AppVeyorBuild AppVeyorStartBuildSpecificCommit(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug, string commitId, string branch = "master")
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.StartBuildSpecificCommit(new AppVeyorBuildRequestSpecificCommit {
                AccountName = accountName,
                Branch = branch ?? "master",
                CommitId = commitId,
                ProjectSlug = projectSlug
            }).Result);
        }
Example #5
0
        /// <summary>
        /// Starts a build from the latest commit
        /// </summary>
        /// <returns>The build that was started.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="accountName">The account name.</param>
        /// <param name="projectSlug">The project slug.</param>
        /// <param name="branch">The branch.</param>
        /// <param name="environmentVariables">The environment variables.</param>
        public static AppVeyorBuild AppVeyorStartBuildLatestCommit(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug, string branch = null, Dictionary <string, string> environmentVariables = null)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.StartBuildLatestCommit(new AppVeyorBuildRequestLatestCommit {
                AccountName = accountName,
                Branch = branch,
                EnvironmentVariables = environmentVariables ?? new Dictionary <string, string> (),
                ProjectSlug = projectSlug
            }).Result);
        }
Example #6
0
        /// <summary>
        /// Starts a Deployment
        /// </summary>
        /// <returns>The deployment that was started.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="accountName">The account name.</param>
        /// <param name="projectSlug">The project slug.</param>
        /// <param name="environmentName">The environment name to deploy to.</param>
        /// <param name="buildVersion">The build version to deploy.</param>
        /// <param name="buildJobId">The build job identifier (optional).</param>
        /// <param name="environmentVariables">The environment variables.</param>
        public static AppVeyorDeployment AppVeyorStartDeployment(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug, string environmentName, string buildVersion, string buildJobId = null, Dictionary <string, string> environmentVariables = null)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.StartDeployment(new AppVeyorStartDeploymentRequest {
                AccountName = accountName,
                BuildJobId = buildJobId,
                BuildVersion = buildVersion,
                EnvironmentName = environmentName,
                EnvironmentVariables = environmentVariables ?? new Dictionary <string, string> (),
                ProjectSlug = projectSlug
            }).Result);
        }
Example #7
0
        public static List <AppVeyorProject> AppVeyorProjects(this ICakeContext context, AppVeyorSettings settings)
        {
            var appVeyor = AppVeyorClient.Create(settings.ApiToken);

            return(appVeyor.GetProjects().Result);
        }
Example #8
0
        public static void AppVeyorClearCache(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            appVeyor.ClearCache(accountName, projectSlug).Wait();
        }
Example #9
0
        /// <summary>
        /// Gets Deployments for the given Environment
        /// </summary>
        /// <returns>The deployments for the given environment.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="deploymentEnvironmentId">The identifier of the environment to get deployments of.</param>
        public static AppVeyorEnvironmentDeployments AppVeyorEnvironmentDeployments(this ICakeContext context, string appVeyorApiToken, int deploymentEnvironmentId)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.GetEnvironmentDeployments(deploymentEnvironmentId).Result);
        }
Example #10
0
        /// <summary>
        /// Gets the Deployments for a given project
        /// </summary>
        /// <returns>The project's Deployments.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="accountName">The account name.</param>
        /// <param name="projectSlug">The project slug.</param>
        public static AppVeyorProjectDeployments AppVeyorProjectDeployments(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.GetProjectDeployments(accountName, projectSlug).Result);
        }
Example #11
0
        /// <summary>
        /// Cancels a build
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="accountName">The account name.</param>
        /// <param name="projectSlug">The project slug.</param>
        /// <param name="buildVersion">The build version of the build to cancel.</param>
        public static void AppVeyorCancelBuild(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug, string buildVersion)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            appVeyor.CancelBuild(accountName, projectSlug, buildVersion).Wait();
        }
Example #12
0
        /// <summary>
        /// Gets the project build by version
        /// </summary>
        /// <returns>The veyor project build by version.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="accountName">The account name.</param>
        /// <param name="projectSlug">The project slug.</param>
        /// <param name="buildVersion">The build version.</param>
        public static AppVeyorProjectBuild AppVeyorProjectBuildByVersion(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug, string buildVersion)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.GetProjectBuildByVersion(accountName, projectSlug, buildVersion).Result);
        }
Example #13
0
        /// <summary>
        /// Gets the last build on the specified branch of the project
        /// </summary>
        /// <returns>The project's last successful build on the branch.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API Token.</param>
        /// <param name="accountName">The account name.</param>
        /// <param name="projectSlug">The project slug.</param>
        /// <param name="branch">The branch.</param>
        public static AppVeyorProjectBuild AppVeyorProjectLastBranchBuild(this ICakeContext context, string appVeyorApiToken, string accountName, string projectSlug, string branch)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.GetProjectLastBranchBuild(accountName, projectSlug, branch).Result);
        }
Example #14
0
        public static List <AppVeyorProject> AppVeyorProjects(this ICakeContext context, string appVeyorApiToken)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.GetProjects().Result);
        }
Example #15
0
        /// <summary>
        /// Gets the specified Deployment
        /// </summary>
        /// <returns>The deployment.</returns>
        /// <param name="context">The context.</param>
        /// <param name="appVeyorApiToken">The API token.</param>
        /// <param name="deploymentId">The id of the deployment to get.</param>
        public static AppVeyorProjectDeployment AppVeyorDeployment(this ICakeContext context, string appVeyorApiToken, int deploymentId)
        {
            var appVeyor = AppVeyorClient.Create(appVeyorApiToken);

            return(appVeyor.GetDeployment(deploymentId).Result);
        }
Example #16
0
        public static AppVeyorProjectHistory AppVeyorProjectHistory(this ICakeContext context, AppVeyorSettings settings, string accountName, string projectSlug, int recordsPerPage, int?startBuildId = null, string branch = null)
        {
            var appVeyor = AppVeyorClient.Create(settings.ApiToken);

            return(appVeyor.GetProjectHistory(accountName, projectSlug, recordsPerPage, startBuildId, branch).Result);
        }
Example #17
0
        public static AppVeyorProjectBuild AppVeyorProjectLastBuild(this ICakeContext context, AppVeyorSettings settings, string accountName, string projectSlug)
        {
            var appVeyor = AppVeyorClient.Create(settings.ApiToken);

            return(appVeyor.GetProjectLastBuild(accountName, projectSlug).Result);
        }