예제 #1
0
        public async Task TriggerJobAsync(JenkinsJob_v1 jenkinsPlugin)
        {
            var api = jenkinsPlugin.IsParameterized ? BuildWithParametersApi(jenkinsPlugin) : "build?token=" + jenkinsPlugin.ApiToken;

            var crumb = jenkinsPlugin.CSRF ? await IssueCrumbAsync(jenkinsPlugin).ConfigureAwait(false) : null;

            using (var jenkinsRequest = new JenkinsRequest(jenkinsPlugin))
            {
                await jenkinsRequest.PostAsync(jenkinsPlugin, api, false, crumb).ConfigureAwait(false);
            }
        }
예제 #2
0
        private static string BuildWithParametersApi(JenkinsJob_v1 jenkinsPlugin)
        {
            var sb = new StringBuilder("buildWithParameters?delay=0sec");

            foreach (var parameter in jenkinsPlugin.BuildParameters)
            {
                if (parameter == null || string.IsNullOrWhiteSpace(parameter.Name) || string.IsNullOrWhiteSpace(parameter.Value))
                {
                    continue;
                }

                sb.Append("&");
                sb.Append(WebUtility.UrlEncode(parameter.Name));
                sb.Append("=");
                sb.Append(WebUtility.UrlEncode(parameter.Value));
            }

            return(sb.ToString());
        }
예제 #3
0
 private void RemoveJob(JenkinsView_v1 item, JenkinsJob_v1 job)
 {
     item.Remove(job);
 }
예제 #4
0
 private void UpdateJob(JenkinsJob_v1 item, JenkinsJob job)
 {
     // TODO: not sure what to update... => Update Item.State
 }