attempt to support private registries
This commit is contained in:
		@ -21,6 +21,8 @@ This is meant to be used as a [Drone plugin](http://plugins.drone.io/).
 | 
			
		||||
- **user** (default: `drone`): System user to connect via SSH with
 | 
			
		||||
- **networks** (default:): Try and auto-create these networks first
 | 
			
		||||
- **rm**: (default: `false`): Remove the stack before deploying it
 | 
			
		||||
- **reg_user**: Registry user if publishing from a private repository
 | 
			
		||||
- **reg_pass**: Registry password if publishing from a private repository
 | 
			
		||||
 | 
			
		||||
### Dangerous options, unwise outside CI
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -63,7 +63,14 @@ output_versions(){
 | 
			
		||||
 | 
			
		||||
run_stack_deploy() {
 | 
			
		||||
  echo "--- start deploy ---"
 | 
			
		||||
  docker -H "$REMOTE_DOCKER_HOST" stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"
 | 
			
		||||
 | 
			
		||||
  if [[ -z "${PLUGIN_REG_USER}" ]] && [[ -z "${PLUGIN_REG_PASS}" ]]; then
 | 
			
		||||
    echo "--- discovered secrets, assuming private registry, logging in ---"
 | 
			
		||||
    docker login -u "${PLUGIN_REG_USER}" -p "${PLUGIN_REG_PASS}"
 | 
			
		||||
    docker -H "$REMOTE_DOCKER_HOST" stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"
 | 
			
		||||
  else
 | 
			
		||||
    docker -H "$REMOTE_DOCKER_HOST" stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"
 | 
			
		||||
  fi
 | 
			
		||||
  echo "--- end deploy ---"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user