Skip to content

Commit

Permalink
fix(triggers): do not allow manual definition of docker image in trig…
Browse files Browse the repository at this point in the history
…ger (#7561)
  • Loading branch information
maggieneterval committed Oct 24, 2019
1 parent f5bd98e commit 17232e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface IDockerImageAndTagSelectorProps {
onChange: (changes: IDockerImageAndTagChanges) => void;
deferInitialization?: boolean;
showDigest?: boolean;
allowManualDefinition?: boolean;
}

export interface IDockerImageAndTagSelectorState {
Expand Down Expand Up @@ -59,6 +60,7 @@ export class DockerImageAndTagSelector extends React.Component<
registry: '',
repository: '',
showDigest: true,
allowManualDefinition: true,
};

private images: IDockerImage[];
Expand All @@ -82,7 +84,7 @@ export class DockerImageAndTagSelector extends React.Component<
props.repository && props.repository.length ? [{ label: props.repository, value: props.repository }] : [];
const tagOptions = props.tag && props.tag.length ? [{ label: props.tag, value: props.tag }] : [];
const parsedImageId = DockerImageUtils.splitImageId(props.imageId);
const defineManually = Boolean(props.imageId && props.imageId.includes('${'));
const defineManually = props.allowManualDefinition && Boolean(props.imageId && props.imageId.includes('${'));

this.state = {
accountOptions,
Expand Down Expand Up @@ -409,6 +411,7 @@ export class DockerImageAndTagSelector extends React.Component<
public render() {
const {
account,
allowManualDefinition,
digest,
imageId,
organization,
Expand Down Expand Up @@ -447,7 +450,7 @@ export class DockerImageAndTagSelector extends React.Component<
<span className="field">
<Select
value={defineManually}
disabled={imagesLoading}
disabled={imagesLoading || !allowManualDefinition}
onChange={(o: Option<boolean>) => this.showManualInput(o.value)}
options={defineOptions}
clearable={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function DockerTriggerConfig(props: IDockerTriggerConfigProps) {
return (
<div className="form-horizontal">
<DockerImageAndTagSelector
allowManualDefinition={false}
specifyTagByRegex={true}
account={trigger.account}
organization={trigger.organization}
Expand Down

0 comments on commit 17232e6

Please sign in to comment.