Esempio n. 1
0
 public ContinuousIntegrationServer(IEnviornmentVariables environmentVariables)
 {
     _environmentVariables = environmentVariables;
     _build    = new Lazy <string>(() => GetEnvironmentVariable("CI_BUILD_ID"));
     _buildUrl = new Lazy <string>(() => GetEnvironmentVariable("CI_BUILD_URL"));
     _job      = new Lazy <string>(() => GetEnvironmentVariable("CI_JOB_ID"));
 }
Esempio n. 2
0
 public Report(IReportOptions options, IEnviornmentVariables enviornmentVariables, ISourceCode sourceCode, ICoverage coverage)
 {
     _reportOptions       = new Lazy <IReportOptions>(() => options);
     EnviornmentVariables = enviornmentVariables;
     SourceCode           = sourceCode;
     Coverage             = coverage;
     _reporter            = new Lazy <string>(() => $"{Env}{Network}{CombinedCoverage}");
 }
Esempio n. 3
0
 public GitHubAction(IEnviornmentVariables environmentVariables)
     : base(environmentVariables)
 {
     _branch   = new Lazy <string>(LoadBranch);
     _build    = new Lazy <string>(() => GetEnvironmentVariable("GITHUB_RUN_ID"));
     _commit   = new Lazy <string>(() => GetEnvironmentVariable("GITHUB_SHA"));
     _detecter = new Lazy <bool>(() => CheckEnvironmentVariables("GITHUB_ACTIONS") || !string.IsNullOrWhiteSpace(GetEnvironmentVariable("GITHUB_ACTION")));
     _pr       = new Lazy <string>(LoadPullRequest);
     _slug     = new Lazy <string>(() => GetEnvironmentVariable("GITHUB_REPOSITORY"));
 }
Esempio n. 4
0
 public Query(IQueryOptions options, IEnumerable <IRepository> repositories, IBuild build, IYaml yaml, IEnviornmentVariables environmentVariables)
 {
     Options               = options;
     Repositories          = repositories;
     Build                 = build;
     Yaml                  = yaml;
     _environmentVariables = environmentVariables;
     SetQueryParameters();
     _getQuery = new Lazy <string>(() => string.Join("&", QueryParameters.Select(x => $"{x.Key}={x.Value ?? string.Empty}")));
 }
Esempio n. 5
0
 public TeamCity(IEnviornmentVariables environmentVariables)
     : base(environmentVariables)
 {
     _branch   = new Lazy <string>(() => GetEnvironmentVariable("TEAMCITY_BUILD_BRANCH"));
     _build    = new Lazy <string>(() => GetEnvironmentVariable("TEAMCITY_BUILD_ID"));
     _buildUrl = new Lazy <string>(LoadBuildUrl);
     _commit   = new Lazy <string>(LoadCommit);
     _detecter = new Lazy <bool>(LoadDetecter);
     _slug     = new Lazy <string>(LoadSlug);
 }
Esempio n. 6
0
 public Jenkins(IEnviornmentVariables environmentVariables)
     : base(environmentVariables)
 {
     _branch   = new Lazy <string>(() => GetFirstExistingEnvironmentVariable("ghprbSourceBranch", "GIT_BRANCH", "BRANCH_NAME"));
     _build    = new Lazy <string>(() => GetEnvironmentVariable("BUILD_NUMBER"));
     _buildUrl = new Lazy <string>(() => GetEnvironmentVariable("BUILD_URL"));
     _commit   = new Lazy <string>(() => GetFirstExistingEnvironmentVariable("ghprbActualCommit", "GIT_COMMIT"));
     _detecter = new Lazy <bool>(() => !string.IsNullOrWhiteSpace(GetEnvironmentVariable("JENKINS_URL")));
     _pr       = new Lazy <string>(() => GetFirstExistingEnvironmentVariable("ghprbPullId", "CHANGE_ID"));
 }
Esempio n. 7
0
 public UploadFacade(IContinuousIntegrationServer continuousIntegrationServer, IVersionControlSystem versionControlSystem, IYaml yaml, ICoverage coverage, IEnviornmentVariables enviornmentVariables, IUrl url, IUpload upload)
 {
     _continuousIntegrationServer = continuousIntegrationServer;
     _versionControlSystem        = versionControlSystem;
     _yaml                 = yaml;
     _coverage             = coverage;
     _enviornmentVariables = enviornmentVariables;
     _url    = url;
     _upload = upload;
 }
