- Make sure to send the subdirectory when restarting a build

- Make sure to use the subdirectory to read the Dockerfile's location in a build package, and display the path
- Nicer UI for showing the trigger description in the build view
- Fix an NPE in the file change tree
This commit is contained in:
Joseph Schorr 2014-03-05 16:27:56 -05:00
parent 3006b7b749
commit 89d9bcd894
8 changed files with 51 additions and 8 deletions

View file

@ -818,9 +818,23 @@ function BuildPackageCtrl($scope, Restangular, ApiService, $routeParams, $rootSc
// itself (should) be the Dockerfile.
if (zipFiles && Object.keys(zipFiles).length) {
// Load the dockerfile contents.
var dockerfile = zip.file('Dockerfile');
var dockerfilePath = 'Dockerfile';
if ($scope.repobuild['job_config']) {
var dockerfileFolder = ($scope.repobuild['job_config']['build_subdir'] || '');
if (dockerfileFolder[0] == '/') {
dockerfileFolder = dockerfileFolder.substr(1);
}
if (dockerfileFolder[dockerfileFolder.length - 1] == '/') {
dockerfileFolder = dockerfileFolder.substr(0, dockerfileFolder.length - 1);
}
dockerfilePath = dockerfileFolder + 'Dockerfile';
}
var dockerfile = zip.file(dockerfilePath);
if (dockerfile) {
$scope.dockerFileContents = dockerfile.asText();
$scope.dockerFilePath = dockerfilePath;
}
// Build the zip file tree.
@ -835,6 +849,7 @@ function BuildPackageCtrl($scope, Restangular, ApiService, $routeParams, $rootSc
});
} else {
$scope.dockerFileContents = response;
$scope.dockerFilePath = 'Dockerfile';
}
$scope.loaded = true;
@ -953,8 +968,14 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope
$scope.restartBuild = function(build) {
$('#confirmRestartBuildModal').modal('hide');
var subdirectory = '';
if (build['job_config']) {
subdirectory = build['job_config']['build_subdir'] || '';
}
var data = {
'file_id': build['resource_key']
'file_id': build['resource_key'],
'subdirectory': subdirectory
};
var params = {