Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spinnaker/docker

Package Overview
Dependencies
Maintainers
11
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spinnaker/docker - npm Package Compare versions

Comparing version 0.0.71 to 0.0.72

2

lib/lib.js

@@ -1,2 +0,2 @@

!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory(require("@spinnaker/core")):"function"==typeof define&&define.amd?define("@spinnaker/docker",["@spinnaker/core"],factory):"object"==typeof exports?exports["@spinnaker/docker"]=factory(require("@spinnaker/core")):root["@spinnaker/docker"]=factory(root["@spinnaker/core"])}(window,(function(__WEBPACK_EXTERNAL_MODULE__1__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(1&mode&&(value=__webpack_require__(value)),8&mode)return value;if(4&mode&&"object"==typeof value&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value}),2&mode&&"string"!=typeof value)for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=11)}([function(module,exports){module.exports=require("react")},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE__1__},function(module,exports){module.exports=require("lodash")},function(module,exports){module.exports=require("react-select")},function(module,exports){module.exports=require("angular")},function(module,exports){module.exports=require("rxjs")},function(module,exports){var path="docker/src/pipeline/stages/bake/bakeStage.html";window.angular.module("ng").run(["$templateCache",function(c){c.put(path,'<div ng-controller="dockerBakeStageCtrl as bakeStageCtrl">\n <stage-config-field label="Package" help-key="pipeline.config.bake.package">\n <input type="text" class="form-control input-sm" ng-model="stage.package" />\n </stage-config-field>\n <stage-config-field label="Organization" help-key="pipeline.config.docker.bake.organization">\n <input type="text" class="form-control input-sm" ng-model="stage.organization" />\n </stage-config-field>\n <stage-config-field label="Image Name" help-key="pipeline.config.docker.bake.targetImage">\n <input type="text" class="form-control input-sm" ng-model="stage.ami_name" />\n </stage-config-field>\n <stage-config-field label="Image tag" help-key="pipeline.config.docker.bake.targetImageTag">\n <input type="text" class="form-control input-sm" ng-model="stage.extendedAttributes[\'docker_target_image_tag\']" />\n </stage-config-field>\n <stage-config-field label="Base OS">\n <bake-stage-choose-os model="stage.baseOs" base-os-options="baseOsOptions"></bake-stage-choose-os>\n </stage-config-field>\n\n <stage-config-field label="Base Label">\n <label class="radio-inline" ng-repeat="baseLabel in baseLabelOptions">\n <input type="radio" ng-model="stage.baseLabel" ng-value="baseLabel" />\n {{baseLabel}}\n </label>\n </stage-config-field>\n <stage-config-field label="Rebake">\n <div class="checkbox" style="margin-bottom: 0">\n <label>\n <input type="checkbox" ng-model="stage.rebake" />\n Rebake image without regard to the status of any existing bake\n </label>\n </div>\n </stage-config-field>\n</div>\n')}]),module.exports=path},function(module,exports){var path="docker/src/pipeline/stages/bake/bakeExecutionDetails.html";window.angular.module("ng").run(["$templateCache",function(c){c.put(path,'<div ng-controller="dockerBakeExecutionDetailsCtrl">\n <execution-details-section-nav sections="configSections"></execution-details-section-nav>\n <div class="step-section-details" ng-if="detailsSection === \'bakeConfig\'">\n <div class="row">\n <div class="col-md-6">\n <dl class="dl-narrow dl-horizontal">\n <dt if-multiple-providers>Provider</dt>\n <dd if-multiple-providers>Docker</dd>\n <dt>Organization</dt>\n <dd>{{stage.context.organization}}</dd>\n <dt>Image Name</dt>\n <dd>{{stage.context.ami_name}}</dd>\n <dt>Image Tag</dt>\n <dd>{{stage.context.extendedAttributes[\'docker_target_image_tag\']}}</dd>\n <dt>Image</dt>\n <dd>{{stage.context.ami}}</dd>\n </dl>\n </div>\n <div class="col-md-6">\n <dl class="dl-narrow dl-horizontal">\n <dt>Base OS</dt>\n <dd>{{stage.context.baseOs}}</dd>\n <dt>Region</dt>\n <dd>{{stage.context.region}}</dd>\n <dt>Package</dt>\n <dd>{{stage.context.package}}</dd>\n <dt>Label</dt>\n <dd>{{stage.context.baseLabel}}</dd>\n </dl>\n </div>\n </div>\n <stage-failure-message stage="stage" message="stage.failureMessage"></stage-failure-message>\n\n <div class="row" ng-if="stage.context.region && stage.context.status.resourceId">\n <div class="col-md-12">\n <div class="alert alert-{{stage.isFailed ? \'danger\' : \'info\'}}">\n <a target="_blank" href="{{ bakeryDetailUrl(stage) }}"> View Bakery Details </a>\n </div>\n </div>\n </div>\n </div>\n <div class="step-section-details" ng-if="detailsSection === \'taskStatus\'">\n <div class="row">\n <execution-step-details item="stage"></execution-step-details>\n </div>\n </div>\n</div>\n')}]),module.exports=path},function(module,exports){module.exports=require("@uirouter/angularjs")},function(module,exports){module.exports=require("ngimport")},function(module,exports,__webpack_require__){var map={"./pipeline/stages/bake/bakeExecutionDetails.html":7,"./pipeline/stages/bake/bakeStage.html":6};function webpackContext(req){var id=webpackContextResolve(req);return __webpack_require__(id)}function webpackContextResolve(req){if(!__webpack_require__.o(map,req)){var e=new Error("Cannot find module '"+req+"'");throw e.code="MODULE_NOT_FOUND",e}return map[req]}webpackContext.keys=function(){return Object.keys(map)},webpackContext.resolve=webpackContextResolve,module.exports=webpackContext,webpackContext.id=10},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"DockerImageReader",(function(){return DockerImageReader_DockerImageReader})),__webpack_require__.d(__webpack_exports__,"DockerImageAndTagSelector",(function(){return DockerImageAndTagSelector_DockerImageAndTagSelector})),__webpack_require__.d(__webpack_exports__,"DockerImageUtils",(function(){return DockerImageUtils})),__webpack_require__.d(__webpack_exports__,"DOCKER_MODULE",(function(){return DOCKER_MODULE}));var core_=__webpack_require__(1);class DockerImageReader_DockerImageReader{static getImage(imageName,region,credentials){return Object(core_.REST)("/images").path(credentials,region,imageName).query({provider:"docker"}).get().then(results=>results&&results.length?results[0]:null).catch(()=>null)}static findImages(params){return core_.RetryService.buildRetrySequence(()=>Object(core_.REST)("/images/find").query(params).get(),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}static findTags(params){return core_.RetryService.buildRetrySequence(()=>Object(core_.REST)("/images/tags").query(params).get(),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}}var external_lodash_=__webpack_require__(2),external_lodash_default=__webpack_require__.n(external_lodash_),external_react_=__webpack_require__(0),external_react_default=__webpack_require__.n(external_react_),external_react_select_=__webpack_require__(3),external_react_select_default=__webpack_require__.n(external_react_select_);class DockerImageUtils{static splitImageId(imageId=""){let imageParts;imageParts=imageId.includes("@")?imageId.split("@"):imageId.split(":");const repository=imageParts[0],organization=repository.split("/").slice(0,-1).join("/"),lookup=imageParts.length>1?imageParts.slice(1).join(":"):"";let tag,digest;return lookup&&(lookup.startsWith("sha256:")?digest=lookup:tag=lookup),{organization,repository,digest,tag}}static generateImageId(parts){if(!parts.repository||!parts.digest&&!parts.tag)return;let imageId;return imageId=parts.digest?`${parts.repository}@${parts.digest}`:`${parts.repository}:${parts.tag}`,imageId}}const imageFields=["organization","repository","tag","digest"],defineOptions=[{label:"Manually",value:!0},{label:"Select from list",value:!1}];class DockerImageAndTagSelector_DockerImageAndTagSelector extends external_react_default.a.Component{constructor(props){super(props),this.unmounted=!1,this.cachedValues={},this.handleRefreshImages=()=>{this.refreshImages(this.props)},this.lookupTypeChanged=o=>{const newType=o.value,oldType=this.state.lookupType,oldValue=this.props[oldType],cachedValue=this.cachedValues[newType];this.valueChanged(oldType,void 0),this.cachedValues[newType]&&this.valueChanged(newType,cachedValue),this.setState({lookupType:newType}),this.cachedValues[oldType]=oldValue},this.showManualInput=defineManually=>{if(!defineManually){const newFields=DockerImageUtils.splitImageId(this.props.imageId||"");this.props.onChange(newFields),this.state.switchedManualWarning&&this.setState({switchedManualWarning:void 0,missingFields:void 0})}this.setState({defineManually})};const accountOptions=props.account?[{label:props.account,value:props.account}]:[],organizationOptions=props.organization&&props.organization.length?[{label:props.organization,value:props.organization}]:[],repositoryOptions=props.repository&&props.repository.length?[{label:props.repository,value:props.repository}]:[],tagOptions=props.tag&&props.tag.length?[{label:props.tag,value:props.tag}]:[],parsedImageId=DockerImageUtils.splitImageId(props.imageId),defineManually=props.allowManualDefinition&&Boolean(props.imageId&&props.imageId.includes("${"));this.state={accountOptions,switchedManualWarning:void 0,imagesLoaded:!1,imagesLoading:!1,organizationOptions,repositoryOptions,defineManually,tagOptions,lookupType:props.digest||parsedImageId.digest?"digest":"tag"}}getAccountMap(images){const groupedImages=Object(external_lodash_.groupBy)(images.filter(image=>image.account),"account");return Object(external_lodash_.reduce)(groupedImages,(acc,image,key)=>(acc[key]=Object(external_lodash_.uniq)(image.map(i=>`${i.repository.split("/").slice(0,-1).join("/")}`)),acc),{})}getRegistryMap(images){return images.reduce((m,image)=>(m[image.account]=image.registry,m),{})}getOrganizationMap(images){const groupedImages=Object(external_lodash_.groupBy)(images.filter(image=>image.repository),image=>`${image.account}/${image.repository.split("/").slice(0,-1).join("/")}`);return Object(external_lodash_.reduce)(groupedImages,(acc,image,key)=>(acc[key]=Object(external_lodash_.uniq)(image.map(i=>i.repository)),acc),{})}getRepositoryMap(images){const groupedImages=Object(external_lodash_.groupBy)(images.filter(image=>image.account),"repository");return Object(external_lodash_.reduce)(groupedImages,(acc,image,key)=>(acc[key]=Object(external_lodash_.uniq)(image.map(i=>i.tag)),acc),{})}getOrganizationsList(accountMap){return accountMap&&accountMap[this.props.showRegistry?this.props.account:this.props.registry]||[]}getRepositoryList(organizationMap,organization,registry){if(organizationMap){return organizationMap[`${this.props.showRegistry?this.props.account:registry}/${organization||""}`]||[]}return[]}getTags(tag,repositoryMap,repository){let tags=[];return this.props.specifyTagByRegex?tag&&""===Object(external_lodash_.trim)(tag)&&(tag=void 0):repositoryMap&&(tags=repositoryMap[repository]||[],tags.includes(tag)||!tag||tag.includes("${")||(tag=void 0)),{tag,tags}}componentWillReceiveProps(nextProps){!this.images||["account","showRegistry"].some(key=>this.props[key]!==nextProps[key])?this.refreshImages(nextProps):["organization","registry","repository"].some(key=>this.props[key]!==nextProps[key])&&this.updateThings(nextProps),nextProps.imageId&&nextProps.imageId.includes("${")&&this.setState({defineManually:!0})}componentWillUnmount(){this.unmounted=!0}synchronizeChanges(values,registry){const{organization,repository,tag,digest}=values;if(this.props.onChange){const imageId=DockerImageUtils.generateImageId({organization,repository,tag,digest}),changes={};tag!==this.props.tag&&(changes.tag=tag),imageId!==this.props.imageId&&(changes.imageId=imageId),organization!==this.props.organization&&(changes.organization=organization),registry!==this.props.registry&&(changes.registry=registry),repository!==this.props.repository&&(changes.repository=repository),digest!==this.props.digest&&(changes.digest=digest),Object.keys(changes).length>0&&this.props.onChange(changes)}}updateThings(props,allowAutoSwitchToManualEntry=!1){if(!this.repositoryMap||this.unmounted)return;const{imageId,specifyTagByRegex}=props;let{organization,registry,repository}=props;props.showRegistry&&(registry=this.registryMap[props.account]);const organizationFound=!organization||this.organizations.includes(organization)||organization.includes("${");organizationFound||(organization="");const repositories=this.getRepositoryList(this.organizationMap,organization,registry),repositoryFound=!repository||repository.includes("${")||repositories.includes(repository);repositoryFound||(repository="");const{tag,tags}=this.getTags(props.tag,this.repositoryMap,repository),tagFound=tag===props.tag||specifyTagByRegex,newState={accountOptions:this.newAccounts.sort().map(a=>({label:a,value:a})),organizationOptions:this.organizations.filter(o=>o).sort().map(o=>({label:o,value:o})),imagesLoaded:!0,repositoryOptions:repositories.sort().map(r=>({label:r,value:r})),tagOptions:tags.sort().map(t=>({label:t,value:t}))};if(!imageId||this.state.imagesLoaded&&!allowAutoSwitchToManualEntry||organizationFound&&repositoryFound&&tagFound)imageId&&imageId.includes("${")||this.synchronizeChanges(this.state.defineManually?DockerImageUtils.splitImageId(imageId):{organization,repository,tag,digest:this.props.digest},registry);else{newState.defineManually=!0;const missingFields=[];organizationFound||missingFields.push("organization"),repositoryFound||missingFields.push("image"),tagFound||missingFields.push("tag"),newState.missingFields=missingFields,newState.switchedManualWarning=`Could not find ${missingFields.join(" or ")}, switched to manual entry`}this.setState(newState)}initializeImages(props){if(this.state.imagesLoading)return;const{showRegistry,account,registry}=props,imageConfig={provider:"dockerRegistry",account:showRegistry?account:registry};this.setState({imagesLoading:!0}),DockerImageReader_DockerImageReader.findImages(imageConfig).then(images=>{this.images=images,this.registryMap=this.getRegistryMap(this.images),this.accountMap=this.getAccountMap(this.images),this.newAccounts=this.accounts||Object.keys(this.accountMap),this.organizationMap=this.getOrganizationMap(this.images),this.repositoryMap=this.getRepositoryMap(this.images),this.organizations=this.getOrganizationsList(this.accountMap),this.updateThings(props,!0)}).finally(()=>{this.unmounted||this.setState({imagesLoading:!1})})}refreshImages(props){this.initializeImages(props)}initializeAccounts(props){let{account}=props;core_.AccountService.listAccounts("dockerRegistry").then(allAccounts=>{const accounts=allAccounts.map(a=>a.name);this.props.showRegistry&&!account&&(account=accounts[0]),this.accounts=accounts,this.refreshImages(Object.assign(Object.assign({},props),{account}))})}isNew(){const{account,organization,registry,repository,tag}=this.props;return!(account||organization||registry||repository||tag)}componentDidMount(){this.props.deferInitialization||!this.props.registry&&!this.isNew()||this.initializeAccounts(this.props)}valueChanged(name,value){const changes={[name]:value};if(imageFields.some(n=>n===name)){const{organization,repository,tag,digest}=this.props,imageParts=Object.assign({organization,repository,tag,digest},changes),imageId=DockerImageUtils.generateImageId(imageParts);changes.imageId=imageId}this.props.onChange&&this.props.onChange(changes)}render(){const{account,allowManualDefinition,digest,imageId,organization,repository,showDigest,showRegistry,specifyTagByRegex,tag}=this.props,{accountOptions,switchedManualWarning,missingFields,imagesLoading,lookupType,organizationOptions,repositoryOptions,defineManually,tagOptions}=this.state,parsedImageId=DockerImageUtils.splitImageId(imageId),manualInputToggle=external_react_default.a.createElement("div",{className:"sp-formItem groupHeader"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Define Image ID"),external_react_default.a.createElement("div",{className:"sp-formActions sp-formActions--mobile"},external_react_default.a.createElement("span",{className:"action"}))),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement(external_react_select_default.a,{value:defineManually,disabled:imagesLoading||!allowManualDefinition,onChange:o=>this.showManualInput(o.value),options:defineOptions,clearable:!1}))))),warning=switchedManualWarning?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"}),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement(core_.ValidationMessage,{type:"warning",message:external_react_default.a.createElement(external_react_default.a.Fragment,null,switchedManualWarning,(missingFields||[]).map(f=>external_react_default.a.createElement("div",{key:f},external_react_default.a.createElement(core_.HelpField,{expand:!0,id:`pipeline.config.docker.trigger.missing.${f}`}))))}))):null;if(defineManually)return external_react_default.a.createElement("div",{className:"sp-formGroup"},manualInputToggle,external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Image ID"),external_react_default.a.createElement("div",{className:"sp-formActions sp-formActions--mobile"},external_react_default.a.createElement("span",{className:"action"}))),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement("input",{className:"form-control input-sm",value:imageId||"",onChange:e=>this.valueChanged("imageId",e.target.value)}))))),warning);const Registry=showRegistry?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Registry Name")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement(external_react_select_default.a,{value:account,disabled:imagesLoading,onChange:o=>this.valueChanged("account",o?o.value:""),options:accountOptions,isLoading:imagesLoading})),external_react_default.a.createElement("span",{className:"sp-formActions sp-formActions--web"},external_react_default.a.createElement("span",{className:"action"},external_react_default.a.createElement(core_.Tooltip,{value:imagesLoading?"Images refreshing":"Refresh images list"},external_react_default.a.createElement("i",{className:`fa icon-button-refresh-arrows ${imagesLoading?"fa-spin":""}`,onClick:this.handleRefreshImages}))))))):null,Organization=external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Organization")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},organization.includes("${")?external_react_default.a.createElement("input",{disabled:imagesLoading,className:"form-control input-sm",value:organization||"",onChange:e=>this.valueChanged("organization",e.target.value)}):external_react_default.a.createElement(external_react_select_default.a,{value:organization||"",disabled:imagesLoading,onChange:o=>this.valueChanged("organization",o&&o.value||""),placeholder:"No organization",options:organizationOptions,isLoading:imagesLoading}))))),Image=external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Image")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},repository.includes("${")?external_react_default.a.createElement("input",{className:"form-control input-sm",disabled:imagesLoading,value:repository||"",onChange:e=>this.valueChanged("repository",e.target.value)}):external_react_default.a.createElement(external_react_select_default.a,{value:repository||"",disabled:imagesLoading,onChange:o=>this.valueChanged("repository",o&&o.value||""),options:repositoryOptions,required:!0,isLoading:imagesLoading}))))),Tag="tag"===lookupType?specifyTagByRegex?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Tag")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement("input",{type:"text",className:"form-control input-sm",value:tag||"",disabled:imagesLoading||!repository,onChange:e=>this.valueChanged("tag",e.target.value)}))),external_react_default.a.createElement(core_.HelpField,{id:"pipeline.config.docker.trigger.tag",expand:!0}))):external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Tag")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},tag&&tag.includes("${")?external_react_default.a.createElement("input",{className:"form-control input-sm",disabled:imagesLoading,value:tag||"",onChange:e=>this.valueChanged("tag",e.target.value),required:!0}):external_react_default.a.createElement(external_react_default.a.Fragment,null,external_react_default.a.createElement(external_react_select_default.a,{value:tag||"",disabled:imagesLoading||!repository,isLoading:imagesLoading,onChange:o=>this.valueChanged("tag",o?o.value:void 0),options:tagOptions,placeholder:"No tag",required:!0}),external_react_default.a.createElement(core_.HelpField,{id:"pipeline.config.docker.trigger.tag.additionalInfo",expand:!0})))))):null,Digest="digest"===lookupType?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Digest ",external_react_default.a.createElement(core_.HelpField,{id:"pipeline.config.docker.trigger.digest"}))),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement("input",{className:"form-control input-sm",placeholder:"sha256:abc123",value:digest||parsedImageId.digest||"",onChange:e=>this.valueChanged("digest",e.target.value),required:!0}))))):null,LookupTypeSelector=showDigest?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Type")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement(external_react_select_default.a,{clearable:!1,value:lookupType,options:[{value:"digest",label:"Digest"},{value:"tag",label:"Tag"}],onChange:this.lookupTypeChanged}))))):null;return external_react_default.a.createElement("div",{className:"sp-formGroup"},manualInputToggle,Registry,Organization,Image,LookupTypeSelector,Digest,Tag)}}DockerImageAndTagSelector_DockerImageAndTagSelector.defaultProps={organization:"",registry:"",repository:"",showDigest:!0,allowManualDefinition:!0};var external_angular_=__webpack_require__(4),angularjs_=__webpack_require__(8),angularjs_default=__webpack_require__.n(angularjs_);Object(external_angular_.module)("spinnaker.docker.pipeline.stage.bake.executionDetails.controller",[angularjs_default.a]).controller("dockerBakeExecutionDetailsCtrl",["$scope","$stateParams","executionDetailsSectionService","$interpolate",function($scope,$stateParams,executionDetailsSectionService,$interpolate){$scope.configSections=["bakeConfig","taskStatus"];const initialized=()=>{$scope.detailsSection=$stateParams.details,$scope.provider=$scope.stage.context.cloudProviderType||"docker",$scope.bakeryDetailUrl=$interpolate($scope.roscoMode&&core_.SETTINGS.roscoDetailUrl?core_.SETTINGS.roscoDetailUrl:core_.SETTINGS.bakeryDetailUrl)},initialize=()=>executionDetailsSectionService.synchronizeSection($scope.configSections,initialized);initialize(),$scope.$on("$stateChangeSuccess",initialize)}]);Object(external_angular_.module)("spinnaker.docker.pipeline.stage.bakeStage",["spinnaker.docker.pipeline.stage.bake.executionDetails.controller"]).config((function(){core_.Registry.pipeline.registerStage({provides:"bake",cloudProvider:"docker",label:"Bake",description:"Bakes an image",templateUrl:__webpack_require__(6),executionDetailsUrl:__webpack_require__(7),executionLabelComponent:core_.BakeExecutionLabel,extraLabelLines:stage=>stage.masterStage.context.allPreviouslyBaked||stage.masterStage.context.somePreviouslyBaked?1:0,supportsCustomTimeout:!0,validators:[{type:"requiredField",fieldName:"package"}],restartable:!0})})).controller("dockerBakeStageCtrl",["$scope","$q",function($scope,$q){$scope.stage.region="global",$scope.stage.user||($scope.stage.user=core_.AuthenticationService.getAuthenticatedUser().name),$scope.viewState={loading:!0},$scope.$watch("stage",(function(){external_lodash_default.a.forOwn($scope.stage,(function(val,key){""===val&&delete $scope.stage[key]}))}),!0),$scope.viewState.providerSelected=!0,$q.all([core_.BakeryReader.getBaseOsOptions("docker"),core_.BakeryReader.getBaseLabelOptions()]).then((function([baseOsOptions,baseLabelOptions]){$scope.baseOsOptions=baseOsOptions.baseImages,$scope.baseLabelOptions=baseLabelOptions,!$scope.stage.baseOs&&$scope.baseOsOptions&&$scope.baseOsOptions.length&&($scope.stage.baseOs=$scope.baseOsOptions[0].id),!$scope.stage.baseLabel&&$scope.baseLabelOptions&&$scope.baseLabelOptions.length&&($scope.stage.baseLabel=$scope.baseLabelOptions[0]),$scope.viewState.loading=!1}))}]);var __rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t};var external_ngimport_=__webpack_require__(9),external_rxjs_=__webpack_require__(5);const lookupTypeOptions=[{value:"digest",label:"Digest"},{value:"tag",label:"Tag"}];class DockerTriggerTemplate_DockerTriggerTemplate extends external_react_default.a.Component{constructor(props){super(props),this.queryStream=new external_rxjs_.Subject,this.handleQuery=()=>{const trigger=this.props.command.trigger;return external_rxjs_.Observable.fromPromise(DockerImageReader_DockerImageReader.findTags({provider:"dockerRegistry",account:trigger.account,repository:trigger.repository}))},this.lookupTypeChanged=o=>{const newType=o.value;this.updateArtifact(this.props.command,"tag"===newType?this.state.selectedTag:this.state.digest),this.setState({lookupType:newType})},this.updateSelectedTag=tag=>{this.updateArtifact(this.props.command,tag),this.setState({selectedTag:tag}),this.props.command.triggerInvalid=!1},this.updateDigest=digest=>{this.updateArtifact(this.props.command,digest),this.setState({digest})},this.tagLoadSuccess=tags=>{const{command}=this.props,trigger=command.trigger,newState={};newState.tags=tags||[];const defaultSelection=newState.tags.find(t=>t===trigger.tag);defaultSelection&&(newState.selectedTag=defaultSelection,this.updateSelectedTag(defaultSelection)),newState.tagsLoading=!1,this.setState(newState)},this.tagLoadFailure=()=>{this.setState({tagsLoading:!1,loadError:!0})},this.initialize=()=>{const{command}=this.props;this.props.updateCommand("triggerInvalid",!0),this.props.updateCommand("extraFields",{tag:Object(external_lodash_.get)(command,"extraFields.tag",""),artifacts:Object(external_lodash_.get)(command,"extraFields.artifacts","")}),this.subscription&&this.subscription.unsubscribe(),"docker"===command.trigger.type&&(this.subscription=this.queryStream.debounceTime(250).switchMap(this.handleQuery).subscribe(this.tagLoadSuccess,this.tagLoadFailure),this.searchTags())},this.searchTags=(query="")=>{this.setState({tags:[`<span>Finding tags${query&&` matching ${query}`}...</span>`]}),this.queryStream.next()},this.state={digest:"",tags:[],tagsLoading:!0,loadError:!1,lookupType:"tag",selectedTag:""}}static formatLabel(trigger){return external_ngimport_.$q.when(`(Docker Registry) ${trigger.account?trigger.account+":":""} ${trigger.repository||""}`)}updateArtifact(command,tagOrDigest){this.props.updateCommand("extraFields.tag",tagOrDigest);const trigger=command.trigger;if(trigger&&trigger.repository){let imageName="";trigger.registry&&(imageName+=trigger.registry+"/"),imageName+=trigger.repository;let imageReference="";imageReference="digest"===this.state.lookupType?`${imageName}@${tagOrDigest}`:`${imageName}:${tagOrDigest}`,this.props.updateCommand("extraFields.artifacts",[{type:"docker/image",name:imageName,version:tagOrDigest,reference:imageReference}])}}componentDidMount(){this.initialize()}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}render(){const{digest,tags,tagsLoading,loadError,selectedTag,lookupType}=this.state,options=tags.map(tag=>({value:tag}));return external_react_default.a.createElement(external_react_default.a.Fragment,null,external_react_default.a.createElement("div",{className:"form-group"},external_react_default.a.createElement("div",{className:"sm-label-right col-md-4"},"Type"),external_react_default.a.createElement("div",{className:"col-md-3"},external_react_default.a.createElement(core_.TetheredSelect,{clearable:!1,value:lookupType,options:lookupTypeOptions,onChange:this.lookupTypeChanged}))),"tag"===lookupType&&external_react_default.a.createElement("div",{className:"form-group"},external_react_default.a.createElement("label",{className:"col-md-4 sm-label-right"},"Tag"),tagsLoading&&external_react_default.a.createElement("div",{className:"col-md-6"},external_react_default.a.createElement("div",{className:"form-control-static text-center"},external_react_default.a.createElement(core_.Spinner,{size:"small"}))),loadError&&external_react_default.a.createElement("div",{className:"col-md-6"},"Error loading tags!"),!tagsLoading&&external_react_default.a.createElement("div",{className:"col-md-6"},0===tags.length&&external_react_default.a.createElement("div",null,external_react_default.a.createElement("p",{className:"form-control-static"},"No tags found")),tags.length>0&&external_react_default.a.createElement(core_.TetheredSelect,{options,optionRenderer:o=>external_react_default.a.createElement("span",null,o.value),clearable:!1,value:selectedTag,valueRenderer:o=>external_react_default.a.createElement("span",null,external_react_default.a.createElement("strong",null,o.value)),onChange:o=>this.updateSelectedTag(o.value),placeholder:"Search tags..."}))),"digest"===lookupType&&external_react_default.a.createElement("div",{className:"form-group"},external_react_default.a.createElement("label",{className:"col-md-4 sm-label-right"},"Digest ",external_react_default.a.createElement(core_.HelpField,{id:"pipeline.config.docker.trigger.digest"})),external_react_default.a.createElement("div",{className:"col-md-6"},external_react_default.a.createElement("input",{value:digest,onChange:e=>this.updateDigest(e.target.value),className:"form-control input-sm",required:!0}))))}}core_.Registry.pipeline.registerTrigger({label:"Docker Registry",description:"Executes the pipeline on an image update",key:"docker",component:function(props){const{formik}=props,trigger=formik.values;return external_react_default.a.createElement("div",{className:"form-horizontal"},external_react_default.a.createElement(DockerImageAndTagSelector_DockerImageAndTagSelector,{allowManualDefinition:!1,specifyTagByRegex:!0,account:trigger.account,organization:trigger.organization,registry:trigger.registry,repository:trigger.repository,tag:trigger.tag,showRegistry:!0,onChange:changes=>{const{imageId}=changes,rest=__rest(changes,["imageId"]);props.triggerUpdated(rest)},showDigest:!1}))},manualExecutionComponent:DockerTriggerTemplate_DockerTriggerTemplate,executionStatusComponent:props=>{const trigger=props.trigger;return external_react_default.a.createElement("li",null,trigger.repository,":",trigger.tag)},executionTriggerLabel:()=>"Docker Registry",validators:[{type:"requiredField",fieldName:"account",message:"<strong>Registry</strong> is a required field for Docker Registry triggers."},{type:"requiredField",fieldName:"repository",message:"<strong>Image</strong> is a required field for Docker Registry triggers."},{type:"serviceAccountAccess",preventSave:!0,message:"You do not have access to the service account configured in this pipeline's Docker Registry trigger.\n You will not be able to save your edits to this pipeline."}]});const templates=__webpack_require__(10);templates.keys().forEach((function(key){templates(key)}));const DOCKER_MODULE="spinnaker.docker";Object(external_angular_.module)(DOCKER_MODULE,["spinnaker.docker.pipeline.stage.bakeStage"])}])}));
!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory(require("@spinnaker/core")):"function"==typeof define&&define.amd?define("@spinnaker/docker",["@spinnaker/core"],factory):"object"==typeof exports?exports["@spinnaker/docker"]=factory(require("@spinnaker/core")):root["@spinnaker/docker"]=factory(root["@spinnaker/core"])}(window,(function(__WEBPACK_EXTERNAL_MODULE__1__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(1&mode&&(value=__webpack_require__(value)),8&mode)return value;if(4&mode&&"object"==typeof value&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value}),2&mode&&"string"!=typeof value)for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=12)}([function(module,exports){module.exports=require("react")},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE__1__},function(module,exports){module.exports=require("lodash")},function(module,exports){module.exports=require("react-select")},function(module,exports){module.exports=require("angular")},function(module,exports){module.exports=require("rxjs")},function(module,exports){module.exports=require("rxjs/operators")},function(module,exports){var path="docker/src/pipeline/stages/bake/bakeStage.html";window.angular.module("ng").run(["$templateCache",function(c){c.put(path,'<div ng-controller="dockerBakeStageCtrl as bakeStageCtrl">\n <stage-config-field label="Package" help-key="pipeline.config.bake.package">\n <input type="text" class="form-control input-sm" ng-model="stage.package" />\n </stage-config-field>\n <stage-config-field label="Organization" help-key="pipeline.config.docker.bake.organization">\n <input type="text" class="form-control input-sm" ng-model="stage.organization" />\n </stage-config-field>\n <stage-config-field label="Image Name" help-key="pipeline.config.docker.bake.targetImage">\n <input type="text" class="form-control input-sm" ng-model="stage.ami_name" />\n </stage-config-field>\n <stage-config-field label="Image tag" help-key="pipeline.config.docker.bake.targetImageTag">\n <input type="text" class="form-control input-sm" ng-model="stage.extendedAttributes[\'docker_target_image_tag\']" />\n </stage-config-field>\n <stage-config-field label="Base OS">\n <bake-stage-choose-os model="stage.baseOs" base-os-options="baseOsOptions"></bake-stage-choose-os>\n </stage-config-field>\n\n <stage-config-field label="Base Label">\n <label class="radio-inline" ng-repeat="baseLabel in baseLabelOptions">\n <input type="radio" ng-model="stage.baseLabel" ng-value="baseLabel" />\n {{baseLabel}}\n </label>\n </stage-config-field>\n <stage-config-field label="Rebake">\n <div class="checkbox" style="margin-bottom: 0">\n <label>\n <input type="checkbox" ng-model="stage.rebake" />\n Rebake image without regard to the status of any existing bake\n </label>\n </div>\n </stage-config-field>\n</div>\n')}]),module.exports=path},function(module,exports){var path="docker/src/pipeline/stages/bake/bakeExecutionDetails.html";window.angular.module("ng").run(["$templateCache",function(c){c.put(path,'<div ng-controller="dockerBakeExecutionDetailsCtrl">\n <execution-details-section-nav sections="configSections"></execution-details-section-nav>\n <div class="step-section-details" ng-if="detailsSection === \'bakeConfig\'">\n <div class="row">\n <div class="col-md-6">\n <dl class="dl-narrow dl-horizontal">\n <dt if-multiple-providers>Provider</dt>\n <dd if-multiple-providers>Docker</dd>\n <dt>Organization</dt>\n <dd>{{stage.context.organization}}</dd>\n <dt>Image Name</dt>\n <dd>{{stage.context.ami_name}}</dd>\n <dt>Image Tag</dt>\n <dd>{{stage.context.extendedAttributes[\'docker_target_image_tag\']}}</dd>\n <dt>Image</dt>\n <dd>{{stage.context.ami}}</dd>\n </dl>\n </div>\n <div class="col-md-6">\n <dl class="dl-narrow dl-horizontal">\n <dt>Base OS</dt>\n <dd>{{stage.context.baseOs}}</dd>\n <dt>Region</dt>\n <dd>{{stage.context.region}}</dd>\n <dt>Package</dt>\n <dd>{{stage.context.package}}</dd>\n <dt>Label</dt>\n <dd>{{stage.context.baseLabel}}</dd>\n </dl>\n </div>\n </div>\n <stage-failure-message stage="stage" message="stage.failureMessage"></stage-failure-message>\n\n <div class="row" ng-if="stage.context.region && stage.context.status.resourceId">\n <div class="col-md-12">\n <div class="alert alert-{{stage.isFailed ? \'danger\' : \'info\'}}">\n <a target="_blank" href="{{ bakeryDetailUrl(stage) }}"> View Bakery Details </a>\n </div>\n </div>\n </div>\n </div>\n <div class="step-section-details" ng-if="detailsSection === \'taskStatus\'">\n <div class="row">\n <execution-step-details item="stage"></execution-step-details>\n </div>\n </div>\n</div>\n')}]),module.exports=path},function(module,exports){module.exports=require("@uirouter/angularjs")},function(module,exports){module.exports=require("ngimport")},function(module,exports,__webpack_require__){var map={"./pipeline/stages/bake/bakeExecutionDetails.html":8,"./pipeline/stages/bake/bakeStage.html":7};function webpackContext(req){var id=webpackContextResolve(req);return __webpack_require__(id)}function webpackContextResolve(req){if(!__webpack_require__.o(map,req)){var e=new Error("Cannot find module '"+req+"'");throw e.code="MODULE_NOT_FOUND",e}return map[req]}webpackContext.keys=function(){return Object.keys(map)},webpackContext.resolve=webpackContextResolve,module.exports=webpackContext,webpackContext.id=11},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"DockerImageReader",(function(){return DockerImageReader_DockerImageReader})),__webpack_require__.d(__webpack_exports__,"DockerImageAndTagSelector",(function(){return DockerImageAndTagSelector_DockerImageAndTagSelector})),__webpack_require__.d(__webpack_exports__,"DockerImageUtils",(function(){return DockerImageUtils})),__webpack_require__.d(__webpack_exports__,"DOCKER_MODULE",(function(){return DOCKER_MODULE}));var core_=__webpack_require__(1);class DockerImageReader_DockerImageReader{static getImage(imageName,region,credentials){return Object(core_.REST)("/images").path(credentials,region,imageName).query({provider:"docker"}).get().then(results=>results&&results.length?results[0]:null).catch(()=>null)}static findImages(params){return core_.RetryService.buildRetrySequence(()=>Object(core_.REST)("/images/find").query(params).get(),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}static findTags(params){return core_.RetryService.buildRetrySequence(()=>Object(core_.REST)("/images/tags").query(params).get(),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}}var external_lodash_=__webpack_require__(2),external_lodash_default=__webpack_require__.n(external_lodash_),external_react_=__webpack_require__(0),external_react_default=__webpack_require__.n(external_react_),external_react_select_=__webpack_require__(3),external_react_select_default=__webpack_require__.n(external_react_select_);class DockerImageUtils{static splitImageId(imageId=""){let imageParts;imageParts=imageId.includes("@")?imageId.split("@"):imageId.split(":");const repository=imageParts[0],organization=repository.split("/").slice(0,-1).join("/"),lookup=imageParts.length>1?imageParts.slice(1).join(":"):"";let tag,digest;return lookup&&(lookup.startsWith("sha256:")?digest=lookup:tag=lookup),{organization,repository,digest,tag}}static generateImageId(parts){if(!parts.repository||!parts.digest&&!parts.tag)return;let imageId;return imageId=parts.digest?`${parts.repository}@${parts.digest}`:`${parts.repository}:${parts.tag}`,imageId}}const imageFields=["organization","repository","tag","digest"],defineOptions=[{label:"Manually",value:!0},{label:"Select from list",value:!1}];class DockerImageAndTagSelector_DockerImageAndTagSelector extends external_react_default.a.Component{constructor(props){super(props),this.unmounted=!1,this.cachedValues={},this.handleRefreshImages=()=>{this.refreshImages(this.props)},this.lookupTypeChanged=o=>{const newType=o.value,oldType=this.state.lookupType,oldValue=this.props[oldType],cachedValue=this.cachedValues[newType];this.valueChanged(oldType,void 0),this.cachedValues[newType]&&this.valueChanged(newType,cachedValue),this.setState({lookupType:newType}),this.cachedValues[oldType]=oldValue},this.showManualInput=defineManually=>{if(!defineManually){const newFields=DockerImageUtils.splitImageId(this.props.imageId||"");this.props.onChange(newFields),this.state.switchedManualWarning&&this.setState({switchedManualWarning:void 0,missingFields:void 0})}this.setState({defineManually})};const accountOptions=props.account?[{label:props.account,value:props.account}]:[],organizationOptions=props.organization&&props.organization.length?[{label:props.organization,value:props.organization}]:[],repositoryOptions=props.repository&&props.repository.length?[{label:props.repository,value:props.repository}]:[],tagOptions=props.tag&&props.tag.length?[{label:props.tag,value:props.tag}]:[],parsedImageId=DockerImageUtils.splitImageId(props.imageId),defineManually=props.allowManualDefinition&&Boolean(props.imageId&&props.imageId.includes("${"));this.state={accountOptions,switchedManualWarning:void 0,imagesLoaded:!1,imagesLoading:!1,organizationOptions,repositoryOptions,defineManually,tagOptions,lookupType:props.digest||parsedImageId.digest?"digest":"tag"}}getAccountMap(images){const groupedImages=Object(external_lodash_.groupBy)(images.filter(image=>image.account),"account");return Object(external_lodash_.reduce)(groupedImages,(acc,image,key)=>(acc[key]=Object(external_lodash_.uniq)(image.map(i=>`${i.repository.split("/").slice(0,-1).join("/")}`)),acc),{})}getRegistryMap(images){return images.reduce((m,image)=>(m[image.account]=image.registry,m),{})}getOrganizationMap(images){const groupedImages=Object(external_lodash_.groupBy)(images.filter(image=>image.repository),image=>`${image.account}/${image.repository.split("/").slice(0,-1).join("/")}`);return Object(external_lodash_.reduce)(groupedImages,(acc,image,key)=>(acc[key]=Object(external_lodash_.uniq)(image.map(i=>i.repository)),acc),{})}getRepositoryMap(images){const groupedImages=Object(external_lodash_.groupBy)(images.filter(image=>image.account),"repository");return Object(external_lodash_.reduce)(groupedImages,(acc,image,key)=>(acc[key]=Object(external_lodash_.uniq)(image.map(i=>i.tag)),acc),{})}getOrganizationsList(accountMap){return accountMap&&accountMap[this.props.showRegistry?this.props.account:this.props.registry]||[]}getRepositoryList(organizationMap,organization,registry){if(organizationMap){return organizationMap[`${this.props.showRegistry?this.props.account:registry}/${organization||""}`]||[]}return[]}getTags(tag,repositoryMap,repository){let tags=[];return this.props.specifyTagByRegex?tag&&""===Object(external_lodash_.trim)(tag)&&(tag=void 0):repositoryMap&&(tags=repositoryMap[repository]||[],tags.includes(tag)||!tag||tag.includes("${")||(tag=void 0)),{tag,tags}}componentWillReceiveProps(nextProps){!this.images||["account","showRegistry"].some(key=>this.props[key]!==nextProps[key])?this.refreshImages(nextProps):["organization","registry","repository"].some(key=>this.props[key]!==nextProps[key])&&this.updateThings(nextProps),nextProps.imageId&&nextProps.imageId.includes("${")&&this.setState({defineManually:!0})}componentWillUnmount(){this.unmounted=!0}synchronizeChanges(values,registry){const{organization,repository,tag,digest}=values;if(this.props.onChange){const imageId=DockerImageUtils.generateImageId({organization,repository,tag,digest}),changes={};tag!==this.props.tag&&(changes.tag=tag),imageId!==this.props.imageId&&(changes.imageId=imageId),organization!==this.props.organization&&(changes.organization=organization),registry!==this.props.registry&&(changes.registry=registry),repository!==this.props.repository&&(changes.repository=repository),digest!==this.props.digest&&(changes.digest=digest),Object.keys(changes).length>0&&this.props.onChange(changes)}}updateThings(props,allowAutoSwitchToManualEntry=!1){if(!this.repositoryMap||this.unmounted)return;const{imageId,specifyTagByRegex}=props;let{organization,registry,repository}=props;props.showRegistry&&(registry=this.registryMap[props.account]);const organizationFound=!organization||this.organizations.includes(organization)||organization.includes("${");organizationFound||(organization="");const repositories=this.getRepositoryList(this.organizationMap,organization,registry),repositoryFound=!repository||repository.includes("${")||repositories.includes(repository);repositoryFound||(repository="");const{tag,tags}=this.getTags(props.tag,this.repositoryMap,repository),tagFound=tag===props.tag||specifyTagByRegex,newState={accountOptions:this.newAccounts.sort().map(a=>({label:a,value:a})),organizationOptions:this.organizations.filter(o=>o).sort().map(o=>({label:o,value:o})),imagesLoaded:!0,repositoryOptions:repositories.sort().map(r=>({label:r,value:r})),tagOptions:tags.sort().map(t=>({label:t,value:t}))};if(!imageId||this.state.imagesLoaded&&!allowAutoSwitchToManualEntry||organizationFound&&repositoryFound&&tagFound)imageId&&imageId.includes("${")||this.synchronizeChanges(this.state.defineManually?DockerImageUtils.splitImageId(imageId):{organization,repository,tag,digest:this.props.digest},registry);else{newState.defineManually=!0;const missingFields=[];organizationFound||missingFields.push("organization"),repositoryFound||missingFields.push("image"),tagFound||missingFields.push("tag"),newState.missingFields=missingFields,newState.switchedManualWarning=`Could not find ${missingFields.join(" or ")}, switched to manual entry`}this.setState(newState)}initializeImages(props){if(this.state.imagesLoading)return;const{showRegistry,account,registry}=props,imageConfig={provider:"dockerRegistry",account:showRegistry?account:registry};this.setState({imagesLoading:!0}),DockerImageReader_DockerImageReader.findImages(imageConfig).then(images=>{this.images=images,this.registryMap=this.getRegistryMap(this.images),this.accountMap=this.getAccountMap(this.images),this.newAccounts=this.accounts||Object.keys(this.accountMap),this.organizationMap=this.getOrganizationMap(this.images),this.repositoryMap=this.getRepositoryMap(this.images),this.organizations=this.getOrganizationsList(this.accountMap),this.updateThings(props,!0)}).finally(()=>{this.unmounted||this.setState({imagesLoading:!1})})}refreshImages(props){this.initializeImages(props)}initializeAccounts(props){let{account}=props;core_.AccountService.listAccounts("dockerRegistry").then(allAccounts=>{const accounts=allAccounts.map(a=>a.name);this.props.showRegistry&&!account&&(account=accounts[0]),this.accounts=accounts,this.refreshImages(Object.assign(Object.assign({},props),{account}))})}isNew(){const{account,organization,registry,repository,tag}=this.props;return!(account||organization||registry||repository||tag)}componentDidMount(){this.props.deferInitialization||!this.props.registry&&!this.isNew()||this.initializeAccounts(this.props)}valueChanged(name,value){const changes={[name]:value};if(imageFields.some(n=>n===name)){const{organization,repository,tag,digest}=this.props,imageParts=Object.assign({organization,repository,tag,digest},changes),imageId=DockerImageUtils.generateImageId(imageParts);changes.imageId=imageId}this.props.onChange&&this.props.onChange(changes)}render(){const{account,allowManualDefinition,digest,imageId,organization,repository,showDigest,showRegistry,specifyTagByRegex,tag}=this.props,{accountOptions,switchedManualWarning,missingFields,imagesLoading,lookupType,organizationOptions,repositoryOptions,defineManually,tagOptions}=this.state,parsedImageId=DockerImageUtils.splitImageId(imageId),manualInputToggle=external_react_default.a.createElement("div",{className:"sp-formItem groupHeader"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Define Image ID"),external_react_default.a.createElement("div",{className:"sp-formActions sp-formActions--mobile"},external_react_default.a.createElement("span",{className:"action"}))),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement(external_react_select_default.a,{value:defineManually,disabled:imagesLoading||!allowManualDefinition,onChange:o=>this.showManualInput(o.value),options:defineOptions,clearable:!1}))))),warning=switchedManualWarning?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"}),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement(core_.ValidationMessage,{type:"warning",message:external_react_default.a.createElement(external_react_default.a.Fragment,null,switchedManualWarning,(missingFields||[]).map(f=>external_react_default.a.createElement("div",{key:f},external_react_default.a.createElement(core_.HelpField,{expand:!0,id:`pipeline.config.docker.trigger.missing.${f}`}))))}))):null;if(defineManually)return external_react_default.a.createElement("div",{className:"sp-formGroup"},manualInputToggle,external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Image ID"),external_react_default.a.createElement("div",{className:"sp-formActions sp-formActions--mobile"},external_react_default.a.createElement("span",{className:"action"}))),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement("input",{className:"form-control input-sm",value:imageId||"",onChange:e=>this.valueChanged("imageId",e.target.value)}))))),warning);const Registry=showRegistry?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Registry Name")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement(external_react_select_default.a,{value:account,disabled:imagesLoading,onChange:o=>this.valueChanged("account",o?o.value:""),options:accountOptions,isLoading:imagesLoading})),external_react_default.a.createElement("span",{className:"sp-formActions sp-formActions--web"},external_react_default.a.createElement("span",{className:"action"},external_react_default.a.createElement(core_.Tooltip,{value:imagesLoading?"Images refreshing":"Refresh images list"},external_react_default.a.createElement("i",{className:`fa icon-button-refresh-arrows ${imagesLoading?"fa-spin":""}`,onClick:this.handleRefreshImages}))))))):null,Organization=external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Organization")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},organization.includes("${")?external_react_default.a.createElement("input",{disabled:imagesLoading,className:"form-control input-sm",value:organization||"",onChange:e=>this.valueChanged("organization",e.target.value)}):external_react_default.a.createElement(external_react_select_default.a,{value:organization||"",disabled:imagesLoading,onChange:o=>this.valueChanged("organization",o&&o.value||""),placeholder:"No organization",options:organizationOptions,isLoading:imagesLoading}))))),Image=external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Image")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},repository.includes("${")?external_react_default.a.createElement("input",{className:"form-control input-sm",disabled:imagesLoading,value:repository||"",onChange:e=>this.valueChanged("repository",e.target.value)}):external_react_default.a.createElement(external_react_select_default.a,{value:repository||"",disabled:imagesLoading,onChange:o=>this.valueChanged("repository",o&&o.value||""),options:repositoryOptions,required:!0,isLoading:imagesLoading}))))),Tag="tag"===lookupType?specifyTagByRegex?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Tag")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement("input",{type:"text",className:"form-control input-sm",value:tag||"",disabled:imagesLoading||!repository,onChange:e=>this.valueChanged("tag",e.target.value)}))),external_react_default.a.createElement(core_.HelpField,{id:"pipeline.config.docker.trigger.tag",expand:!0}))):external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Tag")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},tag&&tag.includes("${")?external_react_default.a.createElement("input",{className:"form-control input-sm",disabled:imagesLoading,value:tag||"",onChange:e=>this.valueChanged("tag",e.target.value),required:!0}):external_react_default.a.createElement(external_react_default.a.Fragment,null,external_react_default.a.createElement(external_react_select_default.a,{value:tag||"",disabled:imagesLoading||!repository,isLoading:imagesLoading,onChange:o=>this.valueChanged("tag",o?o.value:void 0),options:tagOptions,placeholder:"No tag",required:!0}),external_react_default.a.createElement(core_.HelpField,{id:"pipeline.config.docker.trigger.tag.additionalInfo",expand:!0})))))):null,Digest="digest"===lookupType?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Digest ",external_react_default.a.createElement(core_.HelpField,{id:"pipeline.config.docker.trigger.digest"}))),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement("input",{className:"form-control input-sm",placeholder:"sha256:abc123",value:digest||parsedImageId.digest||"",onChange:e=>this.valueChanged("digest",e.target.value),required:!0}))))):null,LookupTypeSelector=showDigest?external_react_default.a.createElement("div",{className:"sp-formItem"},external_react_default.a.createElement("div",{className:"sp-formItem__left"},external_react_default.a.createElement("div",{className:"sp-formLabel"},"Type")),external_react_default.a.createElement("div",{className:"sp-formItem__right"},external_react_default.a.createElement("div",{className:"sp-form"},external_react_default.a.createElement("span",{className:"field"},external_react_default.a.createElement(external_react_select_default.a,{clearable:!1,value:lookupType,options:[{value:"digest",label:"Digest"},{value:"tag",label:"Tag"}],onChange:this.lookupTypeChanged}))))):null;return external_react_default.a.createElement("div",{className:"sp-formGroup"},manualInputToggle,Registry,Organization,Image,LookupTypeSelector,Digest,Tag)}}DockerImageAndTagSelector_DockerImageAndTagSelector.defaultProps={organization:"",registry:"",repository:"",showDigest:!0,allowManualDefinition:!0};var external_angular_=__webpack_require__(4),angularjs_=__webpack_require__(9),angularjs_default=__webpack_require__.n(angularjs_);Object(external_angular_.module)("spinnaker.docker.pipeline.stage.bake.executionDetails.controller",[angularjs_default.a]).controller("dockerBakeExecutionDetailsCtrl",["$scope","$stateParams","executionDetailsSectionService","$interpolate",function($scope,$stateParams,executionDetailsSectionService,$interpolate){$scope.configSections=["bakeConfig","taskStatus"];const initialized=()=>{$scope.detailsSection=$stateParams.details,$scope.provider=$scope.stage.context.cloudProviderType||"docker",$scope.bakeryDetailUrl=$interpolate($scope.roscoMode&&core_.SETTINGS.roscoDetailUrl?core_.SETTINGS.roscoDetailUrl:core_.SETTINGS.bakeryDetailUrl)},initialize=()=>executionDetailsSectionService.synchronizeSection($scope.configSections,initialized);initialize(),$scope.$on("$stateChangeSuccess",initialize)}]);Object(external_angular_.module)("spinnaker.docker.pipeline.stage.bakeStage",["spinnaker.docker.pipeline.stage.bake.executionDetails.controller"]).config((function(){core_.Registry.pipeline.registerStage({provides:"bake",cloudProvider:"docker",label:"Bake",description:"Bakes an image",templateUrl:__webpack_require__(7),executionDetailsUrl:__webpack_require__(8),executionLabelComponent:core_.BakeExecutionLabel,extraLabelLines:stage=>stage.masterStage.context.allPreviouslyBaked||stage.masterStage.context.somePreviouslyBaked?1:0,supportsCustomTimeout:!0,validators:[{type:"requiredField",fieldName:"package"}],restartable:!0})})).controller("dockerBakeStageCtrl",["$scope","$q",function($scope,$q){$scope.stage.region="global",$scope.stage.user||($scope.stage.user=core_.AuthenticationService.getAuthenticatedUser().name),$scope.viewState={loading:!0},$scope.$watch("stage",(function(){external_lodash_default.a.forOwn($scope.stage,(function(val,key){""===val&&delete $scope.stage[key]}))}),!0),$scope.viewState.providerSelected=!0,$q.all([core_.BakeryReader.getBaseOsOptions("docker"),core_.BakeryReader.getBaseLabelOptions()]).then((function([baseOsOptions,baseLabelOptions]){$scope.baseOsOptions=baseOsOptions.baseImages,$scope.baseLabelOptions=baseLabelOptions,!$scope.stage.baseOs&&$scope.baseOsOptions&&$scope.baseOsOptions.length&&($scope.stage.baseOs=$scope.baseOsOptions[0].id),!$scope.stage.baseLabel&&$scope.baseLabelOptions&&$scope.baseLabelOptions.length&&($scope.stage.baseLabel=$scope.baseLabelOptions[0]),$scope.viewState.loading=!1}))}]);var __rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t};var external_ngimport_=__webpack_require__(10),external_rxjs_=__webpack_require__(5),operators_=__webpack_require__(6);const lookupTypeOptions=[{value:"digest",label:"Digest"},{value:"tag",label:"Tag"}];class DockerTriggerTemplate_DockerTriggerTemplate extends external_react_default.a.Component{constructor(props){super(props),this.queryStream=new external_rxjs_.Subject,this.handleQuery=()=>{const trigger=this.props.command.trigger;return Object(external_rxjs_.from)(DockerImageReader_DockerImageReader.findTags({provider:"dockerRegistry",account:trigger.account,repository:trigger.repository}))},this.lookupTypeChanged=o=>{const newType=o.value;this.updateArtifact(this.props.command,"tag"===newType?this.state.selectedTag:this.state.digest),this.setState({lookupType:newType})},this.updateSelectedTag=tag=>{this.updateArtifact(this.props.command,tag),this.setState({selectedTag:tag}),this.props.command.triggerInvalid=!1},this.updateDigest=digest=>{this.updateArtifact(this.props.command,digest),this.setState({digest})},this.tagLoadSuccess=tags=>{const{command}=this.props,trigger=command.trigger,newState={};newState.tags=tags||[];const defaultSelection=newState.tags.find(t=>t===trigger.tag);defaultSelection&&(newState.selectedTag=defaultSelection,this.updateSelectedTag(defaultSelection)),newState.tagsLoading=!1,this.setState(newState)},this.tagLoadFailure=()=>{this.setState({tagsLoading:!1,loadError:!0})},this.initialize=()=>{const{command}=this.props;this.props.updateCommand("triggerInvalid",!0),this.props.updateCommand("extraFields",{tag:Object(external_lodash_.get)(command,"extraFields.tag",""),artifacts:Object(external_lodash_.get)(command,"extraFields.artifacts","")}),this.subscription&&this.subscription.unsubscribe(),"docker"===command.trigger.type&&(this.subscription=this.queryStream.pipe(Object(operators_.debounceTime)(250),Object(operators_.switchMap)(this.handleQuery)).subscribe(this.tagLoadSuccess,this.tagLoadFailure),this.searchTags())},this.searchTags=(query="")=>{this.setState({tags:[`<span>Finding tags${query&&` matching ${query}`}...</span>`]}),this.queryStream.next()},this.state={digest:"",tags:[],tagsLoading:!0,loadError:!1,lookupType:"tag",selectedTag:""}}static formatLabel(trigger){return external_ngimport_.$q.when(`(Docker Registry) ${trigger.account?trigger.account+":":""} ${trigger.repository||""}`)}updateArtifact(command,tagOrDigest){this.props.updateCommand("extraFields.tag",tagOrDigest);const trigger=command.trigger;if(trigger&&trigger.repository){let imageName="";trigger.registry&&(imageName+=trigger.registry+"/"),imageName+=trigger.repository;let imageReference="";imageReference="digest"===this.state.lookupType?`${imageName}@${tagOrDigest}`:`${imageName}:${tagOrDigest}`,this.props.updateCommand("extraFields.artifacts",[{type:"docker/image",name:imageName,version:tagOrDigest,reference:imageReference}])}}componentDidMount(){this.initialize()}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}render(){const{digest,tags,tagsLoading,loadError,selectedTag,lookupType}=this.state,options=tags.map(tag=>({value:tag}));return external_react_default.a.createElement(external_react_default.a.Fragment,null,external_react_default.a.createElement("div",{className:"form-group"},external_react_default.a.createElement("div",{className:"sm-label-right col-md-4"},"Type"),external_react_default.a.createElement("div",{className:"col-md-3"},external_react_default.a.createElement(core_.TetheredSelect,{clearable:!1,value:lookupType,options:lookupTypeOptions,onChange:this.lookupTypeChanged}))),"tag"===lookupType&&external_react_default.a.createElement("div",{className:"form-group"},external_react_default.a.createElement("label",{className:"col-md-4 sm-label-right"},"Tag"),tagsLoading&&external_react_default.a.createElement("div",{className:"col-md-6"},external_react_default.a.createElement("div",{className:"form-control-static text-center"},external_react_default.a.createElement(core_.Spinner,{size:"small"}))),loadError&&external_react_default.a.createElement("div",{className:"col-md-6"},"Error loading tags!"),!tagsLoading&&external_react_default.a.createElement("div",{className:"col-md-6"},0===tags.length&&external_react_default.a.createElement("div",null,external_react_default.a.createElement("p",{className:"form-control-static"},"No tags found")),tags.length>0&&external_react_default.a.createElement(core_.TetheredSelect,{options,optionRenderer:o=>external_react_default.a.createElement("span",null,o.value),clearable:!1,value:selectedTag,valueRenderer:o=>external_react_default.a.createElement("span",null,external_react_default.a.createElement("strong",null,o.value)),onChange:o=>this.updateSelectedTag(o.value),placeholder:"Search tags..."}))),"digest"===lookupType&&external_react_default.a.createElement("div",{className:"form-group"},external_react_default.a.createElement("label",{className:"col-md-4 sm-label-right"},"Digest ",external_react_default.a.createElement(core_.HelpField,{id:"pipeline.config.docker.trigger.digest"})),external_react_default.a.createElement("div",{className:"col-md-6"},external_react_default.a.createElement("input",{value:digest,onChange:e=>this.updateDigest(e.target.value),className:"form-control input-sm",required:!0}))))}}core_.Registry.pipeline.registerTrigger({label:"Docker Registry",description:"Executes the pipeline on an image update",key:"docker",component:function(props){const{formik}=props,trigger=formik.values;return external_react_default.a.createElement("div",{className:"form-horizontal"},external_react_default.a.createElement(DockerImageAndTagSelector_DockerImageAndTagSelector,{allowManualDefinition:!1,specifyTagByRegex:!0,account:trigger.account,organization:trigger.organization,registry:trigger.registry,repository:trigger.repository,tag:trigger.tag,showRegistry:!0,onChange:changes=>{const{imageId}=changes,rest=__rest(changes,["imageId"]);props.triggerUpdated(rest)},showDigest:!1}))},manualExecutionComponent:DockerTriggerTemplate_DockerTriggerTemplate,executionStatusComponent:props=>{const trigger=props.trigger;return external_react_default.a.createElement("li",null,trigger.repository,":",trigger.tag)},executionTriggerLabel:()=>"Docker Registry",validators:[{type:"requiredField",fieldName:"account",message:"<strong>Registry</strong> is a required field for Docker Registry triggers."},{type:"requiredField",fieldName:"repository",message:"<strong>Image</strong> is a required field for Docker Registry triggers."},{type:"serviceAccountAccess",preventSave:!0,message:"You do not have access to the service account configured in this pipeline's Docker Registry trigger.\n You will not be able to save your edits to this pipeline."}]});const templates=__webpack_require__(11);templates.keys().forEach((function(key){templates(key)}));const DOCKER_MODULE="spinnaker.docker";Object(external_angular_.module)(DOCKER_MODULE,["spinnaker.docker.pipeline.stage.bakeStage"])}])}));
//# sourceMappingURL=lib.js.map
{
"name": "@spinnaker/docker",
"license": "Apache-2.0",
"version": "0.0.71",
"version": "0.0.72",
"main": "lib/lib.js",

@@ -6,0 +6,0 @@ "typings": "lib/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc