-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(artifacts) Implement S3 artifacts (#5099)
* Implement S3 pipeline artifact * Add corresponding help text * remove copyright
- Loading branch information
1 parent
c7d9711
commit c119e9d
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
app/scripts/modules/core/src/pipeline/config/triggers/artifacts/s3/defaultS3.artifact.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { module } from 'angular'; | ||
|
||
import { PIPELINE_CONFIG_PROVIDER } from 'core/pipeline/config/pipelineConfigProvider'; | ||
import { IArtifact } from 'core/domain/IArtifact'; | ||
import { PipelineConfigProvider } from 'core/pipeline'; | ||
import { isNil } from 'lodash'; | ||
|
||
export const DEFAULT_S3_ARTIFACT = 'spinnaker.core.pipeline.trigger.artifact.defaultS3'; | ||
module(DEFAULT_S3_ARTIFACT, [ | ||
PIPELINE_CONFIG_PROVIDER, | ||
]).config((pipelineConfigProvider: PipelineConfigProvider) => { | ||
pipelineConfigProvider.registerArtifactKind({ | ||
label: 'S3', | ||
description: 'A S3 object.', | ||
key: 'default.s3', | ||
isDefault: true, | ||
isMatch: false, | ||
controller(artifact: IArtifact) { | ||
'ngInject'; | ||
this.artifact = artifact; | ||
this.artifact.type = 's3/object'; | ||
|
||
this.onReferenceChange = () => { | ||
const ref = this.artifact.reference; | ||
if (isNil(ref)) { | ||
return; | ||
} | ||
|
||
if (ref.indexOf('#') >= 0) { | ||
const split = ref.split('#'); | ||
this.artifact.name = split[0]; | ||
this.artifact.version = split[1]; | ||
} else { | ||
this.artifact.name = ref; | ||
} | ||
}; | ||
}, | ||
controllerAs: 'ctrl', | ||
template: ` | ||
<div class="col-md-12"> | ||
<div class="form-group row"> | ||
<label class="col-md-2 sm-label-right"> | ||
Object path | ||
<help-field key="pipeline.config.expectedArtifact.defaultS3.reference"></help-field> | ||
</label> | ||
<div class="col-md-8"> | ||
<input type="text" | ||
placeholder="s3://bucket/path/to/file" | ||
class="form-control input-sm" | ||
ng-change="ctrl.onReferenceChange()" | ||
ng-model="ctrl.artifact.reference"/> | ||
</div> | ||
</div> | ||
</div> | ||
`, | ||
}); | ||
}); | ||
|
41 changes: 41 additions & 0 deletions
41
app/scripts/modules/core/src/pipeline/config/triggers/artifacts/s3/s3.artifact.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { module } from 'angular'; | ||
|
||
import { PIPELINE_CONFIG_PROVIDER } from 'core/pipeline/config/pipelineConfigProvider'; | ||
import { IArtifact } from 'core/domain/IArtifact'; | ||
import { PipelineConfigProvider } from 'core/pipeline'; | ||
|
||
export const S3_ARTIFACT = 'spinnaker.core.pipeline.trigger.s3.artifact'; | ||
module(S3_ARTIFACT, [ | ||
PIPELINE_CONFIG_PROVIDER, | ||
]).config((pipelineConfigProvider: PipelineConfigProvider) => { | ||
pipelineConfigProvider.registerArtifactKind({ | ||
label: 'S3', | ||
description: 'An S3 object.', | ||
key: 's3', | ||
isDefault: false, | ||
isMatch: true, | ||
controller(artifact: IArtifact) { | ||
'ngInject'; | ||
this.artifact = artifact; | ||
this.artifact.type = 's3/object'; | ||
}, | ||
controllerAs: 'ctrl', | ||
template: ` | ||
<div class="col-md-12"> | ||
<div class="form-group row"> | ||
<label class="col-md-2 sm-label-right"> | ||
Object path | ||
<help-field key="pipeline.config.expectedArtifact.s3.name"></help-field> | ||
</label> | ||
<div class="col-md-8"> | ||
<input type="text" | ||
placeholder="s3://bucket/path/to/file" | ||
class="form-control input-sm" | ||
ng-model="ctrl.artifact.name"/> | ||
</div> | ||
</div> | ||
</div> | ||
`, | ||
}); | ||
}); | ||
|