feat(build runner): added in context, dockerfile_location
this is a new feature meant to allow people to use any file as a dockerfile and any folder as a context directory
This commit is contained in:
parent
90b130fe16
commit
e6d201e0b0
29 changed files with 531 additions and 111 deletions
|
@ -257,9 +257,10 @@
|
|||
|
||||
<dockerfile-path-select
|
||||
current-path="$ctrl.local.dockerfilePath"
|
||||
paths="$ctrl.local.dockerfileLocations.subdir"
|
||||
paths="$ctrl.local.dockerfileLocations.dockerfile_paths"
|
||||
supports-full-listing="true"
|
||||
is-valid-path="$ctrl.local.hasValidDockerfilePath"></dockerfile-path-select>
|
||||
is-valid-path="$ctrl.local.hasValidDockerfilePath">
|
||||
</dockerfile-path-select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-8 col-md-8 col-sm-12 main-col"
|
||||
|
@ -268,10 +269,44 @@
|
|||
</div>
|
||||
<div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col">
|
||||
<p>Please select the location containing the Dockerfile to be built.</p>
|
||||
<p>The build context will start at the location selected.</p>
|
||||
</div>
|
||||
</linear-workflow-section><!-- /Section: Dockerfile Location -->
|
||||
|
||||
<!-- Section: Context Location -->
|
||||
<linear-workflow-section class="row"
|
||||
section-id="contextlocation"
|
||||
section-title="Select Docker Context"
|
||||
section-valid="$ctrl.local.hasValidContextLocation">
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
|
||||
ng-if="$ctrl.local.dockerfileLocations.status == 'error'">
|
||||
<div class="co-alert co-alert-warning">
|
||||
{{ $ctrl.local.dockerfileLocations.message }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.dockerfileLocations.status == 'success'">
|
||||
<h3>Select Context</h3>
|
||||
<strong>
|
||||
Please select the context for the docker build
|
||||
</strong>
|
||||
|
||||
<context-path-select
|
||||
current-context="$ctrl.local.dockerContext"
|
||||
current-path="$ctrl.local.dockerfilePath"
|
||||
contexts="$ctrl.local.contexts"
|
||||
is-valid-context="$ctrl.local.hasValidContextLocation">
|
||||
</context-path-select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-8 col-md-8 col-sm-12 main-col"
|
||||
ng-if="!$ctrl.local.dockerfileLocations">
|
||||
<span class="cor-loader-inline"></span> Retrieving Dockerfile locations
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col">
|
||||
<p>Please select a docker context.</p>
|
||||
</div>
|
||||
</linear-workflow-section><!-- /Section: Context Location -->
|
||||
|
||||
<!-- Section: Robot Account -->
|
||||
<linear-workflow-section class="row"
|
||||
section-id="verification"
|
||||
|
|
|
@ -80,7 +80,14 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
|||
|
||||
this.$scope.$watch(() => this.local.dockerfilePath, (path) => {
|
||||
if (path && this.local.selectedRepository) {
|
||||
this.checkDockerfilePath(this.local.selectedRepository, path);
|
||||
this.setPossibleContexts(path);
|
||||
this.checkDockerfilePath(this.local.selectedRepository, path, this.local.dockerContext);
|
||||
}
|
||||
});
|
||||
|
||||
this.$scope.$watch(() => this.local.dockerContext, (context) => {
|
||||
if (context && this.local.selectedRepository) {
|
||||
this.checkDockerfilePath(this.local.selectedRepository, this.local.dockerfilePath, context);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -117,7 +124,8 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
|||
public createTrigger(): void {
|
||||
var config: any = {
|
||||
build_source: this.local.selectedRepository.full_name,
|
||||
subdir: this.local.dockerfilePath.substr(1) // Remove starting /
|
||||
dockerfile_path: this.local.dockerfilePath,
|
||||
context: this.local.dockerContext
|
||||
};
|
||||
|
||||
if (this.local.triggerOptions.hasBranchTagFilter &&
|
||||
|
@ -271,6 +279,7 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
|||
|
||||
private loadDockerfileLocations(repository: any): void {
|
||||
this.local.dockerfilePath = null;
|
||||
this.local.dockerContext = null;
|
||||
|
||||
var params = {
|
||||
'repository': this.repository.namespace + '/' + this.repository.name,
|
||||
|
@ -301,7 +310,7 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
|||
[]);
|
||||
}
|
||||
|
||||
private checkDockerfilePath(repository: any, path: string): void {
|
||||
private checkDockerfilePath(repository: any, path: string, context: string): void {
|
||||
this.local.triggerAnalysis = null;
|
||||
this.local.robotAccount = null;
|
||||
|
||||
|
@ -312,7 +321,8 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
|||
|
||||
var config = {
|
||||
'build_source': repository.full_name,
|
||||
'subdir': path.substr(1)
|
||||
'dockerfile_path': path.substr(1),
|
||||
'context': context
|
||||
};
|
||||
|
||||
var data = {
|
||||
|
@ -325,6 +335,12 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
|||
this.buildOrderedRobotAccounts();
|
||||
}, this.ApiService.errorDisplay('Could not analyze trigger'));
|
||||
}
|
||||
|
||||
private setPossibleContexts(path){
|
||||
if(this.local.dockerfileLocations.contextMap){
|
||||
this.local.contexts = this.local.dockerfileLocations.contextMap[path] || [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue