Always allow robot accounts to be selected by admins in trigger setup
Currently during trigger setup, if we don't know for sure that a robot account is necessary, we don't show the option to select one. This fails if the user has a Dockerfile in a branch or tag with a private base image *or* they *intend* to add a private base image once the trigger is setup. Following this change, we always show the option to select a robot account, even if it isn't determined to be strictly necessary.
This commit is contained in:
		
							parent
							
								
									f08e4921f2
								
							
						
					
					
						commit
						8bbe0e5e9b
					
				
					 3 changed files with 122 additions and 116 deletions
				
			
		|  | @ -272,10 +272,10 @@ | |||
|       </div> | ||||
|     </linear-workflow-section><!-- /Section: Dockerfile Location --> | ||||
| 
 | ||||
|     <!-- Section: Verification and Robot Account --> | ||||
|     <!-- Section: Robot Account --> | ||||
|     <linear-workflow-section class="row" | ||||
|       section-id="verification" | ||||
|       section-title="Confirm" | ||||
|       section-title="Robot Account" | ||||
|       section-valid="$ctrl.local.triggerAnalysis.status != 'error' && ($ctrl.local.triggerAnalysis.status != 'requiresrobot' || $ctrl.local.robotAccount != null)"> | ||||
|       <!-- Error --> | ||||
|       <div class="col-lg-7 col-md-7 col-sm-12 main-col" | ||||
|  | @ -289,88 +289,87 @@ | |||
|         {{ $ctrl.local.triggerAnalysis.message }} | ||||
|       </div> | ||||
| 
 | ||||
|       <!-- Warning --> | ||||
|       <!-- Robot display for non-error cases --> | ||||
|       <div class="col-lg-7 col-md-7 col-sm-12 main-col" | ||||
|            ng-if="$ctrl.local.triggerAnalysis.status == 'warning'"> | ||||
|         <h3 class="warning"><i class="fa fa-exclamation-triangle"></i> Verification Warning</h3> | ||||
|         {{ $ctrl.local.triggerAnalysis.message }} | ||||
|       </div> | ||||
|            ng-if="$ctrl.local.triggerAnalysis.status != 'error'"> | ||||
|         <!-- Warning --> | ||||
|         <div ng-if="$ctrl.local.triggerAnalysis.status == 'warning'"> | ||||
|           <h3 class="warning"><i class="fa fa-exclamation-triangle"></i> Verification Warning</h3> | ||||
|           {{ $ctrl.local.triggerAnalysis.message }} | ||||
|         </div> | ||||
| 
 | ||||
|       <!-- Public base --> | ||||
|       <div class="col-lg-7 col-md-7 col-sm-12 main-col" | ||||
|            ng-if="$ctrl.local.triggerAnalysis.status == 'publicbase'"> | ||||
|         <h3 class="success"><i class="fa fa-check-circle"></i> Ready to go!</h3> | ||||
|         <strong>Click "Create Trigger" to complete setup of this build trigger</strong> | ||||
|       </div> | ||||
|         <!-- Public base --> | ||||
|         <div ng-if="$ctrl.local.triggerAnalysis.status == 'publicbase'"> | ||||
|           <h3 class="success"><i class="fa fa-check-circle"></i> Ready to go!</h3> | ||||
|           <strong> | ||||
|             <span ng-if="$ctrl.local.triggerAnalysis.is_admin">Choose an optional robot account below or click "Continue" to complete setup of this build trigger</span> | ||||
|             <span ng-if="!$ctrl.local.triggerAnalysis.is_admin">Click "Continue" to complete setup of this build trigger</span> | ||||
|           </strong> | ||||
|         </div> | ||||
| 
 | ||||
