Beispiel #1
0
        private GitHubActions.Job ProcessIndividualJob(AzurePipelines.Job job, AzurePipelines.Resources resources)
        {
            GitHubActions.Job newJob = new GitHubActions.Job
            {
                name            = job.displayName,
                needs           = job.dependsOn,
                _if             = ProcessCondition(job.condition),
                runs_on         = ProcessPool(job.pool),
                strategy        = ProcessStrategy(job.strategy),
                container       = ProcessContainer(resources),
                env             = ProcessSimpleVariables(job.variables),
                timeout_minutes = job.timeoutInMinutes,
                steps           = ProcessSteps(job.steps)
            };

            if (newJob.steps == null & job.template != null)
            {
                //Initialize the array with no items
                job.steps = new AzurePipelines.Step[0];
                //Process the steps, adding the default checkout step
                newJob.steps = ProcessSteps(job.steps, true);
                //TODO: Find a way to allow GitHub jobs to reference another job as a template
                newJob.job_message += "Note: Azure DevOps template does not have an equivalent in GitHub Actions yet";
            }
            else if (newJob.steps == null && job.strategy?.runOnce?.deploy?.steps != null)
            {
                //Initialize the array with no items
                job.steps = new AzurePipelines.Step[0];
                //Process the steps, adding the default checkout step
                newJob.steps = ProcessSteps(job.strategy?.runOnce?.deploy?.steps, false);
                //TODO: Find a way to allow GitHub jobs to reference another job as a template
                newJob.job_message += "Note: Azure DevOps strategy>runOnce>deploy does not have an equivalent in GitHub Actions yet";
            }
            if (job.environment != null)
            {
                newJob.job_message += "Note: Azure DevOps job environment does not have an equivalent in GitHub Actions yet";
            }

            if (newJob._if != null)
            {
                if (newJob.job_message != null)
                {
                    newJob.job_message += Environment.NewLine;
                }
            }
            if (job.continueOnError)
            {
                newJob.continue_on_error = job.continueOnError;
            }

            return(newJob);
        }
        public GitHubActions.Job ProcessJob(AzurePipelines.Job job, AzurePipelines.Resources resources)
        {
            GeneralProcessing   generalProcessing = new GeneralProcessing(_verbose);
            VariablesProcessing vp = new VariablesProcessing(_verbose);
            StepsProcessing     sp = new StepsProcessing();

            GitHubActions.Job newJob = new GitHubActions.Job
            {
                name            = job.displayName,
                needs           = job.dependsOn,
                _if             = ConditionsProcessing.TranslateConditions(job.condition),
                runs_on         = generalProcessing.ProcessPool(job.pool),
                strategy        = generalProcessing.ProcessStrategy(job.strategy),
                container       = generalProcessing.ProcessContainer(resources),
                env             = vp.ProcessSimpleVariables(job.variables),
                timeout_minutes = job.timeoutInMinutes,
                steps           = sp.AddSupportingSteps(job.steps)
            };
            MatrixVariableName = generalProcessing.MatrixVariableName;
            VariableList       = vp.VariableList;

            if (newJob.steps == null & job.template != null)
            {
                //Initialize the array with no items
                job.steps = new AzurePipelines.Step[0];
                //Process the steps, adding the default checkout step
                newJob.steps = sp.AddSupportingSteps(job.steps, true);
                //TODO: There is currently no conversion path for templates
                newJob.job_message += "Note: Azure DevOps template does not have an equivalent in GitHub Actions yet";
            }
            else if (newJob.steps == null && job.strategy?.runOnce?.deploy?.steps != null)
            {
                //Initialize the array with no items
                job.steps = new AzurePipelines.Step[0];
                //Process the steps, adding the default checkout step
                newJob.steps = sp.AddSupportingSteps(job.strategy?.runOnce?.deploy?.steps, false);
                //TODO: There is currently no conversion path for templates
                newJob.job_message += "Note: Azure DevOps strategy>runOnce>deploy does not have an equivalent in GitHub Actions yet";
            }
            if (job.environment != null)
            {
                newJob.job_message += "Note: Azure DevOps job environment does not have an equivalent in GitHub Actions yet";
            }
            if (job.continueOnError == true)
            {
                newJob.continue_on_error = job.continueOnError;
            }

            return(newJob);
        }