Exemplo n.º 1
0
        public JenkinsTests(ITestOutputHelper testOutputHelper)
        {
            LogSettings.RegisterDefaultLogger <XUnitLogger>(LogLevels.Verbose, testOutputHelper);
            var testUriString = Environment.GetEnvironmentVariable("jenkins_test_uri") ?? "https://jenkins.qa.ubuntu.com/";

            if (string.IsNullOrEmpty(testUriString))
            {
                throw  new ArgumentNullException("jenkins_test_uri");
            }
            var testUri = new Uri(testUriString);

            _jenkinsApi = JenkinsClient.Create(testUri);
            var username = Environment.GetEnvironmentVariable("jenkins_test_username");
            var apiKey   = Environment.GetEnvironmentVariable("jenkins_test_apikey");

            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(apiKey))
            {
                _hasCredentials = true;
                _jenkinsApi.SetBasicAuthentication(username, apiKey);
            }
            else
            {
                _hasCredentials = false;
            }
            _jenkinsApi.Settings.IgnoreSslCertificateErrors = true;
        }
Exemplo n.º 2
0
 private static void DownloadArtifact(IJenkinsClient client, string jobName, int buildNumber, string fileName)
 {
     using var stream     = client.Artifacts.Get(jobName, buildNumber.ToString(), fileName);
     using var fileStream = new FileStream($"./" + fileName, FileMode.Create,
                                           FileAccess.Write);
     stream.CopyTo(fileStream);
     Log.Information("Downloaded artifact to: " + fileStream.Name);
 }
 public BuildIntentHandler(IJenkinsClient jenkinsClient, string environmentName)
 {
     _jenkinsClient   = jenkinsClient;
     _environmentName = environmentName;
 }
 public void TestInitialize()
 {
     _jenkinsClient = Substitute.For <IJenkinsClient>();
     _processor     = new BuildInfoProcessor(_jenkinsClient);
 }
Exemplo n.º 5
0
 public IntentHandlerFactory(IJenkinsClient jenkinsClient)
 {
     _jenkinsClient = jenkinsClient;
 }
Exemplo n.º 6
0
 /// <summary>Initializes a new instance of the <see cref="BuildInfoProcessor"/> class.</summary>
 public BuildInfoProcessor(IJenkinsClient jenkinsClient)
 {
     _jenkinsClient = jenkinsClient;
 }
Exemplo n.º 7
0
 public TriggerJenkinsJob(IDialogService dialogService, ILogger logger, IJenkinsClient jenkinsClient)
 {
     _logger        = Preconditions.CheckNotNull(logger, nameof(logger));
     _dialogService = Preconditions.CheckNotNull(dialogService, nameof(dialogService));
     _jenkinsClient = Preconditions.CheckNotNull(jenkinsClient, nameof(jenkinsClient));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a new instance of <see cref="ProgressiveTextReader"/>
 /// attached to the specified Jenkins Job.
 /// </summary>
 /// <param name="client">The Jenkins client to use for network operations.</param>
 /// <param name="jobName">The name of the Jenkins Job.</param>
 /// <param name="buildNumber">The build-number of the running Jenkins Job.</param>
 public ProgressiveTextReader(IJenkinsClient client, string jobName, string buildNumber)
 {
     this.client      = client ?? throw new ArgumentNullException(nameof(client));
     this.jobName     = jobName ?? throw new ArgumentNullException(nameof(jobName));
     this.buildNumber = buildNumber ?? throw new ArgumentNullException(nameof(buildNumber));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a new JobRunner using the provided Jenkins-Client.
 /// </summary>
 public JenkinsJobRunner(IJenkinsClient client)
 {
     this.client = client ?? throw new ArgumentNullException(nameof(client));
 }
Exemplo n.º 10
0
 public JenkinsJobMonitor(IJenkinsClient jenkinsClient)
 {
     _jenkinsClient = Preconditions.CheckNotNull(jenkinsClient, nameof(jenkinsClient));
 }