本文整理汇总了TypeScript中core/registry.Registry.pipeline.mergeArtifactKind方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Registry.pipeline.mergeArtifactKind方法的具体用法?TypeScript Registry.pipeline.mergeArtifactKind怎么用?TypeScript Registry.pipeline.mergeArtifactKind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/registry.Registry.pipeline
的用法示例。
在下文中一共展示了Registry.pipeline.mergeArtifactKind方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: module
module(DEFAULT_HTTP_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'HTTP',
typePattern: ArtifactTypePatterns.HTTP_FILE,
type: 'http/file',
description: 'An HTTP artifact.',
key: 'default.http',
isDefault: true,
isMatch: false,
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'http/file';
if (this.artifact.name && !this.artifact.reference) {
this.artifact.reference = this.artifact.name;
}
},
controllerAs: 'ctrl',
template: `
<div class="col-md-12">
<div class="form-group row">
<label class="col-md-2 sm-label-right">
URL
</label>
<div class="col-md-8">
<input type="text"
placeholder="http://host/path/file.ext"
class="form-control input-sm"
ng-model="ctrl.artifact.reference" />
</div>
</div>
</div>
`,
});
});
示例2: module
module(S3_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'S3',
typePattern: ArtifactTypePatterns.S3_OBJECT,
type: 's3/object',
description: 'An S3 object.',
key: 's3',
isDefault: false,
isMatch: true,
controller: function(artifact: IArtifact) {
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>
`,
});
});
示例3: module
module(BASE64_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'Base64',
typePattern: ArtifactTypePatterns.EMBEDDED_BASE64,
type: 'embedded/base64',
description: 'An artifact that includes its referenced resource as part of its payload.',
key: 'base64',
isDefault: false,
isMatch: true,
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'embedded/base64';
},
controllerAs: 'ctrl',
template: `
<div class="col-md-12">
<div class="form-group row">
<label class="col-md-2 sm-label-right">
Name
</label>
<div class="col-md-8">
<input type="text"
placeholder="base64-artifact"
class="form-control input-sm"
ng-model="ctrl.artifact.name" />
</div>
</div>
</div>
`,
});
});
示例4: module
module(GITLAB_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'Gitlab',
typePattern: ArtifactTypePatterns.GITLAB_FILE,
type: 'gitlab/file',
description: 'A file stored in git, hosted by Gitlab.',
key: 'gitlab',
isDefault: false,
isMatch: true,
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'gitlab/file';
},
controllerAs: 'ctrl',
template: `
<div class="col-md-12">
<div class="form-group row">
<label class="col-md-2 sm-label-right">
File path
<help-field key="pipeline.config.expectedArtifact.git.name"></help-field>
</label>
<div class="col-md-8">
<input type="text"
placeholder="manifests/frontend.yaml"
class="form-control input-sm"
ng-model="ctrl.artifact.name"/>
</div>
</div>
</div>
`,
});
});
示例5: module
module(DOCKER_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'Docker',
typePattern: ArtifactTypePatterns.DOCKER_IMAGE,
type: 'docker/image',
isDefault: false,
isMatch: true,
description: 'A Docker image to be deployed.',
key: 'docker',
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'docker/image';
},
controllerAs: 'ctrl',
template: `
<div class="col-md-12">
<div class="form-group row">
<label class="col-md-2 sm-label-right">
Docker image
<help-field key="pipeline.config.expectedArtifact.docker.name"></help-field>
</label>
<div class="col-md-8">
<input type="text"
placeholder="gcr.io/project/image"
class="form-control input-sm"
ng-model="ctrl.artifact.name"/>
</div>
</div>
</div>
`,
});
});
示例6: module
module(DEFAULT_GITHUB_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'GitHub',
typePattern: ArtifactTypePatterns.GITLAB_FILE,
type: 'github/file',
description: 'A file stored in git, hosted by GitHub.',
key: 'default.github',
isDefault: true,
isMatch: false,
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'github/file';
const pathRegex = new RegExp('/repos/[^/]*/[^/]*/contents/(.*)$');
this.onReferenceChange = () => {
const results = pathRegex.exec(this.artifact.reference);
if (results !== null) {
this.artifact.name = results[1];
}
};
},
controllerAs: 'ctrl',
template: `
<div class="col-md-12">
<div class="form-group row">
<label class="col-md-3 sm-label-right">
Content URL
<help-field key="pipeline.config.expectedArtifact.defaultGithub.reference"></help-field>
</label>
<div class="col-md-8">
<input type="text"
placeholder="https://api.github.com/repos/$ORG/$REPO/contents/$FILEPATH"
class="form-control input-sm"
ng-change="ctrl.onReferenceChange()"
ng-model="ctrl.artifact.reference"/>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 sm-label-right">
Commit/Branch
<help-field key="pipeline.config.expectedArtifact.defaultGithub.version"></help-field>
</label>
<div class="col-md-3">
<input type="text"
placeholder="master"
class="form-control input-sm"
ng-model="ctrl.artifact.version"/>
</div>
</div>
</div>
`,
});
});
示例7: module
module(DEFAULT_GCS_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'GCS',
typePattern: ArtifactTypePatterns.GCS_OBJECT,
type: 'gcs/object',
description: 'A GCS object.',
key: 'default.gcs',
isDefault: true,
isMatch: false,
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'gcs/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.defaultGcs.reference"></help-field>
</label>
<div class="col-md-8">
<input type="text"
placeholder="gs://bucket/path/to/file"
class="form-control input-sm"
ng-change="ctrl.onReferenceChange()"
ng-model="ctrl.artifact.reference"/>
</div>
</div>
</div>
`,
});
});
示例8: module
module(DEFAULT_BITBUCKET_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'Bitbucket',
typePattern: ArtifactTypePatterns.BITBUCKET_FILE,
type: 'bitbucket/file',
description: 'A file stored in git, hosted by Bitbucket.',
key: 'default.bitbucket',
isDefault: true,
isMatch: false,
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'bitbucket/file';
const pathRegex = new RegExp('/1.0/repositories/[^/]*/[^/]*/raw/[^/]*/(.*)$');
this.onReferenceChange = () => {
const results = pathRegex.exec(this.artifact.reference);
if (results !== null) {
this.artifact.name = decodeURIComponent(results[1]);
}
};
},
controllerAs: 'ctrl',
template: `
<div class="col-md-12">
<div class="form-group row">
<label class="col-md-3 sm-label-right">
Content URL
<help-field key="pipeline.config.expectedArtifact.defaultBitbucket.reference"></help-field>
</label>
<div class="col-md-8">
<input type="text"
placeholder="https://api.bitbucket.org/1.0/repositories/$ORG/$REPO/raw/$VERSION/$FILEPATH"
class="form-control input-sm"
ng-change="ctrl.onReferenceChange()"
ng-model="ctrl.artifact.reference"/>
</div>
</div>
</div>
`,
});
});
示例9: module
module(DEFAULT_DOCKER_ARTIFACT, []).config(() => {
Registry.pipeline.mergeArtifactKind({
label: 'Docker',
typePattern: ArtifactTypePatterns.DOCKER_IMAGE,
type: 'docker/image',
isDefault: true,
isMatch: false,
description: 'A Docker image to be deployed.',
key: 'default.docker',
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'docker/image';
this.onReferenceChange = () => {
setNameAndVersionFromReference(this.artifact);
};
},
controllerAs: 'ctrl',
template: `
<div class="col-md-12">
<div class="form-group row">
<label class="col-md-2 sm-label-right">
Docker image
<help-field key="pipeline.config.expectedArtifact.defaultDocker.reference"></help-field>
</label>
<div class="col-md-8">
<input type="text"
placeholder="gcr.io/project/image@sha256:9efcc2818c9..."
class="form-control input-sm"
ng-change="ctrl.onReferenceChange()"
ng-model="ctrl.artifact.reference"/>
</div>
</div>
</div>
`,
});
});
示例10: module
module(HELM_ARTIFACT, []).config(() => {
const helmArtifact = {
label: 'Helm',
typePattern: ArtifactTypePatterns.HELM_CHART,
type: 'helm/chart',
isDefault: false,
isMatch: false,
description: 'A helm chart to be deployed',
key: 'helm',
controller: function(artifact: IArtifact) {
this.artifact = artifact;
this.artifact.type = 'helm/chart';
this.onAccountChange = () => {
this.artifact.artifactAccount = this.selectedArtifactAccount;
this.artifact.reference = this.selectedArtifactAccount;
ArtifactService.getArtifactNames('helm/chart', this.artifact.artifactAccount).then(names => {
this.chartNames = names;
});
this.chartVersions = [];
};
this.onNameChange = () => {
ArtifactService.getArtifactVersions('helm/chart', this.artifact.artifactAccount, this.artifact.name).then(
versions => {
this.chartVersions = versions;
},
);
};
AccountService.getArtifactAccounts().then(accounts => {
this.artifactAccounts = accounts
.filter(account => account.types.includes('helm/chart'))
.map(account => account.name);
if (artifact.artifactAccount) {
this.selectedArtifactAccount = accounts.filter(
account => account.types.includes('helm/chart') && account.name === this.artifact.artifactAccount,
)[0].name;
}
});
if (artifact.artifactAccount) {
ArtifactService.getArtifactNames('helm/chart', this.artifact.artifactAccount).then(names => {
this.chartNames = names;
});
if (artifact.name) {
ArtifactService.getArtifactVersions('helm/chart', this.artifact.artifactAccount, this.artifact.name).then(
versions => {
this.chartVersions = versions;
},
);
}
}
},
controllerAs: 'ctrl',
template: `
<div class="col-md-12">
<div class="form-group row">
<label class="col-md-2 sm-label-right">
Account
<help-field key="pipeline.config.expectedArtifact.helm.account"></help-field>
</label>
<div class="col-md-8">
<select class="form-control input-sm" ng-model="ctrl.selectedArtifactAccount"
ng-options="account for account in ctrl.artifactAccounts"
ng-change="ctrl.onAccountChange()">
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 sm-label-right">
Name
<help-field key="pipeline.config.expectedArtifact.helm.name"></help-field>
</label>
<div class="col-md-8">
<select class="form-control input-sm" ng-model="ctrl.artifact.name"
ng-options="name for name in ctrl.chartNames"
ng-change="ctrl.onNameChange()">
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 sm-label-right">
Version
<help-field key="pipeline.config.expectedArtifact.helm.version"></help-field>
</label>
<div class="col-md-8">
<select class="form-control input-sm" ng-model="ctrl.artifact.version"
ng-options="version for version in ctrl.chartVersions">
</select>
</div>
</div>
</div>
`,
};
Registry.pipeline.mergeArtifactKind({ ...helmArtifact, key: 'default.helm', isDefault: true });
Registry.pipeline.mergeArtifactKind({ ...helmArtifact, key: 'helm', isMatch: true });
});