summaryrefslogtreecommitdiff
path: root/boruta.go
AgeCommit message (Collapse)AuthorFilesLines
2018-10-04Fix workers state changing behaviourLukasz Wojciechowski1-0/+4
Changing state to IDLE (with key generation) or to MAINTENANCE is a time consuming operation. That's why new workers' states are introduced: * PREPARE - when entering IDLE; * BUSY - when entering MAINTENANCE. Without them, state of workers can be changed during these long operations as another method call can change the worker state or initiate another long operations breaking actual state of workers. To fix this issue not only new states are introduced, but also an additional goroutine for every registered worker is started. The goroutine is responsible for running long operations in background. It is controlled with a channel through which new worker state is sent every time setState is called. The goroutine breaks execution of current long operation if new state is set for worker. As new states appear some changes in workers' methods behaviour needs to be changed: * SetFail returns ErrInMaintenance also for BUSY state (formerly for MAINTENANCE only). * SetState ignores attempts to set MAINTENANCE when worker is BUSY and to set IDLE when worker is in PREPARE because requested state changes are already in progress. * PrepareWorker is allowed to be run only for workers in RUN state. This method is used in two cases: when Job is finished or when matching of reserved worker and request fails to create the Job. In both cases worker should be bring to IDLE state only if if it was in RUN state. If it was in MAINTENANCE or FAILED it should be kept that way. * OnWorkerFail is sent when worker's Job was interrupted (if it was in RUN state, and enters any other than IDLE or PREPARE states). Naming of methods parameters has been unified. All methods running for a boruta.WorkerUUID use uuid variable and a worker variable is used for mapWorker structure. Change-Id: I8d1d8b55e48e432746ebf819650a77698b8c27ab Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-10-04Add tests for rpc/dryad packageLukasz Wojciechowski1-0/+1
Tests of rpc/dryad package verify both service and client sides of RPC communication connected together. On service side instead of true operations on Dryad mockup is used. The mockup of Dryad interface is generated by go:generate mechanism embedded in boruta.go file and is stored in mocks/mock_dryad.go file. Change-Id: Id7ceaab9a70cc1404b1df9a66978ba0eb551f8bb Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-08-09Change rsa.PublicKey to ssh.PublicKey in Dryad PrepareMaciej Wereski1-2/+4
Users will use SSH keys rather than plain RSA keys, so Dryad interface should accept SSH public key instead of generating it from RSA public key. Change-Id: I6e757199a7e8a0d3258c1c17ac0eee8412f2b415 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-08-03Install public key on dryadAleksander Mistewicz1-1/+1
This patch changes interface and communication between boruta server and dryads. Key is generated on boruta server, public part is installed on dryad and private part is stored internally. It is a preparation for using user's public keys provided by an external service. Change-Id: Ic6fb087aba02553c6b2b8f7cc13cc6bd67eff36a Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
2018-08-03Add dryadAddress and sshAddress to RegisterAleksander Mistewicz1-1/+3
When running multiple dryads on a single host or behind NAT, they must listen on different ports and inform boruta about this fact. Change-Id: I35e084b8ee2e2177d36055f7dedacb53ac74bbf0 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
2018-07-11Make ReqID and Priority types implement StringeruidockerMaciej Wereski1-0/+13
Change-Id: I3b8e271e38f8b13fa43ded590e1f31c09922bf5d Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-06-05HTTP API: Add Superviser API skeletonMaciej Wereski1-1/+1
Currently only Requests and handlers of 2 Workers functions were present, although HTTP API should cover full Workers API. Tests will use mocked Workers and Superviser interfaces, so generation line was added to boruta.go. Change-Id: Id6d82a8c6e61121a2e75d5c90445edf35b2268a5 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-06-05Add HTTP API packageMaciej Wereski1-0/+3
HTTP API package will provide all HTTP API which will be exposed to the Boruta clients. Only User API counterpart of Boruta is added for now. Currently the package provides only one function, which takes pointer to httprouter.Router and registers all paths and HTTP methods in it. HTTP API module will have a lot of test cases agregated in test tables. To improve test cases development time and readability of test files, flag '-update' is added to test. It will run tests and for all testcases a file with results will be generated in 'testdata' subdirectory. During testing (running without '-update' flag) those files are read and compared with results of tested functions. Generating testcase files: $ go test git.tizen.org/tools/boruta/server/api/v1 -update Testing (as usual): $ go test git.tizen.org/tools/boruta/server/api/v1 After updating testcase files output must be inspected by developer before commiting to the repository (and should be also checked by reviewers before merging). Change-Id: I6d98f093cce116512dc305e07a8614990580faff Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-04-27Add fields to AccessInfo structLukasz Wojciechowski1-1/+10
Added fields define required connection data for the request owner who want to connect to the Dryad running job. Change-Id: I372abac096d5b1cacc2744cbbbce2d1b0740cf81 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-04-27Add Groups to UserInfoLukasz Wojciechowski1-1/+4
Change-Id: Ie8369804df2eb6fa79bffe1895b6737c14ad74d1 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-03-05Add Caps method to get UUID valueAleksander Mistewicz1-0/+7
Change-Id: I3c5ee9a4a3a399648328be6f2e03fab7eb7d56b0 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49608 Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-03-05Make Superviser suitable for go-rpcgenAleksander Mistewicz1-2/+2
Change-Id: Ieebd76be2278f076d9b20d13f9d6067209926cb7 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49763 Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-03-05Make Dryad suitable for go-rpcgenAleksander Mistewicz1-4/+4
Change-Id: If978d57f924ef730712c5533512ce5792feebca5 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49761 Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
2017-10-12Change Set methods in Requests interfaceMaciej Wereski1-8/+5
One UpdateRequest() public method is introduced instead of three Set methods. Also Priority values are shifted by one. This will be required to check if user has set Priority field (which takes zero value when it wasn't set). Change-Id: I2be2573edb93cb4a70f7f155786e6a18ba520270 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49545 Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Tested-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
2017-10-12Initial Request Queue implementationMaciej Wereski1-0/+7
Package requests provides Requests and ListFilter interfaces implementation. Users of this package can create new Boruta requests, list them (with filter), get detail information about them or modify it. What still needs to be done is interaction with worker mostly. This needs working implementations of Workers interface and appropriate matcher. Change-Id: Ia4458f1959f7e52fdbe1df5f89c86785f5db3e70 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49522 Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Tested-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2017-10-10Remove unused interfaceMaciej Wereski1-8/+0
Change-Id: I51f7072d1f5ab52ffb1635df65ca6a754c01db46 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49577 Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2017-10-10Make uint types have explicit sizesMaciej Wereski1-2/+2
Change-Id: Ibed42f8862c3f21a8a29c477427950b879fabdc1 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49556 Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2017-10-09Remove AccessInfo from WorkerInfoAleksander Mistewicz1-1/+0
AccessInfo is associated with JobInfo and it is temporary information. Before this change a simple ListWorkers would disclose data which should be secured (private keys and addresses of a tunnels). Change-Id: I14404d452c85e300f5e261b0a9e6d4144fbcf03a Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49553 Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> Reviewed-by: Pawel Wieczorek <p.wieczorek2@samsung.com> Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
2017-10-05Make ListFilter an interfaceMaciej Wereski1-1/+4
Currently ListFilter is defined as a structure. We don't know how such structure should look like. Moreover it will be probably changed to match new uses. We're not interested in the data provided, but what functionality it provides. Thus change it to simple interface. Change-Id: Ib297345d2f188fc941cf04794f03ec5250501474 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49471
2017-10-05Fix types of request statesMaciej Wereski1-6/+6
Change-Id: Ic8fa0bbe2f19d08deaf05a8f2e974fc45f368f6d Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49470
2017-09-20Fix type of WorkerState constantsAleksander Mistewicz1-3/+3
For unknown reason only the first value defined in the const block had type WorkerState, all subsequent definitions had type string. Change-Id: I1320a8a94525f08f37e14b79188bcfdac0048b0e Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49430 Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
2017-09-13Add Dryad interfaceAleksander Mistewicz1-0/+15
User, Admin and Worker communication to Boruta was designed, but an interface in opposite direction, from Server to Worker, was missing. Change-Id: I915c31e12b0b49d6863d1162734db7a324d709d1 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49405 Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
2017-09-13Rework interfaces definitionsMaciej Wereski1-14/+18
Current methods division between interfaces is done in a way that causes situation where no package implements full interface. This change fixes this situation. Change-Id: Ifcfba7d740c86e853410b71da954810ceaf813f3 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49448 Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Tested-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
2017-08-18Base state types on string instead of byteMaciej Wereski1-13/+13
States may be frequently used in errors or other information messages. Make them based on strings, so there's no need to implement String() methods. Change-Id: I1c4e0f0221b0e6ee9669cda9736fd3e7beceac51 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49391 Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
2017-07-14Add UserInfo argument to NewRequestMaciej Wereski1-1/+2
Change-Id: I8a47938f22e836a1b07af2f07811af8d4942f911 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49200 Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
2017-06-09Add missing license headerMaciej Wereski1-0/+16
Change-Id: I279647811b0a0399285441c46312e80e24747fc6 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49053 Reviewed-by: Pawel Wieczorek <p.wieczorek2@samsung.com> Tested-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2017-06-07Add basic structures of the borutaAleksander Mistewicz1-0/+168
Change-Id: I56ba1e2898e7b90029cbdefdd2b29f4d73b40372 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/48999 Reviewed-by: Pawel Wieczorek <p.wieczorek2@samsung.com> Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>