|       <!-- Requires robot and is not admin --> | ||||
|       <div class="col-lg-7 col-md-7 col-sm-12 main-col" | ||||
|            ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && !$ctrl.local.triggerAnalysis.is_admin"> | ||||
|         <h3>Robot Account Required</h3> | ||||
|         <p>The selected Dockerfile in the selected repository depends upon a private base image</p> | ||||
|         <p>A robot account with access to the base image is required to setup this trigger, but you are not the administrator of this namespace.</p> | ||||
|         <p>Administrative access is required to continue to ensure security of the robot credentials.</p> | ||||
|       </div> | ||||
|         <!-- Requires robot and is not admin --> | ||||
|         <div ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && !$ctrl.local.triggerAnalysis.is_admin"> | ||||
|           <h3>Robot Account Required</h3> | ||||
|           <p>The selected Dockerfile in the selected repository depends upon a private base image</p> | ||||
|           <p>A robot account with access to the base image is required to setup this trigger, but you are not the administrator of this namespace.</p> | ||||
|           <p>Administrative access is required to continue to ensure security of the robot credentials.</p> | ||||
|         </div> | ||||
| 
 | ||||
|       <!-- Requires robot and is admin --> | ||||
|       <div class="col-lg-7 col-md-7 col-sm-12 main-col" | ||||
|            ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && $ctrl.local.triggerAnalysis.is_admin"> | ||||
|         <h3>Select Robot Account</h3> | ||||
|         <strong> | ||||
|           The selected Dockerfile in the selected repository depends upon a private base image. Select a robot account with access: | ||||
|         </strong> | ||||
| 
 | ||||
|         <div class="co-top-bar"> | ||||
|           <div class="co-filter-box"> | ||||
|             <span class="page-controls" | ||||
|                   total-count="$ctrl.local.orderedRobotAccounts.entries.length" | ||||
|                   current-page="$ctrl.local.robotOptions.page" | ||||
|                   page-size="$ctrl.robotsPerPage"></span> | ||||
|             <input class="form-control" type="text" ng-model="$ctrl.local.robotOptions.filter" placeholder="Filter robot accounts..."> | ||||
|         <!-- Robots view --> | ||||
|         <div ng-if="$ctrl.local.triggerAnalysis.is_admin"> | ||||
|           <div class="co-top-bar"> | ||||
|             <div class="co-filter-box"> | ||||
|               <span class="page-controls" | ||||
|                     total-count="$ctrl.local.orderedRobotAccounts.entries.length" | ||||
|                     current-page="$ctrl.local.robotOptions.page" | ||||
|                     page-size="$ctrl.robotsPerPage"></span> | ||||
|               <input class="form-control" type="text" ng-model="$ctrl.local.robotOptions.filter" placeholder="Filter robot accounts..."> | ||||
|             </div> | ||||
|           </div> | ||||
|         </div> | ||||
| 
 | ||||
|         <table class="co-table" style="margin-top: 20px;"> | ||||
|           <thead> | ||||
|           <td class="checkbox-col"></td> | ||||
|           <td ng-class="$ctrl.TableService.tablePredicateClass('name', $ctrl.local.robotOptions.predicate, $ctrl.local.robotOptions.reverse)"> | ||||
|             <a ng-click="$ctrl.TableService.orderBy('name', $ctrl.local.robotOptions)">Robot Account</a> | ||||
|           </td> | ||||
|           <td ng-class="$ctrl.TableService.tablePredicateClass('can_read', $ctrl.local.robotOptions.predicate, $ctrl.local.robotOptions.reverse)"> | ||||
|             <a ng-click="$ctrl.TableService.orderBy('can_read', $ctrl.local.robotOptions)">Has Read Access</a> | ||||
|           </td> | ||||
|           </thead> | ||||
|           <table class="co-table" style="margin-top: 20px;"> | ||||
|             <thead> | ||||
|             <td class="checkbox-col"></td> | ||||
|             <td ng-class="$ctrl.TableService.tablePredicateClass('name', $ctrl.local.robotOptions.predicate, $ctrl.local.robotOptions.reverse)"> | ||||
|               <a ng-click="$ctrl.TableService.orderBy('name', $ctrl.local.robotOptions)">Robot Account</a> | ||||
|             </td> | ||||
|             <td ng-class="$ctrl.TableService.tablePredicateClass('can_read', $ctrl.local.robotOptions.predicate, $ctrl.local.robotOptions.reverse)" | ||||
|                 ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot'"> | ||||
|               <a ng-click="$ctrl.TableService.orderBy('can_read', $ctrl.local.robotOptions)">Has Read Access</a> | ||||
|             </td> | ||||
|             </thead> | ||||
| 
 | ||||
