<commit_before>'use strict';

import { IGOR_SERVICE, BuildServiceType } from 'core/ci/igor.service';
import { JenkinsExecutionLabel } from './JenkinsExecutionLabel';
import { PIPELINE_CONFIG_PROVIDER } from 'core/pipeline/config/pipelineConfigProvider';

const angular = require('angular');

module.exports = angular
  .module('spinnaker.core.pipeline.stage.jenkinsStage', [IGOR_SERVICE, PIPELINE_CONFIG_PROVIDER])
  .config(function(pipelineConfigProvider) {
    pipelineConfigProvider.registerStage({
      label: 'Jenkins',
      description: 'Runs a Jenkins job',
      key: 'jenkins',
      restartable: true,
      controller: 'JenkinsStageCtrl',
      controllerAs: 'jenkinsStageCtrl',
      templateUrl: require('./jenkinsStage.html'),
      executionDetailsUrl: require('./jenkinsExecutionDetails.html'),
      executionLabelComponent: JenkinsExecutionLabel,
      extraLabelLines: stage => {
        if (!stage.masterStage.context || !stage.masterStage.context.buildInfo) {
          return 0;
        }
        let lines = stage.masterStage.context.buildInfo.number ? 1 : 0;
        return lines + (stage.masterStage.context.buildInfo.testResults || []).length;
      },
      defaultTimeoutMs: 2 * 60 * 60 * 1000, // 2 hours
      validators: [{ type: 'requiredField', fieldName: 'job' }],
      strategy: true,
    });
  })
  .controller('JenkinsStageCtrl', function($scope, stage, igorService) {
    $scope.stage = stage;
    $scope.stage.failPipeline = $scope.stage.failPipeline === undefined ? true : $scope.stage.failPipeline;
    $scope.stage.continuePipeline = $scope.stage.continuePipeline === undefined ? false : $scope.stage.continuePipeline;

    $scope.viewState = {
      mastersLoaded: false,
      mastersRefreshing: false,
      jobsLoaded: false,
      jobsRefreshing: false,
      failureOption: 'fail',
      markUnstableAsSuccessful: !!stage.markUnstableAsSuccessful,
      waitForCompletion: stage.waitForCompletion || stage.waitForCompletion === undefined,<commit_msg>feat(artifacts): Support Jenkins stages emitting artifacts (#5174)<commit_after>'use strict';

import { IGOR_SERVICE, BuildServiceType } from 'core/ci/igor.service';
import { JenkinsExecutionLabel } from './JenkinsExecutionLabel';
import { PIPELINE_CONFIG_PROVIDER } from 'core/pipeline/config/pipelineConfigProvider';

const angular = require('angular');

module.exports = angular
  .module('spinnaker.core.pipeline.stage.jenkinsStage', [IGOR_SERVICE, PIPELINE_CONFIG_PROVIDER])
  .config(function(pipelineConfigProvider) {
    pipelineConfigProvider.registerStage({
      label: 'Jenkins',
      description: 'Runs a Jenkins job',
      key: 'jenkins',
      restartable: true,
      controller: 'JenkinsStageCtrl',
      controllerAs: 'jenkinsStageCtrl',
      producesArtifacts: true,
      templateUrl: require('./jenkinsStage.html'),
      executionDetailsUrl: require('./jenkinsExecutionDetails.html'),
      executionLabelComponent: JenkinsExecutionLabel,
      extraLabelLines: stage => {
        if (!stage.masterStage.context || !stage.masterStage.context.buildInfo) {
          return 0;
        }
        let lines = stage.masterStage.context.buildInfo.number ? 1 : 0;
        return lines + (stage.masterStage.context.buildInfo.testResults || []).length;
      },
      defaultTimeoutMs: 2 * 60 * 60 * 1000, // 2 hours
      validators: [{ type: 'requiredField', fieldName: 'job' }],
      strategy: true,
    });
  })
  .controller('JenkinsStageCtrl', function($scope, stage, igorService) {
    $scope.stage = stage;
    $scope.stage.failPipeline = $scope.stage.failPipeline === undefined ? true : $scope.stage.failPipeline;
    $scope.stage.continuePipeline = $scope.stage.continuePipeline === undefined ? false : $scope.stage.continuePipeline;

    $scope.viewState = {
      mastersLoaded: false,
      mastersRefreshing: false,
      jobsLoaded: false,
      jobsRefreshing: false,
      failureOption: 'fail',
      markUnstableAsSuccessful: !!stage.markUnstableAsSuccessful,
      waitForCompletion: stage.waitForCompletion || stage.waitForCompletion === undefined,
{'fraction_non_alphanumeric': 0.1223091976516634, 'fraction_numerical': 0.007338551859099804, 'mean_word_length': 3.897005988023952, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3438731', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1149, 'n_words': 225}