Skip to content

Commit

Permalink
feat(rosco): Allow roscoMode per stage/execution (#7564)
Browse files Browse the repository at this point in the history
* fix(awsbake): Fix exception if an unlisted baseOs is used

* feat(bake): Support roscoSelector(stage) to determine roscoMode
  • Loading branch information
alanmquach authored and mergify[bot] committed Oct 25, 2019
1 parent ca176fc commit c2bbf20
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ module.exports = angular

$scope.viewState = {
loading: true,
roscoMode: SETTINGS.feature.roscoMode,
roscoMode:
SETTINGS.feature.roscoMode ||
(typeof SETTINGS.feature.roscoSelector === 'function' && SETTINGS.feature.roscoSelector($scope.stage)),
minRootVolumeSize: AWSProviderSettings.minRootVolumeSize,
showVmTypeSelector: true,
};
Expand Down Expand Up @@ -85,6 +87,15 @@ module.exports = angular

if (!$scope.stage.baseOs && $scope.baseOsOptions && $scope.baseOsOptions.length) {
$scope.stage.baseOs = $scope.baseOsOptions[0].id;
} else if (
$scope.stage.baseOs &&
!($scope.baseOsOptions || []).find(baseOs => baseOs.id === $scope.stage.baseOs)
) {
$scope.baseOsOptions.push({
id: $scope.stage.baseOs,
detailedDescription: 'Custom',
vmTypes: ['hvm', 'pv'],
});
}
if (!$scope.stage.baseLabel && $scope.baseLabelOptions && $scope.baseLabelOptions.length) {
$scope.stage.baseLabel = $scope.baseLabelOptions[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ module.exports = angular
let initialized = () => {
$scope.detailsSection = $stateParams.details;
$scope.provider = $scope.stage.context.cloudProviderType || 'aws';
$scope.roscoMode = SETTINGS.feature.roscoMode;
$scope.roscoMode =
SETTINGS.feature.roscoMode ||
(typeof SETTINGS.feature.roscoSelector === 'function' &&
SETTINGS.feature.roscoSelector($scope.stage.context));
$scope.bakeryDetailUrl = $interpolate(SETTINGS.bakeryDetailUrl);
$scope.bakeFailedNoError =
get($scope.stage, 'context.status.result') === 'FAILURE' && !$scope.stage.failureMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ module.exports = angular
if (!$scope.stage.baseLabel && $scope.baseLabelOptions && $scope.baseLabelOptions.length) {
$scope.stage.baseLabel = $scope.baseLabelOptions[0];
}
$scope.viewState.roscoMode = SETTINGS.feature.roscoMode;
$scope.viewState.roscoMode =
SETTINGS.feature.roscoModeSETTINGS.feature.roscoMode ||
(typeof SETTINGS.feature.roscoSelector === 'function' && SETTINGS.feature.roscoSelector($scope.stage));
$scope.viewState.loading = false;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ module.exports = angular
let initialized = () => {
$scope.detailsSection = $stateParams.details;
$scope.provider = $scope.stage.context.cloudProviderType || 'azure';
$scope.roscoMode = SETTINGS.feature.roscoMode;
$scope.roscoMode =
SETTINGS.feature.roscoMode ||
(typeof SETTINGS.feature.roscoSelector === 'function' &&
SETTINGS.feature.roscoSelector($scope.stage.context));
$scope.bakeryDetailUrl = $interpolate(SETTINGS.bakeryDetailUrl);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ module.exports = angular
const initialized = () => {
$scope.detailsSection = $stateParams.details;
$scope.provider = $scope.stage.context.cloudProviderType || 'gce';
$scope.roscoMode = SETTINGS.feature.roscoMode;
$scope.roscoMode =
SETTINGS.feature.roscoMode ||
(typeof SETTINGS.feature.roscoSelector === 'function' &&
SETTINGS.feature.roscoSelector($scope.stage.context));
$scope.bakeryDetailUrl = $interpolate(SETTINGS.bakeryDetailUrl);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ module.exports = angular
if (!$scope.stage.baseLabel && $scope.baseLabelOptions && $scope.baseLabelOptions.length) {
$scope.stage.baseLabel = $scope.baseLabelOptions[0];
}
$scope.viewState.roscoMode = SETTINGS.feature.roscoMode;
$scope.viewState.roscoMode =
SETTINGS.feature.roscoModeSETTINGS.feature.roscoMode ||
(typeof SETTINGS.feature.roscoSelector === 'function' && SETTINGS.feature.roscoSelector($scope.stage));
$scope.showAdvancedOptions = showAdvanced();
$scope.viewState.loading = false;
});
Expand Down

0 comments on commit c2bbf20

Please sign in to comment.