|           <tr class="co-checkable-row" | ||||
|               ng-repeat="robot in $ctrl.local.orderedRobotAccounts.visibleEntries | slice:($ctrl.robotsPerPage * $ctrl.local.namespaceOptions.page):($ctrl.robotsPerPage * ($ctrl.local.robotOptions.page + 1))" | ||||
|               ng-class="$ctrl.local.robotAccount == robot ? 'checked' : ''" | ||||
|               bindonce> | ||||
|             <td> | ||||
|               <input type="radio" | ||||
|                      ng-model="$ctrl.local.robotAccount" | ||||
|                      ng-value="robot"> | ||||
|             </td> | ||||
|             <td> | ||||
|               <span class="entity-reference" entity="robot"></span> | ||||
|             </td> | ||||
|             <td> | ||||
|               <span ng-if="robot.can_read" class="success">Can Read</span> | ||||
|               <span ng-if="!robot.can_read">Read access will be added if selected</span> | ||||
|             </td> | ||||
|           </tr> | ||||
|         </table> | ||||
|         <div class="empty" style="margin-top: 20px;" | ||||
|              ng-if="$ctrl.local.triggerAnalysis.robots.length && !$ctrl.local.orderedRobotAccounts.entries.length"> | ||||
|           <div class="empty-primary-msg">No matching robot accounts found.</div> | ||||
|           <div class="empty-secondary-msg">Try expanding your filtering terms.</div> | ||||
|         </div> | ||||
|             <tr class="co-checkable-row" | ||||
|                 ng-repeat="robot in $ctrl.local.orderedRobotAccounts.visibleEntries | slice:($ctrl.robotsPerPage * $ctrl.local.namespaceOptions.page):($ctrl.robotsPerPage * ($ctrl.local.robotOptions.page + 1))" | ||||
|                 ng-class="$ctrl.local.robotAccount == robot ? 'checked' : ''" | ||||
|                 bindonce> | ||||
|               <td> | ||||
|                 <input type="radio" | ||||
|                        ng-model="$ctrl.local.robotAccount" | ||||
|                        ng-value="robot"> | ||||
|               </td> | ||||
|               <td> | ||||
|                 <span class="entity-reference" entity="robot"></span> | ||||
|               </td> | ||||
|               <td ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot'"> | ||||
|                 <span ng-if="robot.can_read" class="success">Can Read</span> | ||||
|                 <span ng-if="!robot.can_read">Read access will be added if selected</span> | ||||
|               </td> | ||||
|             </tr> | ||||
|           </table> | ||||
|           <div class="empty" style="margin-top: 20px;" | ||||
|                ng-if="$ctrl.local.triggerAnalysis.robots.length && !$ctrl.local.orderedRobotAccounts.entries.length"> | ||||
|             <div class="empty-primary-msg">No matching robot accounts found.</div> | ||||
|             <div class="empty-secondary-msg">Try expanding your filtering terms.</div> | ||||
|           </div> | ||||
|         </div> <!-- /Robots view --> | ||||
|       </div> | ||||
| 
 | ||||
|       <div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col" | ||||
|            ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && $ctrl.local.triggerAnalysis.is_admin"> | ||||
|         <p>The Dockerfile you selected utilizes a private base image.</p> | ||||
|         <p>In order for the <span class="registry-name"></span> to pull the base image during the build process, a robot account with access must be selected.</p> | ||||
|         <p>Robot accounts that already have access to this base image are listed first. If you select a robot account that does not currently have access, read permission will be granted to that robot account on trigger creation.</p> | ||||
|            ng-if="$ctrl.local.triggerAnalysis.is_admin"> | ||||
|         <p>In order for the <span class="registry-name"></span> to pull a <b>private base image</b> during the build process, a robot account with access must be selected.</p> | ||||
|         <p ng-if="$ctrl.local.triggerAnalysis.status != 'requiresrobot'">If you know that a private base image is not used, you can skip this step.</p> | ||||
|         <p ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot'">Robot accounts that already have access to this base image are listed first. If you select a robot account that does not currently have access, read permission will be granted to that robot account on trigger creation.</p> | ||||
|       </div> | ||||
|     </linear-workflow-section><!-- /Section: Robot Account --> | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue