Commit Graph

133 Commits

Author SHA1 Message Date
Wenkai Yin
5388eb4db6 Read ssl mode param from the adminserver to init the connection with database (#6504)
This commit adds the ssl mode as a param when establishing the connection with database

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2018-12-11 13:58:37 +08:00
peimingming
585d7b2b01 Add unit test for JobService Logger
Signed-off-by: peimingming <peimingming@corp.netease.com>
2018-12-03 16:20:03 +08:00
Steven Zou
84d864607c Add UT cases for new added code
Signed-off-by: Steven Zou <szou@vmware.com>
2018-11-30 16:08:15 +08:00
Steven Zou
ccd486a0ad Support unique job constraints (both unique queue and running jobs)
Signed-off-by: Steven Zou <szou@vmware.com>
2018-11-30 14:14:21 +08:00
peimingming
238dbc0347 Add UT and review comments and issue fix (#6144)
Signed-off-by: peimingming <peimingming@corp.netease.com>
2018-11-28 17:43:14 +08:00
peimingming
c67fdc40f5 Support store job log in DB (#6144)
Signed-off-by: peimingming <peimingming@corp.netease.com>
2018-11-28 15:09:29 +08:00
Steven Zou
01bb7f4abb Uncomment the harbor configuration injection code block
Signed-off-by: Steven Zou <szou@vmware.com>
2018-11-09 10:19:14 +08:00
Steven Zou
8f0e8d083a Fix typo in the README doc of jobservice
Signed-off-by: Steven Zou <szou@vmware.com>
2018-11-08 18:24:41 +08:00
Steven Zou
093bf9fc8a Update the job service config yaml in the installation template
Signed-off-by: Steven Zou <szou@vmware.com>
2018-11-08 10:40:39 +08:00
Steven Zou
e6d4c024ee Update README of job service to reflect latest updates
Signed-off-by: Steven Zou <szou@vmware.com>
2018-11-08 10:35:12 +08:00
Steven Zou
e9194ca107 Add/update unit test cases for the new implemented job logger framework
Signed-off-by: Steven Zou <szou@vmware.com>
2018-11-06 14:43:06 +08:00
Steven Zou
7b106d06c5 Build logger framework to support configurable loggers/sweepers/getters
Signed-off-by: Steven Zou <szou@vmware.com>
2018-11-06 09:31:31 +08:00
Steven Zou
300977d539 Use separate redis conn for the lock mechanism in the periodic enqueuer
Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-31 15:19:11 +08:00
Steven Zou
58eefb9c17 Add TestOnBorrow check func of redis pool to verify the getting conn
Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-31 13:30:29 +08:00
Steven Zou
b48748492e Fix the issue of stopping periodic job (#6174)
Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-31 11:43:46 +08:00
Steven Zou
8341aa14b0 Support health check free call in job service
Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-30 17:35:07 +08:00
Wenkai Yin
af17c2c3fd
Merge pull request #6154 from wy65701436/fix-gc-redis
Fix gc jobs issues
2018-10-29 16:29:57 +08:00
Steven Zou
dde6c39e80
Merge pull request #6169 from steven-zou/fix_issue_of_periodic_conflicts
Return 409 conflict error in liue of 200 with ID of existing one
2018-10-29 16:18:40 +08:00
Steven Zou
408b751ae6 Return 409 conflict error in liue of 200 with ID of existing one when submmiting periodic job
Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-29 15:40:31 +08:00
wang yan
903d3906ab Fix per comments by wk
Signed-off-by: wang yan <wangyan@vmware.com>
2018-10-29 15:29:14 +08:00
Steven Zou
d32e51052e Fix the issue of duplicated periodic job scheduling
Signed-off-by: Steven Zou <szou@vmware.com>

Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-29 14:52:45 +08:00
wang yan
566169f59a Fix gc jobs issues.
This commit is to fix two problems in the gc job,
1, in order to support redis cluseter, gc job should delete the keys only
for docker reigstry instead of all keys. It because that in the redis cluster,
only db 0 is supported.
2, to restore the real status of read only not just to set it to false.

Signed-off-by: wang yan <wangyan@vmware.com>
2018-10-26 18:37:20 +08:00
Steven Zou
a2f0da0d7d Fix the web hook mising issue for the periodic job executions
Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-26 14:28:04 +08:00
Steven Zou
0c901a475f
Merge pull request #6074 from goharbor/enhance_job_service
Enhance job service to support multiple executions recording
2018-10-23 09:50:05 +08:00
Steven Zou
7ca2e9df81 Enhance job service to support multiple executions rectording
- print more logs
- add execution records for periodic job
- add launch job func in job context to launch sub job
- replace copyright header with new version

Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-19 11:02:09 +08:00
stonezdj
79bac7a64e Change admin server to core in jobservice
Signed-off-by: stonezdj <stonezdj@gmail.com>
2018-10-15 14:56:18 +08:00
Steven Zou
326e0d455a Log error if failed to create logger for job
Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-11 16:29:00 +08:00
Wenkai Yin
b4a9eae8cc
Merge pull request #6009 from reasonerjt/fix-insecure-transport
Use secure transport to access HTTP endpoint
2018-10-11 10:23:12 +08:00
Steven Zou
95d48436b8 Add README doc for job service (#6010)
Signed-off-by: Steven Zou <szou@vmware.com>
2018-10-10 19:08:20 +08:00
Daniel Jiang
1188bd89b9 Use secure transport to access HTTP endpoint
In various parts of the code, we used insecure transport in http Client
when we assume the endpoint is http.  This causes complaints form
security scanner.  We should use secure transport in such cases.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2018-10-10 17:51:02 +08:00
Daniel Jiang
0699980924 Add Scan All job to job service (#5934)
This commit adds the job to scan all images on registry.
It also makes necessary change to Secret based security context, to
job service has higher permission to call the API of core service.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2018-09-22 13:07:32 +08:00
clouderati
587459df15 Replacing copyright notices with "Copyright Project Harbor Authors".
Signed-off-by: clouderati <35942204+clouderati@users.noreply.github.com>
2018-09-19 16:59:36 +00:00
Qian Deng
7873a0312a Rename harbor-ui to harbor-core
1. Update the nginx.conf
2. Update Makefile
3. Update docker-compose
4. Update image name
5. Rename folder ui to core
6. Change the harbor-ui's package name to core
7. Remove unused static file on harbor-core
8. Remove unused code for harbor-portal

Signed-off-by: Qian Deng <dengq@vmware.com>
2018-09-19 16:35:13 +08:00
陈德
0582db9a82 Apply consistent format for comments
Signed-off-by: 陈德 <chende@caicloud.io>
2018-09-05 16:16:31 +08:00
Steven Zou
1636b138f2 Return more data of the job when reporting status info via webhook
- update the status report func `RedisJobStatsManager.reportStatus`
- update the UT case for the above change

Signed-off-by: Steven Zou <szou@vmware.com>
2018-08-30 14:28:12 +08:00
wang yan
aab761ac8a Fix gofmt check results
Signed-off-by: wang yan <wangyan@vmware.com>
2018-08-29 11:50:00 +08:00
Yan
fca2bb3a6b
Fix misspell checking results (#5749)
Signed-off-by: wang yan <wangyan@vmware.com>
2018-08-29 10:25:42 +08:00
Daniel Jiang
dcf4e2ee78 Update import path in go code
vmware -> goharbor

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2018-08-23 17:50:53 +08:00
Daniel Jiang
65cf02a1d7 Validate job ID when getting job log
Add validation to job ID in the API to get job log in job service, to
prevent file path traversal attack.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2018-08-15 15:33:13 +08:00
wangyan
29d0d51403 Signed-off-by: wangyan <wangyan@vmware.com>
Add clean registry cache to gc job

To workaround the issue: https://github.com/docker/distribution/issues/2094
GC needs to clean cache before to call the docker reigstry api to delete blobs.
Otherwise, the following docker push will not be performed as docker registry
does not clean cache in GC, it thinks the image is still there, and the new
blobs will be uploaded.
2018-08-13 02:58:27 -07:00
wangyan
9a95f14918 Cherry-pick -- Fix security issue found by gas 2018-08-03 01:16:53 -07:00
Wenkai Yin
2a40068d75 Fix cross slot issue of redis
This commit upgrdes the github.com/gocraft/work package to 0.5.1 and updates the namespace value
to fix the redis cross slot issue mentioned in #4633
2018-07-27 14:23:39 +08:00
Yan
efdb57548f
add admin job api (#5344)
It supports Harbor admin to trigger job either manual or
schedule. The job will be populated to job service to execute. 
The api includes:
1. POST /api/system/gc
2, GET /api/system/gc/:id 
3, GET /api/system/gc/:id/log
4, PUT/GET/POST /api/system/gc/schedule
2018-07-20 19:22:37 +08:00
Yan
9e65499c10
Add garbage collection job implemention, this job could (#5268)
be triggered by manual and schedule. It calls registrtctl
to do the GC job, and log the output.
2018-07-16 18:08:40 +08:00
Steven Zou
4db708096b Add retry for getting configs from admin server when doing job conetxt initialization 2018-05-10 15:26:59 +08:00
Steven Zou
f7bc467c99 Return none zero code when job service exit with error
replace fmt.Println/logger.Errorf with logger.Fatal(f)
2018-05-10 14:44:04 +08:00
Yan
ae257433cc
Fully migrate harbor db to postgresql (#4689)
* Merge harbor db to postgres
2018-04-27 02:27:12 -07:00
Steven Zou
e1b509e3f3 Fix the issue of intermittent restarting of job service
github issue: #4712
ping redis server before pool starting

Let worker pool to restart the message server if message server exits with error (controlled by max retries)
2018-04-25 17:02:16 +08:00
Steven Zou
a17436962f Return the logger.Interface instead of the pointer of logger to avoid nil checking issue 2018-04-20 14:59:28 +08:00
Steven Zou
ca8d3bdcc9
Merge pull request #4638 from vmware/use_redis_url_addr
Use redis URL address to replace host:port when connecting to redis server
2018-04-17 10:12:51 +08:00