@spinnaker/docker
Advanced tools
Comparing version 0.0.22 to 0.0.23
@@ -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__0__){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,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__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=21)}([function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(module,exports){module.exports=require("angular")},function(module,exports){module.exports=require("react")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=__webpack_require__(0);exports.DockerImageReader=class{static getImage(imageName,region,credentials){return core_1.API.all("images").one(credentials).one(region).one(imageName).withParams({provider:"docker"}).get().then(results=>results&&results.length?results[0]:null).catch(()=>null)}static findImages(params){return core_1.RetryService.buildRetrySequence(()=>core_1.API.all("images/find").getList(params),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}static findTags(params){return core_1.RetryService.buildRetrySequence(()=>core_1.API.all("images/tags").getList(params),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}}},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"\n 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"\n 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"\n 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"\n 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"\n ng-model="stage.baseLabel"\n 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"\n ng-model="stage.rebake">\n </input>\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) }}">\n View Bakery Details\n </a>\n </div>\n </div>\n </div>\n\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,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.DockerImageUtils=class{static splitImageId(imageId){const parts=imageId.split("/"),organization=parts.length>1?parts.shift():"",rest=parts.shift().split(":"),repository=organization.length>0?`${organization}/${rest.shift()}`:rest.shift(),lookup=rest.shift();let tag,digest;return lookup&&(lookup.startsWith("sha256:")?digest=lookup:tag=lookup),{organization:organization,repository:repository,digest:digest,tag:tag}}static generateImageId(parts){if(parts.repository&&(parts.digest||parts.tag))return`${parts.repository}:${parts.digest?parts.digest:parts.tag}`}}},function(module,exports){module.exports=require("lodash")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),react_select_1=__webpack_require__(19),lodash_1=__webpack_require__(7),core_1=__webpack_require__(0),DockerImageReader_1=__webpack_require__(3),DockerImageUtils_1=__webpack_require__(6);class DockerImageAndTagSelector extends React.Component{constructor(props){super(props),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});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}]:[];this.state={accountOptions:accountOptions,imagesLoaded:!1,imagesLoading:!1,imagesRefreshing:!1,organizationOptions:organizationOptions,repositoryOptions:repositoryOptions,tagOptions:tagOptions,lookupType:props.digest?"digest":"tag"}}getAccountMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.account),"account");return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.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=lodash_1.groupBy(images.filter(image=>image.repository),image=>`${image.account}/${image.repository.split("/").slice(0,-1).join("/")}`);return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.uniq(image.map(i=>i.repository)),acc),{})}getRepositoryMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.account),"repository");return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.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&&""===lodash_1.trim(tag)&&(tag=void 0):repositoryMap&&((tags=repositoryMap[repository]||[]).includes(tag)||!tag||tag.includes("${")||(tag=void 0)),{tag:tag,tags: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)}synchronizeChanges(values,registry){const{organization:organization,repository:repository,tag:tag,digest:digest}=values;if(this.props.onChange){const imageId=DockerImageUtils_1.DockerImageUtils.generateImageId({organization:organization,repository:repository,tag:tag,digest: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){let{organization:organization,registry:registry,repository:repository}=props;const{account:account,showRegistry:showRegistry}=props;organization=this.organizations.includes(organization)||!organization||organization.includes("${")?organization:"",showRegistry&&(registry=this.registryMap[account]);const repositories=this.getRepositoryList(this.organizationMap,organization,registry);repositories.includes(repository)||!repository||repository.includes("${")||(repository="");const{tag:tag,tags:tags}=this.getTags(props.tag,this.repositoryMap,repository);this.synchronizeChanges({organization:organization,repository:repository,tag:tag,digest:this.props.digest},registry),this.setState({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}))})}initializeImages(props,refresh){if(this.state.imagesLoading)return;const{showRegistry:showRegistry,account:account,registry:registry}=props,imageConfig={provider:"dockerRegistry",account:showRegistry?account:registry};this.setState({imagesLoading:!0,imagesRefreshing:!!refresh}),DockerImageReader_1.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)}).finally(()=>{this.setState({imagesLoading:!1,imagesRefreshing:!1})})}refreshImages(props){this.initializeImages(props,!0)}initializeAccounts(props){let{account:account}=props;core_1.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({},props,{account:account}))})}isNew(){const{account:account,organization:organization,registry:registry,repository:repository,tag: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(["organization","repository","tag","digest"].some(n=>n===name)){const{organization:organization,repository:repository,tag:tag,digest:digest}=this.props,imageParts=Object.assign({organization:organization,repository:repository,tag:tag,digest:digest},changes),imageId=DockerImageUtils_1.DockerImageUtils.generateImageId(imageParts);changes.imageId=imageId}this.props.onChange&&this.props.onChange(changes)}render(){const{account:account,digest:digest,fieldClass:fieldClass,imageId:imageId,labelClass:labelClass,organization:organization,repository:repository,showDigest:showDigest,showRegistry:showRegistry,specifyTagByRegex:specifyTagByRegex,tag:tag}=this.props,{accountOptions:accountOptions,imagesLoading:imagesLoading,imagesRefreshing:imagesRefreshing,lookupType:lookupType,organizationOptions:organizationOptions,repositoryOptions:repositoryOptions,tagOptions:tagOptions}=this.state;if(imageId&&imageId.includes("${"))return React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Image ID"),React.createElement("div",{className:fieldClass},React.createElement("input",{className:"form-control input-sm",value:imageId,onChange:e=>this.valueChanged("imageId",e.target.value)})));const Registry=showRegistry?React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Registry Name"),React.createElement("div",{className:fieldClass},React.createElement(react_select_1.default,{value:account,disabled:imagesRefreshing,onChange:o=>this.valueChanged("account",o?o.value:""),options:accountOptions,isLoading:imagesRefreshing})),React.createElement("div",{className:"col-md-1 text-center"},React.createElement(core_1.Tooltip,{value:imagesRefreshing?"Images refreshing":"Refresh images list"},React.createElement("a",{className:"clickable",onClick:this.handleRefreshImages},React.createElement("span",{className:`fa fa-sync-alt ${imagesRefreshing?"fa-spin":""}`}))))):null,Organization=React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Organization"),React.createElement("div",{className:fieldClass},organization.includes("${")?React.createElement("input",{disabled:imagesRefreshing,className:"form-control input-sm",value:organization,onChange:e=>this.valueChanged("organization",e.target.value)}):React.createElement(react_select_1.default,{value:organization,disabled:imagesRefreshing,onChange:o=>this.valueChanged("organization",o&&o.value||""),placeholder:"No organization",options:organizationOptions,isLoading:imagesRefreshing}))),Image=React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Image"),React.createElement("div",{className:fieldClass},repository.includes("${")?React.createElement("input",{className:"form-control input-sm",disabled:imagesRefreshing,value:repository,onChange:e=>this.valueChanged("repository",e.target.value)}):React.createElement(react_select_1.default,{value:repository,disabled:imagesRefreshing,onChange:o=>this.valueChanged("repository",o&&o.value||""),options:repositoryOptions,required:!0,isLoading:imagesRefreshing}))),Tag="tag"===lookupType?specifyTagByRegex?React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Tag ",React.createElement(core_1.HelpField,{id:"pipeline.config.docker.trigger.tag"})),React.createElement("div",{className:fieldClass},React.createElement("input",{type:"text",className:"form-control input-sm",value:tag||"",disabled:imagesRefreshing||!repository,onChange:e=>this.valueChanged("tag",e.target.value)}))):React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Tag"),React.createElement("div",{className:fieldClass},tag&&tag.includes("${")?React.createElement("input",{className:"form-control input-sm",disabled:imagesRefreshing,value:tag||"",onChange:e=>this.valueChanged("tag",e.target.value),required:!0}):React.createElement(react_select_1.default,{value:tag||"",disabled:imagesRefreshing||!repository,isLoading:imagesLoading,onChange:o=>this.valueChanged("tag",o?o.value:void 0),options:tagOptions,placeholder:"No tag",required:!0}))):null,Digest="digest"===lookupType?React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Digest"),React.createElement("div",{className:fieldClass},React.createElement("input",{className:"form-control input-sm",placeholder:"sha256:abc123",value:digest||"",onChange:e=>this.valueChanged("digest",e.target.value),required:!0}))):null,LookupTypeSelector=showDigest?React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Type"),React.createElement("div",{className:"col-md-3"},React.createElement(react_select_1.default,{clearable:!1,value:lookupType,options:[{value:"digest",label:"Digest"},{value:"tag",label:"Tag"}],onChange:this.lookupTypeChanged}))):null;return React.createElement(React.Fragment,null,Registry,Organization,Image,LookupTypeSelector,Digest,Tag)}}DockerImageAndTagSelector.defaultProps={fieldClass:"col-md-8",labelClass:"col-md-3",organization:"",registry:"",repository:"",showDigest:!0},exports.DockerImageAndTagSelector=DockerImageAndTagSelector},function(module,exports){module.exports=require("@uirouter/angularjs")},function(module,exports,__webpack_require__){"use strict";var _core=__webpack_require__(0);const angular=__webpack_require__(1);module.exports=angular.module("spinnaker.docker.pipeline.stage.bake.executionDetails.controller",[__webpack_require__(9).default]).controller("dockerBakeExecutionDetailsCtrl",["$scope","$stateParams","executionDetailsSectionService","$interpolate",function($scope,$stateParams,executionDetailsSectionService,$interpolate){$scope.configSections=["bakeConfig","taskStatus"];let initialized=()=>{$scope.detailsSection=$stateParams.details,$scope.provider=$scope.stage.context.cloudProviderType||"docker",$scope.bakeryDetailUrl=$interpolate(_core.SETTINGS.bakeryDetailUrl)},initialize=()=>executionDetailsSectionService.synchronizeSection($scope.configSections,initialized);initialize(),$scope.$on("$stateChangeSuccess",initialize)}])},function(module,exports,__webpack_require__){"use strict";var obj,_lodash=__webpack_require__(7),_lodash2=(obj=_lodash)&&obj.__esModule?obj:{default:obj},_core=__webpack_require__(0);const angular=__webpack_require__(1);module.exports=angular.module("spinnaker.docker.pipeline.stage.bakeStage",[__webpack_require__(10).name]).config(function(){_core.Registry.pipeline.registerStage({provides:"bake",cloudProvider:"docker",label:"Bake",description:"Bakes an image",templateUrl:__webpack_require__(4),executionDetailsUrl:__webpack_require__(5),executionLabelComponent:_core.BakeExecutionLabel,extraLabelLines:stage=>stage.masterStage.context.allPreviouslyBaked||stage.masterStage.context.somePreviouslyBaked?1:0,defaultTimeoutMs:36e5,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(){_lodash2.default.forOwn($scope.stage,function(val,key){""===val&&delete $scope.stage[key]})},!0),$scope.viewState.providerSelected=!0,$q.all({baseOsOptions:_core.BakeryReader.getBaseOsOptions("docker"),baseLabelOptions:_core.BakeryReader.getBaseLabelOptions()}).then(function(results){$scope.baseOsOptions=results.baseOsOptions.baseImages,$scope.baseLabelOptions=results.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})}])},function(module,exports,__webpack_require__){var map={"./pipeline/stages/bake/bakeExecutionDetails.html":5,"./pipeline/stages/bake/bakeStage.html":4};function webpackContext(req){var id=webpackContextResolve(req);return __webpack_require__(id)}function webpackContextResolve(req){var id=map[req];if(!(id+1)){var e=new Error('Cannot find module "'+req+'".');throw e.code="MODULE_NOT_FOUND",e}return id}webpackContext.keys=function(){return Object.keys(map)},webpackContext.resolve=webpackContextResolve,module.exports=webpackContext,webpackContext.id=12},function(module,exports,__webpack_require__){"use strict";var __rest=this&&this.__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&&(t[p[i]]=s[p[i]])}return t};Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),core_1=__webpack_require__(0),DockerImageAndTagSelector_1=__webpack_require__(8);exports.DockerTriggerConfig=class extends React.Component{constructor(){super(...arguments),this.state={fiatEnabled:core_1.SETTINGS.feature.fiatEnabled,serviceAccounts:[]},this.dockerChanged=(changes=>{const{imageId:imageId}=changes,rest=__rest(changes,["imageId"]);Object.assign(this.props.trigger,rest),this.props.fieldUpdated(),this.setState({})}),this.runAsUserChanged=(user=>{this.props.trigger.runAsUser=""!==user?user:null,this.props.fieldUpdated(),this.setState({})})}componentDidMount(){core_1.ServiceAccountReader.getServiceAccounts().then(serviceAccounts=>{this.setState({serviceAccounts:serviceAccounts})})}render(){const{trigger:trigger}=this.props,{fiatEnabled:fiatEnabled,serviceAccounts:serviceAccounts}=this.state;return React.createElement("div",{className:"form-horizontal"},React.createElement(DockerImageAndTagSelector_1.DockerImageAndTagSelector,{specifyTagByRegex:!0,account:trigger.account,organization:trigger.organization,registry:trigger.registry,repository:trigger.repository,tag:trigger.tag,showRegistry:!0,onChange:this.dockerChanged,showDigest:!1}),fiatEnabled&&React.createElement("div",{className:"form-group"},React.createElement(core_1.RunAsUser,{serviceAccounts:serviceAccounts,value:trigger.runAsUser,onChange:this.runAsUserChanged})))}}},function(module,exports){module.exports=require("rxjs")},function(module,exports){module.exports=require("ngimport")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),ngimport_1=__webpack_require__(15),rxjs_1=__webpack_require__(14),core_1=__webpack_require__(0),DockerImageReader_1=__webpack_require__(3);exports.DockerTriggerTemplate=class extends React.Component{constructor(props){super(props),this.queryStream=new rxjs_1.Subject,this.handleQuery=(()=>{const trigger=this.props.command.trigger;return rxjs_1.Observable.fromPromise(DockerImageReader_1.DockerImageReader.findTags({provider:"dockerRegistry",account:trigger.account,repository:trigger.repository}))}),this.updateSelectedTag=(tag=>{const{command:command}=this.props,trigger=command.trigger;if(command.extraFields.tag=tag,trigger&&trigger.repository){let imageName="";trigger.registry&&(imageName+=trigger.registry+"/"),imageName+=trigger.repository,command.extraFields.artifacts=[{type:"docker/image",name:imageName,version:tag,reference:imageName+":"+tag}]}this.setState({selectedTag:tag})}),this.tagLoadSuccess=(tags=>{const{command:command}=this.props,trigger=command.trigger,newState={};if(newState.tags=tags,newState.tags.length){const defaultSelection=newState.tags.find(t=>t===trigger.tag)||newState.tags[0];newState.selectedTag=defaultSelection,this.updateSelectedTag(defaultSelection)}newState.tagsLoading=!1,this.setState(newState)}),this.tagLoadFailure=(()=>{this.setState({tagsLoading:!1,loadError:!0})}),this.initialize=(()=>{const{command:command}=this.props;this.subscription=this.queryStream.debounceTime(250).switchMap(this.handleQuery).subscribe(this.tagLoadSuccess,this.tagLoadFailure),command.extraFields={},"docker"===command.trigger.type?this.searchTags():this.subscription.unsubscribe()}),this.searchTags=((query="")=>{this.setState({tags:[`<span>Finding tags${query&&` matching ${query}`}...</span>`]}),this.queryStream.next()}),this.state={tags:[],tagsLoading:!0,loadError:!1,selectedTag:""}}static formatLabel(trigger){return ngimport_1.$q.when(`(Docker Registry) ${trigger.account?trigger.account+":":""} ${trigger.repository||""}`)}componentWillReceiveProps(nextProps){nextProps.command!==this.props.command&&this.initialize()}componentDidMount(){this.initialize()}render(){const{tags:tags,tagsLoading:tagsLoading,loadError:loadError,selectedTag:selectedTag}=this.state,options=tags.map(tag=>({value:tag}));return React.createElement("div",{className:"form-group"},React.createElement("label",{className:"col-md-4 sm-label-right"},"Tag"),tagsLoading&&React.createElement("div",{className:"col-md-6"},React.createElement("div",{className:"form-control-static text-center"},React.createElement(core_1.Spinner,{size:"small"}))),React.createElement("input",{type:"hidden",required:tagsLoading,value:selectedTag}),loadError&&React.createElement("div",{className:"col-md-6"},"Error loading tags!"),!tagsLoading&&React.createElement("div",{className:"col-md-6"},0===tags.length&&React.createElement("div",null,React.createElement("p",{className:"form-control-static"},"No tags found")),tags.length>0&&React.createElement(core_1.TetheredSelect,{options:options,optionRenderer:o=>React.createElement("span",null,o.value),clearable:!1,value:selectedTag,valueRenderer:o=>React.createElement("span",null,React.createElement("strong",null,o.value)),onChange:o=>this.updateSelectedTag(o.value)})))}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=__webpack_require__(0),DockerTriggerTemplate_1=__webpack_require__(16),DockerTriggerConfig_1=__webpack_require__(13);core_1.Registry.pipeline.registerTrigger({label:"Docker Registry",description:"Executes the pipeline on an image update",key:"docker",component:DockerTriggerConfig_1.DockerTriggerConfig,manualExecutionComponent:DockerTriggerTemplate_1.DockerTriggerTemplate,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."}]})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const angular_1=__webpack_require__(1);__webpack_require__(17);const templates=__webpack_require__(12);templates.keys().forEach(function(key){templates(key)}),exports.DOCKER_MODULE="spinnaker.docker",angular_1.module(exports.DOCKER_MODULE,[__webpack_require__(11).name])},function(module,exports){module.exports=require("react-select")},function(module,exports,__webpack_require__){"use strict";function __export(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(__webpack_require__(3)),__export(__webpack_require__(8)),__export(__webpack_require__(6))},function(module,exports,__webpack_require__){"use strict";function __export(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(__webpack_require__(20)),__export(__webpack_require__(18))}])}); | ||
!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__0__){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,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__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=21)}([function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(module,exports){module.exports=require("angular")},function(module,exports){module.exports=require("react")},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"\n 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"\n 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"\n 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"\n 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"\n ng-model="stage.baseLabel"\n 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"\n ng-model="stage.rebake">\n </input>\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) }}">\n View Bakery Details\n </a>\n </div>\n </div>\n </div>\n\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,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.DockerImageUtils=class{static splitImageId(imageId){const parts=imageId.split("/"),organization=parts.length>1?parts.shift():"",rest=parts.shift().split(":"),repository=organization.length>0?`${organization}/${rest.shift()}`:rest.shift(),lookup=rest.shift();let tag,digest;return lookup&&(lookup.startsWith("sha256:")?digest=lookup:tag=lookup),{organization:organization,repository:repository,digest:digest,tag:tag}}static generateImageId(parts){if(parts.repository&&(parts.digest||parts.tag))return`${parts.repository}:${parts.digest?parts.digest:parts.tag}`}}},function(module,exports){module.exports=require("lodash")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),react_select_1=__webpack_require__(20),lodash_1=__webpack_require__(6),core_1=__webpack_require__(0),DockerImageReader_1=__webpack_require__(8),DockerImageUtils_1=__webpack_require__(5);class DockerImageAndTagSelector extends React.Component{constructor(props){super(props),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});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}]:[];this.state={accountOptions:accountOptions,imagesLoaded:!1,imagesLoading:!1,imagesRefreshing:!1,organizationOptions:organizationOptions,repositoryOptions:repositoryOptions,tagOptions:tagOptions,lookupType:props.digest?"digest":"tag"}}getAccountMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.account),"account");return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.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=lodash_1.groupBy(images.filter(image=>image.repository),image=>`${image.account}/${image.repository.split("/").slice(0,-1).join("/")}`);return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.uniq(image.map(i=>i.repository)),acc),{})}getRepositoryMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.account),"repository");return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.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&&""===lodash_1.trim(tag)&&(tag=void 0):repositoryMap&&((tags=repositoryMap[repository]||[]).includes(tag)||!tag||tag.includes("${")||(tag=void 0)),{tag:tag,tags: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)}synchronizeChanges(values,registry){const{organization:organization,repository:repository,tag:tag,digest:digest}=values;if(this.props.onChange){const imageId=DockerImageUtils_1.DockerImageUtils.generateImageId({organization:organization,repository:repository,tag:tag,digest: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){let{organization:organization,registry:registry,repository:repository}=props;const{account:account,showRegistry:showRegistry}=props;organization=this.organizations.includes(organization)||!organization||organization.includes("${")?organization:"",showRegistry&&(registry=this.registryMap[account]);const repositories=this.getRepositoryList(this.organizationMap,organization,registry);repositories.includes(repository)||!repository||repository.includes("${")||(repository="");const{tag:tag,tags:tags}=this.getTags(props.tag,this.repositoryMap,repository);this.synchronizeChanges({organization:organization,repository:repository,tag:tag,digest:this.props.digest},registry),this.setState({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}))})}initializeImages(props,refresh){if(this.state.imagesLoading)return;const{showRegistry:showRegistry,account:account,registry:registry}=props,imageConfig={provider:"dockerRegistry",account:showRegistry?account:registry};this.setState({imagesLoading:!0,imagesRefreshing:!!refresh}),DockerImageReader_1.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)}).finally(()=>{this.setState({imagesLoading:!1,imagesRefreshing:!1})})}refreshImages(props){this.initializeImages(props,!0)}initializeAccounts(props){let{account:account}=props;core_1.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({},props,{account:account}))})}isNew(){const{account:account,organization:organization,registry:registry,repository:repository,tag: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(["organization","repository","tag","digest"].some(n=>n===name)){const{organization:organization,repository:repository,tag:tag,digest:digest}=this.props,imageParts=Object.assign({organization:organization,repository:repository,tag:tag,digest:digest},changes),imageId=DockerImageUtils_1.DockerImageUtils.generateImageId(imageParts);changes.imageId=imageId}this.props.onChange&&this.props.onChange(changes)}render(){const{account:account,digest:digest,fieldClass:fieldClass,imageId:imageId,labelClass:labelClass,organization:organization,repository:repository,showDigest:showDigest,showRegistry:showRegistry,specifyTagByRegex:specifyTagByRegex,tag:tag}=this.props,{accountOptions:accountOptions,imagesLoading:imagesLoading,imagesRefreshing:imagesRefreshing,lookupType:lookupType,organizationOptions:organizationOptions,repositoryOptions:repositoryOptions,tagOptions:tagOptions}=this.state;if(imageId&&imageId.includes("${"))return React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Image ID"),React.createElement("div",{className:fieldClass},React.createElement("input",{className:"form-control input-sm",value:imageId,onChange:e=>this.valueChanged("imageId",e.target.value)})));const Registry=showRegistry?React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Registry Name"),React.createElement("div",{className:fieldClass},React.createElement(react_select_1.default,{value:account,disabled:imagesRefreshing,onChange:o=>this.valueChanged("account",o?o.value:""),options:accountOptions,isLoading:imagesRefreshing})),React.createElement("div",{className:"col-md-1 text-center"},React.createElement(core_1.Tooltip,{value:imagesRefreshing?"Images refreshing":"Refresh images list"},React.createElement("a",{className:"clickable",onClick:this.handleRefreshImages},React.createElement("span",{className:`fa fa-sync-alt ${imagesRefreshing?"fa-spin":""}`}))))):null,Organization=React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Organization"),React.createElement("div",{className:fieldClass},organization.includes("${")?React.createElement("input",{disabled:imagesRefreshing,className:"form-control input-sm",value:organization,onChange:e=>this.valueChanged("organization",e.target.value)}):React.createElement(react_select_1.default,{value:organization,disabled:imagesRefreshing,onChange:o=>this.valueChanged("organization",o&&o.value||""),placeholder:"No organization",options:organizationOptions,isLoading:imagesRefreshing}))),Image=React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Image"),React.createElement("div",{className:fieldClass},repository.includes("${")?React.createElement("input",{className:"form-control input-sm",disabled:imagesRefreshing,value:repository,onChange:e=>this.valueChanged("repository",e.target.value)}):React.createElement(react_select_1.default,{value:repository,disabled:imagesRefreshing,onChange:o=>this.valueChanged("repository",o&&o.value||""),options:repositoryOptions,required:!0,isLoading:imagesRefreshing}))),Tag="tag"===lookupType?specifyTagByRegex?React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Tag ",React.createElement(core_1.HelpField,{id:"pipeline.config.docker.trigger.tag"})),React.createElement("div",{className:fieldClass},React.createElement("input",{type:"text",className:"form-control input-sm",value:tag||"",disabled:imagesRefreshing||!repository,onChange:e=>this.valueChanged("tag",e.target.value)}))):React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Tag"),React.createElement("div",{className:fieldClass},tag&&tag.includes("${")?React.createElement("input",{className:"form-control input-sm",disabled:imagesRefreshing,value:tag||"",onChange:e=>this.valueChanged("tag",e.target.value),required:!0}):React.createElement(react_select_1.default,{value:tag||"",disabled:imagesRefreshing||!repository,isLoading:imagesLoading,onChange:o=>this.valueChanged("tag",o?o.value:void 0),options:tagOptions,placeholder:"No tag",required:!0}))):null,Digest="digest"===lookupType?React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Digest"),React.createElement("div",{className:fieldClass},React.createElement("input",{className:"form-control input-sm",placeholder:"sha256:abc123",value:digest||"",onChange:e=>this.valueChanged("digest",e.target.value),required:!0}))):null,LookupTypeSelector=showDigest?React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Type"),React.createElement("div",{className:"col-md-3"},React.createElement(react_select_1.default,{clearable:!1,value:lookupType,options:[{value:"digest",label:"Digest"},{value:"tag",label:"Tag"}],onChange:this.lookupTypeChanged}))):null;return React.createElement(React.Fragment,null,Registry,Organization,Image,LookupTypeSelector,Digest,Tag)}}DockerImageAndTagSelector.defaultProps={fieldClass:"col-md-8",labelClass:"col-md-3",organization:"",registry:"",repository:"",showDigest:!0},exports.DockerImageAndTagSelector=DockerImageAndTagSelector},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=__webpack_require__(0);exports.DockerImageReader=class{static getImage(imageName,region,credentials){return core_1.API.all("images").one(credentials).one(region).one(imageName).withParams({provider:"docker"}).get().then(results=>results&&results.length?results[0]:null).catch(()=>null)}static findImages(params){return core_1.RetryService.buildRetrySequence(()=>core_1.API.all("images/find").getList(params),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}static findTags(params){return core_1.RetryService.buildRetrySequence(()=>core_1.API.all("images/tags").getList(params),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}}},function(module,exports,__webpack_require__){"use strict";function __export(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(__webpack_require__(8)),__export(__webpack_require__(7)),__export(__webpack_require__(5))},function(module,exports){module.exports=require("@uirouter/angularjs")},function(module,exports,__webpack_require__){"use strict";var _core=__webpack_require__(0);const angular=__webpack_require__(1);module.exports=angular.module("spinnaker.docker.pipeline.stage.bake.executionDetails.controller",[__webpack_require__(10).default]).controller("dockerBakeExecutionDetailsCtrl",["$scope","$stateParams","executionDetailsSectionService","$interpolate",function($scope,$stateParams,executionDetailsSectionService,$interpolate){$scope.configSections=["bakeConfig","taskStatus"];let initialized=()=>{$scope.detailsSection=$stateParams.details,$scope.provider=$scope.stage.context.cloudProviderType||"docker",$scope.bakeryDetailUrl=$interpolate(_core.SETTINGS.bakeryDetailUrl)},initialize=()=>executionDetailsSectionService.synchronizeSection($scope.configSections,initialized);initialize(),$scope.$on("$stateChangeSuccess",initialize)}])},function(module,exports,__webpack_require__){"use strict";var obj,_lodash=__webpack_require__(6),_lodash2=(obj=_lodash)&&obj.__esModule?obj:{default:obj},_core=__webpack_require__(0);const angular=__webpack_require__(1);module.exports=angular.module("spinnaker.docker.pipeline.stage.bakeStage",[__webpack_require__(11).name]).config(function(){_core.Registry.pipeline.registerStage({provides:"bake",cloudProvider:"docker",label:"Bake",description:"Bakes an image",templateUrl:__webpack_require__(3),executionDetailsUrl:__webpack_require__(4),executionLabelComponent:_core.BakeExecutionLabel,extraLabelLines:stage=>stage.masterStage.context.allPreviouslyBaked||stage.masterStage.context.somePreviouslyBaked?1:0,defaultTimeoutMs:36e5,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(){_lodash2.default.forOwn($scope.stage,function(val,key){""===val&&delete $scope.stage[key]})},!0),$scope.viewState.providerSelected=!0,$q.all({baseOsOptions:_core.BakeryReader.getBaseOsOptions("docker"),baseLabelOptions:_core.BakeryReader.getBaseLabelOptions()}).then(function(results){$scope.baseOsOptions=results.baseOsOptions.baseImages,$scope.baseLabelOptions=results.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})}])},function(module,exports,__webpack_require__){var map={"./pipeline/stages/bake/bakeExecutionDetails.html":4,"./pipeline/stages/bake/bakeStage.html":3};function webpackContext(req){var id=webpackContextResolve(req);return __webpack_require__(id)}function webpackContextResolve(req){var id=map[req];if(!(id+1)){var e=new Error('Cannot find module "'+req+'".');throw e.code="MODULE_NOT_FOUND",e}return id}webpackContext.keys=function(){return Object.keys(map)},webpackContext.resolve=webpackContextResolve,module.exports=webpackContext,webpackContext.id=13},function(module,exports,__webpack_require__){"use strict";var __rest=this&&this.__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&&(t[p[i]]=s[p[i]])}return t};Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),core_1=__webpack_require__(0),DockerImageAndTagSelector_1=__webpack_require__(7);exports.DockerTriggerConfig=class extends React.Component{constructor(){super(...arguments),this.state={fiatEnabled:core_1.SETTINGS.feature.fiatEnabled,serviceAccounts:[]},this.dockerChanged=(changes=>{const{imageId:imageId}=changes,rest=__rest(changes,["imageId"]);Object.assign(this.props.trigger,rest),this.props.fieldUpdated(),this.setState({})}),this.runAsUserChanged=(user=>{this.props.trigger.runAsUser=""!==user?user:null,this.props.fieldUpdated(),this.setState({})})}componentDidMount(){core_1.ServiceAccountReader.getServiceAccounts().then(serviceAccounts=>{this.setState({serviceAccounts:serviceAccounts})})}render(){const{trigger:trigger}=this.props,{fiatEnabled:fiatEnabled,serviceAccounts:serviceAccounts}=this.state;return React.createElement("div",{className:"form-horizontal"},React.createElement(DockerImageAndTagSelector_1.DockerImageAndTagSelector,{specifyTagByRegex:!0,account:trigger.account,organization:trigger.organization,registry:trigger.registry,repository:trigger.repository,tag:trigger.tag,showRegistry:!0,onChange:this.dockerChanged,showDigest:!1}),fiatEnabled&&React.createElement("div",{className:"form-group"},React.createElement(core_1.RunAsUser,{serviceAccounts:serviceAccounts,value:trigger.runAsUser,onChange:this.runAsUserChanged,selectClasses:"",selectColumns:8})))}}},function(module,exports){module.exports=require("rxjs")},function(module,exports){module.exports=require("ngimport")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),ngimport_1=__webpack_require__(16),rxjs_1=__webpack_require__(15),core_1=__webpack_require__(0),image_1=__webpack_require__(9),lookupTypeOptions=[{value:"digest",label:"Digest"},{value:"tag",label:"Tag"}];exports.DockerTriggerTemplate=class extends React.Component{constructor(props){super(props),this.queryStream=new rxjs_1.Subject,this.handleQuery=(()=>{const trigger=this.props.command.trigger;return rxjs_1.Observable.fromPromise(image_1.DockerImageReader.findTags({provider:"dockerRegistry",account:trigger.account,repository:trigger.repository}))}),this.lookupTypeChanged=(o=>{const newType=o.value;this.props.command.extraFields.tag="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.updateDigest=(digest=>{this.updateArtifact(this.props.command,digest),this.setState({digest:digest})}),this.tagLoadSuccess=(tags=>{const{command:command}=this.props,trigger=command.trigger,newState={};if(newState.tags=tags,newState.tags.length){const defaultSelection=newState.tags.find(t=>t===trigger.tag)||newState.tags[0];newState.selectedTag=defaultSelection,this.updateSelectedTag(defaultSelection)}newState.tagsLoading=!1,this.setState(newState)}),this.tagLoadFailure=(()=>{this.setState({tagsLoading:!1,loadError:!0})}),this.initialize=(()=>{const{command:command}=this.props;this.subscription=this.queryStream.debounceTime(250).switchMap(this.handleQuery).subscribe(this.tagLoadSuccess,this.tagLoadFailure),command.extraFields={},"docker"===command.trigger.type?this.searchTags():this.subscription.unsubscribe()}),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 ngimport_1.$q.when(`(Docker Registry) ${trigger.account?trigger.account+":":""} ${trigger.repository||""}`)}updateArtifact(command,tag){command.extraFields.tag=tag;const trigger=command.trigger;if(trigger&&trigger.repository){let imageName="";trigger.registry&&(imageName+=trigger.registry+"/"),imageName+=trigger.repository,command.extraFields.artifacts=[{type:"docker/image",name:imageName,version:tag,reference:imageName+":"+tag}]}}componentWillReceiveProps(nextProps){nextProps.command!==this.props.command&&this.initialize()}componentDidMount(){this.initialize()}render(){const{digest:digest,tags:tags,tagsLoading:tagsLoading,loadError:loadError,selectedTag:selectedTag,lookupType:lookupType}=this.state,options=tags.map(tag=>({value:tag}));return React.createElement(React.Fragment,null,React.createElement("div",{className:"form-group"},React.createElement("div",{className:"sm-label-right col-md-4"},"Type"),React.createElement("div",{className:"col-md-3"},React.createElement(core_1.TetheredSelect,{clearable:!1,value:lookupType,options:lookupTypeOptions,onChange:this.lookupTypeChanged}))),"tag"===lookupType&&React.createElement("div",{className:"form-group"},React.createElement("label",{className:"col-md-4 sm-label-right"},"Tag"),tagsLoading&&React.createElement("div",{className:"col-md-6"},React.createElement("div",{className:"form-control-static text-center"},React.createElement(core_1.Spinner,{size:"small"}))),React.createElement("input",{type:"hidden",required:tagsLoading,value:selectedTag}),loadError&&React.createElement("div",{className:"col-md-6"},"Error loading tags!"),!tagsLoading&&React.createElement("div",{className:"col-md-6"},0===tags.length&&React.createElement("div",null,React.createElement("p",{className:"form-control-static"},"No tags found")),tags.length>0&&React.createElement(core_1.TetheredSelect,{options:options,optionRenderer:o=>React.createElement("span",null,o.value),clearable:!1,value:selectedTag,valueRenderer:o=>React.createElement("span",null,React.createElement("strong",null,o.value)),onChange:o=>this.updateSelectedTag(o.value)}))),"digest"===lookupType&&React.createElement("div",{className:"form-group"},React.createElement("label",{className:"col-md-4 sm-label-right"},"Digest"),React.createElement("div",{className:"col-md-6"},React.createElement("input",{value:digest,onChange:e=>this.updateDigest(e.target.value),className:"form-control input-sm",required:!0}))))}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=__webpack_require__(0),DockerTriggerTemplate_1=__webpack_require__(17),DockerTriggerConfig_1=__webpack_require__(14);core_1.Registry.pipeline.registerTrigger({label:"Docker Registry",description:"Executes the pipeline on an image update",key:"docker",component:DockerTriggerConfig_1.DockerTriggerConfig,manualExecutionComponent:DockerTriggerTemplate_1.DockerTriggerTemplate,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."}]})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const angular_1=__webpack_require__(1);__webpack_require__(18);const templates=__webpack_require__(13);templates.keys().forEach(function(key){templates(key)}),exports.DOCKER_MODULE="spinnaker.docker",angular_1.module(exports.DOCKER_MODULE,[__webpack_require__(12).name])},function(module,exports){module.exports=require("react-select")},function(module,exports,__webpack_require__){"use strict";function __export(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(__webpack_require__(9)),__export(__webpack_require__(19))}])}); | ||
//# sourceMappingURL=lib.js.map |
@@ -46,3 +46,3 @@ "use strict"; | ||
fiatEnabled && (React.createElement("div", { className: "form-group" }, | ||
React.createElement(core_1.RunAsUser, { serviceAccounts: serviceAccounts, value: trigger.runAsUser, onChange: this.runAsUserChanged }))))); | ||
React.createElement(core_1.RunAsUser, { serviceAccounts: serviceAccounts, value: trigger.runAsUser, onChange: this.runAsUserChanged, selectClasses: "", selectColumns: 8 }))))); | ||
} | ||
@@ -49,0 +49,0 @@ } |
@@ -5,5 +5,7 @@ import * as React from 'react'; | ||
export interface IDockerTriggerTemplateState { | ||
digest: string; | ||
tags: string[]; | ||
tagsLoading: boolean; | ||
loadError: boolean; | ||
lookupType: string; | ||
selectedTag: string; | ||
@@ -17,3 +19,6 @@ } | ||
private handleQuery; | ||
private lookupTypeChanged; | ||
private updateArtifact; | ||
private updateSelectedTag; | ||
private updateDigest; | ||
private tagLoadSuccess; | ||
@@ -20,0 +25,0 @@ private tagLoadFailure; |
@@ -7,3 +7,4 @@ "use strict"; | ||
const core_1 = require("@spinnaker/core"); | ||
const DockerImageReader_1 = require("../../image/DockerImageReader"); | ||
const image_1 = require("../../image"); | ||
const lookupTypeOptions = [{ value: 'digest', label: 'Digest' }, { value: 'tag', label: 'Tag' }]; | ||
class DockerTriggerTemplate extends React.Component { | ||
@@ -15,3 +16,3 @@ constructor(props) { | ||
const trigger = this.props.command.trigger; | ||
return rxjs_1.Observable.fromPromise(DockerImageReader_1.DockerImageReader.findTags({ | ||
return rxjs_1.Observable.fromPromise(image_1.DockerImageReader.findTags({ | ||
provider: 'dockerRegistry', | ||
@@ -22,23 +23,15 @@ account: trigger.account, | ||
}; | ||
this.lookupTypeChanged = (o) => { | ||
const newType = o.value; | ||
this.props.command.extraFields.tag = newType === 'tag' ? this.state.selectedTag : this.state.digest; | ||
this.setState({ lookupType: newType }); | ||
}; | ||
this.updateSelectedTag = (tag) => { | ||
const { command } = this.props; | ||
const trigger = command.trigger; | ||
command.extraFields.tag = tag; | ||
if (trigger && trigger.repository) { | ||
let imageName = ''; | ||
if (trigger.registry) { | ||
imageName += trigger.registry + '/'; | ||
} | ||
imageName += trigger.repository; | ||
command.extraFields.artifacts = [ | ||
{ | ||
type: 'docker/image', | ||
name: imageName, | ||
version: tag, | ||
reference: imageName + ':' + tag, | ||
}, | ||
]; | ||
} | ||
this.updateArtifact(this.props.command, tag); | ||
this.setState({ selectedTag: tag }); | ||
}; | ||
this.updateDigest = (digest) => { | ||
this.updateArtifact(this.props.command, digest); | ||
this.setState({ digest }); | ||
}; | ||
this.tagLoadSuccess = (tags) => { | ||
@@ -84,5 +77,7 @@ const { command } = this.props; | ||
this.state = { | ||
digest: '', | ||
tags: [], | ||
tagsLoading: true, | ||
loadError: false, | ||
lookupType: 'tag', | ||
selectedTag: '', | ||
@@ -94,2 +89,21 @@ }; | ||
} | ||
updateArtifact(command, tag) { | ||
command.extraFields.tag = tag; | ||
const trigger = command.trigger; | ||
if (trigger && trigger.repository) { | ||
let imageName = ''; | ||
if (trigger.registry) { | ||
imageName += trigger.registry + '/'; | ||
} | ||
imageName += trigger.repository; | ||
command.extraFields.artifacts = [ | ||
{ | ||
type: 'docker/image', | ||
name: imageName, | ||
version: tag, | ||
reference: imageName + ':' + tag, | ||
}, | ||
]; | ||
} | ||
} | ||
componentWillReceiveProps(nextProps) { | ||
@@ -104,18 +118,27 @@ if (nextProps.command !== this.props.command) { | ||
render() { | ||
const { tags, tagsLoading, loadError, selectedTag } = this.state; | ||
const { digest, tags, tagsLoading, loadError, selectedTag, lookupType } = this.state; | ||
const options = tags.map(tag => { | ||
return { value: tag }; | ||
}); | ||
return (React.createElement("div", { className: "form-group" }, | ||
React.createElement("label", { className: "col-md-4 sm-label-right" }, "Tag"), | ||
tagsLoading && (React.createElement("div", { className: "col-md-6" }, | ||
React.createElement("div", { className: "form-control-static text-center" }, | ||
React.createElement(core_1.Spinner, { size: 'small' })))), | ||
React.createElement("input", { type: "hidden", required: tagsLoading, value: selectedTag }), | ||
loadError && React.createElement("div", { className: "col-md-6" }, "Error loading tags!"), | ||
!tagsLoading && (React.createElement("div", { className: "col-md-6" }, | ||
tags.length === 0 && (React.createElement("div", null, | ||
React.createElement("p", { className: "form-control-static" }, "No tags found"))), | ||
tags.length > 0 && (React.createElement(core_1.TetheredSelect, { options: options, optionRenderer: o => React.createElement("span", null, o.value), clearable: false, value: selectedTag, valueRenderer: o => (React.createElement("span", null, | ||
React.createElement("strong", null, o.value))), onChange: (o) => this.updateSelectedTag(o.value) })))))); | ||
return (React.createElement(React.Fragment, null, | ||
React.createElement("div", { className: "form-group" }, | ||
React.createElement("div", { className: "sm-label-right col-md-4" }, "Type"), | ||
React.createElement("div", { className: "col-md-3" }, | ||
React.createElement(core_1.TetheredSelect, { clearable: false, value: lookupType, options: lookupTypeOptions, onChange: this.lookupTypeChanged }))), | ||
lookupType === 'tag' && (React.createElement("div", { className: "form-group" }, | ||
React.createElement("label", { className: "col-md-4 sm-label-right" }, "Tag"), | ||
tagsLoading && (React.createElement("div", { className: "col-md-6" }, | ||
React.createElement("div", { className: "form-control-static text-center" }, | ||
React.createElement(core_1.Spinner, { size: "small" })))), | ||
React.createElement("input", { type: "hidden", required: tagsLoading, value: selectedTag }), | ||
loadError && React.createElement("div", { className: "col-md-6" }, "Error loading tags!"), | ||
!tagsLoading && (React.createElement("div", { className: "col-md-6" }, | ||
tags.length === 0 && (React.createElement("div", null, | ||
React.createElement("p", { className: "form-control-static" }, "No tags found"))), | ||
tags.length > 0 && (React.createElement(core_1.TetheredSelect, { options: options, optionRenderer: o => React.createElement("span", null, o.value), clearable: false, value: selectedTag, valueRenderer: o => (React.createElement("span", null, | ||
React.createElement("strong", null, o.value))), onChange: (o) => this.updateSelectedTag(o.value) })))))), | ||
lookupType === 'digest' && (React.createElement("div", { className: "form-group" }, | ||
React.createElement("label", { className: "col-md-4 sm-label-right" }, "Digest"), | ||
React.createElement("div", { className: "col-md-6" }, | ||
React.createElement("input", { value: digest, onChange: e => this.updateDigest(e.target.value), className: "form-control input-sm", required: true })))))); | ||
} | ||
@@ -122,0 +145,0 @@ } |
{ | ||
"name": "@spinnaker/docker", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"main": "lib/lib.js", | ||
@@ -5,0 +5,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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1975
344935
56