Esempio n. 8
0
 public AppVeyor(IEnviornmentVariables environmentVariables)
     : base(environmentVariables)
 {
     _branch   = new Lazy <string>(() => GetEnvironmentVariable("APPVEYOR_REPO_BRANCH"));
     _build    = new Lazy <string>(LoadBuild);
     _buildUrl = new Lazy <string>(LoadBuildUrl);
     _commit   = new Lazy <string>(() => GetEnvironmentVariable("APPVEYOR_REPO_COMMIT"));
     _detecter = new Lazy <bool>(() => CheckEnvironmentVariables("CI", "APPVEYOR"));
     _job      = new Lazy <string>(LoadJob);
     _pr       = new Lazy <string>(() => GetEnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER"));
     _slug     = new Lazy <string>(() => GetEnvironmentVariable("APPVEYOR_REPO_NAME"));
 }
Esempio n. 9
0
 public Travis(IEnviornmentVariables environmentVariables)
     : base(environmentVariables)
 {
     _branch   = new Lazy <string>(() => GetEnvironmentVariable("TRAVIS_BRANCH"));
     _build    = new Lazy <string>(() => GetEnvironmentVariable("TRAVIS_JOB_NUMBER"));
     _buildUrl = new Lazy <string>(() => GetEnvironmentVariable("TRAVIS_JOB_WEB_URL"));
     _commit   = new Lazy <string>(() => GetEnvironmentVariable("TRAVIS_COMMIT"));
     _detecter = new Lazy <bool>(() => CheckEnvironmentVariables("CI", "TRAVIS"));
     _job      = new Lazy <string>(() => GetEnvironmentVariable("TRAVIS_JOB_ID"));
     _pr       = new Lazy <string>(() => GetEnvironmentVariable("TRAVIS_PULL_REQUEST"));
     _slug     = new Lazy <string>(() => GetEnvironmentVariable("TRAVIS_REPO_SLUG"));
     _tag      = new Lazy <string>(() => GetEnvironmentVariable("TRAVIS_TAG"));
 }
Esempio n. 10
0
 public AzurePipelines(IEnviornmentVariables environmentVariables)
     : base(environmentVariables)
 {
     _branch    = new Lazy <string>(LoadBranch);
     _build     = new Lazy <string>(LoadBuild);
     _buildUrl  = new Lazy <string>(LoadBuildUrl);
     _commit    = new Lazy <string>(() => GetEnvironmentVariable("BUILD_SOURCEVERSION"));
     _detecter  = new Lazy <bool>(() => CheckEnvironmentVariables("TF_BUILD"));
     _job       = new Lazy <string>(() => GetEnvironmentVariable("BUILD_BUILDID"));
     _pr        = new Lazy <string>(() => GetEnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTNUMBER"));
     _project   = new Lazy <string>(() => GetEnvironmentVariable("SYSTEM_TEAMPROJECT"));
     _serverUri = new Lazy <string>(() => GetEnvironmentVariable("SYSTEM_TEAMFOUNDATIONSERVERURI"));
     _slug      = new Lazy <string>(() => GetEnvironmentVariable("BUILD_REPOSITORY_NAME"));
 }
Esempio n. 11
0
        public static IContinuousIntegrationServer Create(IEnviornmentVariables environmentVariables)
        {
            if (environmentVariables is null)
            {
                throw new ArgumentNullException(nameof(environmentVariables));
            }

            var assembly      = typeof(ContinuousIntegrationServerFactory).Assembly;
            var interfaceType = typeof(IContinuousIntegrationServer);

            var continuousServers = assembly.GetTypes().Where(t => t.IsClass && !t.IsAbstract && interfaceType.IsAssignableFrom(t) && t != typeof(ContinuousIntegrationServer));
            var buildServer       = GetFirstDetectedCiServer(continuousServers, environmentVariables);

            return(buildServer);
        }
Esempio n. 12
0
        private static IContinuousIntegrationServer GetFirstDetectedCiServer(IEnumerable <Type> supportedServers, IEnviornmentVariables environmentVariables)
        {
            foreach (var t in supportedServers)
            {
                var csi = t.GetConstructor(new[] { typeof(IEnviornmentVariables) });

                if (csi == null)
                {
                    continue;
                }

                var buildServer = (IContinuousIntegrationServer)csi.Invoke(new object[] { environmentVariables });
                if (buildServer.Detecter)
                {
                    return(buildServer);
                }
            }

            return(new ContinuousIntegrationServer(environmentVariables));
        }
Esempio n. 13
0
 public Host(IHostOptions options, IEnviornmentVariables environmentVariables)
 {
     Options  = options;
     _getHost = new Lazy <string>(LoadHost);
     _environmentVariables = environmentVariables;
 }