Skip to content

Commit

Permalink
feat(travis): allow travis stage to be featured flag off (#3638)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaslin committed May 5, 2017
1 parent 9fb93bc commit f3a64a3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
1 change: 1 addition & 0 deletions app/scripts/modules/core/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface IFeatures {
snapshots?: boolean;
dockerBake?: boolean;
pipelineTemplates?: boolean;
travis?: boolean;
[key: string]: any;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {PIPELINE_CONFIG_PROVIDER} from 'core/pipeline/config/pipelineConfigProvi
import {module, IScope} from 'angular';
import * as moment from 'moment';

import {SETTINGS} from 'core/config/settings';
import {IGOR_SERVICE, IgorService, BuildServiceType} from 'core/ci/igor.service';
import {IJobConfig, ParameterDefinitionList} from 'core/domain/IJobConfig';
import {IStage} from 'core/domain/IStage';
Expand Down Expand Up @@ -30,7 +31,6 @@ export class TravisStage {
private filterThreshold = 500;



constructor(public stage: any,
$scope: IScope,
private igorService: IgorService) {
Expand Down Expand Up @@ -147,27 +147,31 @@ module(TRAVIS_STAGE, [
IGOR_SERVICE,
PIPELINE_CONFIG_PROVIDER
]).config((pipelineConfigProvider: any) => {
pipelineConfigProvider.registerStage({
label: 'Travis',
description: 'Runs a Travis job',
key: 'travis',
restartable: true,
controller: 'TravisStageCtrl',
controllerAs: '$ctrl',
templateUrl: require('./travisStage.html'),
executionDetailsUrl: require('./travisExecutionDetails.html'),
executionLabelComponent: TravisExecutionLabel,
extraLabelLines: (stage: IStage) => {
if (!stage.masterStage.context || !stage.masterStage.context.buildInfo) {
return 0;
}
const lines = stage.masterStage.context.buildInfo.number ? 1 : 0;
return lines + (stage.masterStage.context.buildInfo.testResults || []).length;
},
defaultTimeoutMs: moment.duration(2, 'hours').asMilliseconds(),
validators: [
{type: 'requiredField', fieldName: 'job'},
],
strategy: true,
});

if (SETTINGS.feature.travis) {
pipelineConfigProvider.registerStage({
label: 'Travis',
description: 'Runs a Travis job',
key: 'travis',
restartable: true,
controller: 'TravisStageCtrl',
controllerAs: '$ctrl',
templateUrl: require('./travisStage.html'),
executionDetailsUrl: require('./travisExecutionDetails.html'),
executionLabelComponent: TravisExecutionLabel,
extraLabelLines: (stage: IStage) => {
if (!stage.masterStage.context || !stage.masterStage.context.buildInfo) {
return 0;
}
const lines = stage.masterStage.context.buildInfo.number ? 1 : 0;
return lines + (stage.masterStage.context.buildInfo.testResults || []).length;
},
defaultTimeoutMs: moment.duration(2, 'hours').asMilliseconds(),
validators: [
{type: 'requiredField', fieldName: 'job'},
],
strategy: true,
});
}

}).controller('TravisStageCtrl', TravisStage);
1 change: 1 addition & 0 deletions halconfig/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,6 @@ window.spinnakerSettings = {
roscoMode: true,
infrastructureStages: false,
snapshots: false,
travis: false,
},
};
1 change: 1 addition & 0 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ window.spinnakerSettings = {
infrastructureStages: process.env.INFRA_STAGES === 'enabled',
jobs: false,
snapshots: false,
travis: false,
},
};

0 comments on commit f3a64a3

Please sign in to comment.