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); } }
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()); }
private void RemoveJob(JenkinsView_v1 item, JenkinsJob_v1 job) { item.Remove(job); }
private void UpdateJob(JenkinsJob_v1 item, JenkinsJob job) { // TODO: not sure what to update... => Update Item.State }