diff --git a/api/v2.0/swagger.yaml b/api/v2.0/swagger.yaml index 91eb65d02..d0293ed76 100644 --- a/api/v2.0/swagger.yaml +++ b/api/v2.0/swagger.yaml @@ -4714,6 +4714,39 @@ paths: $ref: '#/responses/404' '500': $ref: '#/responses/500' + /jobservice/jobs/{job_id}/log: + get: + operationId: actionGetJobLog + summary: Get job log by job id + description: Get job log by job id, it is only used by administrator + produces: + - text/plain + tags: + - jobservice + parameters: + - $ref: '#/parameters/requestId' + - name: job_id + in: path + required: true + type: string + description: The id of the job. + responses: + '200': + description: Get job log successfully. + headers: + Content-Type: + description: The content type of response body + type: string + schema: + type: string + '401': + $ref: '#/responses/401' + '403': + $ref: '#/responses/403' + '404': + $ref: '#/responses/404' + '500': + $ref: '#/responses/500' /jobservice/queues: get: operationId: listJobQueues diff --git a/make/photon/prepare/templates/jobservice/config.yml.jinja b/make/photon/prepare/templates/jobservice/config.yml.jinja index e41846519..7da2c6f83 100644 --- a/make/photon/prepare/templates/jobservice/config.yml.jinja +++ b/make/photon/prepare/templates/jobservice/config.yml.jinja @@ -51,3 +51,6 @@ metric: path: {{ metric.path }} port: {{ metric.port }} {% endif %} + +# the max size of job log returned by API, default is 10M +max_retrieve_size_mb: 10 \ No newline at end of file diff --git a/src/controller/jobmonitor/monitor.go b/src/controller/jobmonitor/monitor.go index 49fd9e0eb..c25f34b29 100644 --- a/src/controller/jobmonitor/monitor.go +++ b/src/controller/jobmonitor/monitor.go @@ -70,6 +70,7 @@ type MonitorController interface { PauseJobQueues(ctx context.Context, jobType string) error // ResumeJobQueues resume the job queue by type ResumeJobQueues(ctx context.Context, jobType string) error + GetJobLog(ctx context.Context, jobID string) ([]byte, error) } type monitorController struct { @@ -366,3 +367,7 @@ func (w *monitorController) resumeQueue(ctx context.Context, jobType string) err } return nil } + +func (w *monitorController) GetJobLog(ctx context.Context, jobID string) ([]byte, error) { + return w.taskManager.GetLogByJobID(ctx, jobID) +} diff --git a/src/jobservice/config/config.go b/src/jobservice/config/config.go index 838454d3e..7fc7f29fe 100644 --- a/src/jobservice/config/config.go +++ b/src/jobservice/config/config.go @@ -23,7 +23,7 @@ import ( "strconv" "strings" - yaml "gopkg.in/yaml.v2" + "gopkg.in/yaml.v2" "github.com/goharbor/harbor/src/jobservice/common/utils" "github.com/goharbor/harbor/src/lib/log" @@ -82,6 +82,9 @@ type Configuration struct { // Metric configurations Metric *MetricConfig `yaml:"metric,omitempty"` + + // MaxLogSizeReturnedMB is the max size of log returned by job log API + MaxLogSizeReturnedMB int `yaml:"max_retrieve_size_mb,omitempty"` } // HTTPSConfig keeps additional configurations when using https protocol diff --git a/src/jobservice/config/config_test.go b/src/jobservice/config/config_test.go index 158a0aa75..df9b41bd3 100644 --- a/src/jobservice/config/config_test.go +++ b/src/jobservice/config/config_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -86,6 +86,7 @@ func (suite *ConfigurationTestSuite) TestDefaultConfig() { err := DefaultConfig.Load("../config_test.yml", true) require.Nil(suite.T(), err, "load config from yaml file, expect nil error but got error '%s'", err) + assert.Equal(suite.T(), 10, DefaultConfig.MaxLogSizeReturnedMB, "expect max log size returned 10MB but got %d", DefaultConfig.MaxLogSizeReturnedMB) redisURL := DefaultConfig.PoolConfig.RedisPoolCfg.RedisURL assert.Equal(suite.T(), "redis://localhost:6379", redisURL, "expect redisURL '%s' but got '%s'", "redis://localhost:6379", redisURL) diff --git a/src/jobservice/config_test.yml b/src/jobservice/config_test.yml index c1f2ce433..c8d7bb45a 100644 --- a/src/jobservice/config_test.yml +++ b/src/jobservice/config_test.yml @@ -39,3 +39,5 @@ job_loggers: loggers: - name: "STD_OUTPUT" # Same with above level: "DEBUG" + +max_retrieve_size_mb: 10 \ No newline at end of file diff --git a/src/jobservice/logger/getter/db_getter.go b/src/jobservice/logger/getter/db_getter.go index 0e53b3156..8d4f22fbc 100644 --- a/src/jobservice/logger/getter/db_getter.go +++ b/src/jobservice/logger/getter/db_getter.go @@ -30,5 +30,15 @@ func (dbg *DBGetter) Retrieve(logID string) ([]byte, error) { return nil, errs.NoObjectFoundError(fmt.Sprintf("log entity: %s", logID)) } - return []byte(jobLog.Content), nil + sz := int64(len(jobLog.Content)) + var buf []byte + sizeLimit := logSizeLimit() + if sizeLimit <= 0 { + buf = []byte(jobLog.Content) + return buf, nil + } + if sz > sizeLimit { + buf = []byte(jobLog.Content[sz-sizeLimit:]) + } + return buf, nil } diff --git a/src/jobservice/logger/getter/file_getter.go b/src/jobservice/logger/getter/file_getter.go index 48684840c..ef9c52d6a 100644 --- a/src/jobservice/logger/getter/file_getter.go +++ b/src/jobservice/logger/getter/file_getter.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/goharbor/harbor/src/jobservice/common/utils" + "github.com/goharbor/harbor/src/jobservice/config" "github.com/goharbor/harbor/src/jobservice/errs" ) @@ -21,6 +22,12 @@ type FileGetter struct { func NewFileGetter(baseDir string) *FileGetter { return &FileGetter{baseDir} } +func logSizeLimit() int64 { + if config.DefaultConfig == nil { + return int64(0) + } + return int64(config.DefaultConfig.MaxLogSizeReturnedMB * 1024 * 1024) +} // Retrieve implements @Interface.Retrieve func (fg *FileGetter) Retrieve(logID string) ([]byte, error) { @@ -34,7 +41,7 @@ func (fg *FileGetter) Retrieve(logID string) ([]byte, error) { return nil, errs.NoObjectFoundError(logID) } - return os.ReadFile(fPath) + return tailLogFile(fPath, logSizeLimit()) } func isValidLogID(id string) error { @@ -54,3 +61,42 @@ func isValidLogID(id string) error { return nil } + +func tailLogFile(filename string, limit int64) ([]byte, error) { + fInfo, err := os.Stat(filename) + if err != nil { + return nil, err + } + size := fInfo.Size() + + var sizeToRead int64 + if limit <= 0 { + sizeToRead = size + } else { + sizeToRead = limit + } + if sizeToRead > size { + sizeToRead = size + } + + fi, err := os.Open(filename) + if err != nil { + return nil, err + } + defer fi.Close() + + pos := size - sizeToRead + if pos < 0 { + pos = 0 + } + if pos != 0 { + _, err = fi.Seek(pos, 0) + if err != nil { + return nil, err + } + } + + buf := make([]byte, sizeToRead) + _, err = fi.Read(buf) + return buf, err +} diff --git a/src/jobservice/logger/getter/file_getter_test.go b/src/jobservice/logger/getter/file_getter_test.go index 2a7b74509..7dbfb82cf 100644 --- a/src/jobservice/logger/getter/file_getter_test.go +++ b/src/jobservice/logger/getter/file_getter_test.go @@ -44,3 +44,32 @@ func TestLogDataGetter(t *testing.T) { t.Errorf("expect reading 5 bytes but got %d bytes", len(data)) } } + +func Test_tailLogFile(t *testing.T) { + type args struct { + filename string + mbs int64 + } + tests := []struct { + name string + args args + want int + wantErr bool + }{ + {"normal test", args{"testdata/normal.log", 1000}, len(`hello world`), false}, + {"truncated test", args{"testdata/truncated.log", 1000}, 1000, false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := tailLogFile(tt.args.filename, tt.args.mbs) + if (err != nil) != tt.wantErr { + t.Errorf("tailLogFile() error = %v, wantErr %v", err, tt.wantErr) + return + } + // result should always less than the size limit + if len(got) > tt.want { + t.Errorf("tailLogFile() got = %v, want %v", len(got), tt.want) + } + }) + } +} diff --git a/src/jobservice/logger/getter/testdata/normal.log b/src/jobservice/logger/getter/testdata/normal.log new file mode 100644 index 000000000..95d09f2b1 --- /dev/null +++ b/src/jobservice/logger/getter/testdata/normal.log @@ -0,0 +1 @@ +hello world \ No newline at end of file diff --git a/src/jobservice/logger/getter/testdata/truncated.log b/src/jobservice/logger/getter/testdata/truncated.log new file mode 100644 index 000000000..1207976e5 --- /dev/null +++ b/src/jobservice/logger/getter/testdata/truncated.log @@ -0,0 +1,179 @@ +Mar 19 12:34:50 172.18.0.1 core[8188]: 2019-03-19T12:34:50Z [INFO] Config path: /etc/core/app.conf +Mar 19 12:34:50 172.18.0.1 core[8188]: 2019-03-19T12:34:50Z [INFO] initializing configurations... +Mar 19 12:34:50 172.18.0.1 core[8188]: 2019-03-19T12:34:50Z [INFO] key path: /etc/core/key +Mar 19 12:34:50 172.18.0.1 core[8188]: 2019-03-19T12:34:50Z [INFO] initializing client for adminserver http://adminserver:8080 ... +Mar 19 12:34:50 172.18.0.1 core[8188]: 2019-03-19T12:34:50Z [ERROR] [utils.go:101]: failed to connect to tcp://adminserver:8080, retry after 2 seconds :dial tcp 172.18.0.4:8080: getsockopt: connection refused +Mar 19 12:34:52 172.18.0.1 core[8188]: 2019-03-19T12:34:52Z [ERROR] [utils.go:101]: failed to connect to tcp://adminserver:8080, retry after 2 seconds :dial tcp 172.18.0.4:8080: getsockopt: connection refused +Mar 19 12:34:54 172.18.0.1 core[8188]: 2019-03-19T12:34:54Z [ERROR] [utils.go:101]: failed to connect to tcp://adminserver:8080, retry after 2 seconds :dial tcp 172.18.0.4:8080: getsockopt: connection refused +Mar 19 12:34:56 172.18.0.1 core[8188]: 2019-03-19T12:34:56Z [ERROR] [utils.go:101]: failed to connect to tcp://adminserver:8080, retry after 2 seconds :dial tcp 172.18.0.4:8080: getsockopt: connection refused +Mar 19 12:34:58 172.18.0.1 core[8188]: 2019-03-19T12:34:58Z [ERROR] [utils.go:101]: failed to connect to tcp://adminserver:8080, retry after 2 seconds :dial tcp 172.18.0.4:8080: getsockopt: connection refused +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] initializing the project manager based on local database... +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] configurations initialization completed +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] Registering database: type-PostgreSQL host-postgresql port-5432 databse-registry sslmode-"disable" +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] Register database completed +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] User id: 1 updated its encypted password successfully. +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] Enable redis cache for chart caching +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] API controller for chart repository server is successfully initialized +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] initialized clair database +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] Because SYNC_REGISTRY set false , no need to sync registry +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019-03-19T12:35:00Z [INFO] Init proxy +Mar 19 12:35:00 172.18.0.1 core[8188]: 2019/03/19 12:35:00 #033[1;34m[I] [asm_amd64.s:2337] http server Running on http://:8080#033[0m +Mar 19 12:35:01 172.18.0.1 core[8188]: 2019/03/19 12:35:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 14.536904ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:35:01 172.18.0.1 core[8188]: 2019/03/19 12:35:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 3.296536ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:35:02 172.18.0.1 core[8188]: 2019/03/19 12:35:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 24.097879ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:35:02 172.18.0.1 core[8188]: 2019/03/19 12:35:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 3.778134ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:35:04 172.18.0.1 core[8188]: 2019/03/19 12:35:04 #033[1;44m[D] [server.go:2619] | 172.18.0.9|#033[42m 200 #033[0m| 3.771354ms| match|#033[44m GET #033[0m /api/configs r:/api/configs#033[0m +Mar 19 12:35:20 172.18.0.1 core[8188]: 2019/03/19 12:35:20 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.5463ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:35:50 172.18.0.1 core[8188]: 2019/03/19 12:35:50 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 8.743277ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:36:02 172.18.0.1 core[8188]: 2019/03/19 12:36:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 8.21945ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:36:02 172.18.0.1 core[8188]: 2019/03/19 12:36:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 3.409655ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:36:02 172.18.0.1 core[8188]: 2019/03/19 12:36:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 30.516066ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:36:02 172.18.0.1 core[8188]: 2019/03/19 12:36:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 5.688545ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:36:20 172.18.0.1 core[8188]: 2019/03/19 12:36:20 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 1.920741ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:36:50 172.18.0.1 core[8188]: 2019/03/19 12:36:50 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 3.017657ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 14.560241ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 201 #033[0m| 16.837086ms| match|#033[46m POST #033[0m /api/projects r:/api/projects/#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[43m 401 #033[0m| 4.482415ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 29.386126ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 3.408002ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[43m 401 #033[0m| 5.372253ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 28.107979ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 202 #033[0m| 24.829902ms| match|#033[46m POST #033[0m /v2/errandsmoketest/busybox/blobs/uploads/ r:/v2/*#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 226.554µs| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 202 #033[0m| 169.69419ms| match|#033[42m PATCH #033[0m /v2/errandsmoketest/busybox/blobs/uploads/d8241d14-eef1-476c-80bb-12021374145f r:/v2/*#033[0m +Mar 19 12:37:20 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 201 #033[0m| 29.202776ms| match|#033[43m PUT #033[0m /v2/errandsmoketest/busybox/blobs/uploads/d8241d14-eef1-476c-80bb-12021374145f r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:20 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 537.27µs| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 12.621509ms| match|#033[45m HEAD #033[0m /v2/errandsmoketest/busybox/blobs/sha256:0ffadd58f2a61468f527cc4f0fc45272ee4a1a428abe014546c89de2aa6a0eb5 r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 3.368015ms| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[43m 404 #033[0m| 6.342259ms| match|#033[45m HEAD #033[0m /v2/errandsmoketest/busybox/blobs/sha256:6ad733544a6317992a6fac4eb19fe1df577d4dec7529efec28a5bd0edad0fd30 r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 202 #033[0m| 11.412618ms| match|#033[46m POST #033[0m /v2/errandsmoketest/busybox/blobs/uploads/ r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 202 #033[0m| 43.269666ms| match|#033[42m PATCH #033[0m /v2/errandsmoketest/busybox/blobs/uploads/fcf3c33e-6944-4fd9-bf7d-c217aee65ada r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 201 #033[0m| 27.841418ms| match|#033[43m PUT #033[0m /v2/errandsmoketest/busybox/blobs/uploads/fcf3c33e-6944-4fd9-bf7d-c217aee65ada r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 348.362µs| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 6.197794ms| match|#033[45m HEAD #033[0m /v2/errandsmoketest/busybox/blobs/sha256:6ad733544a6317992a6fac4eb19fe1df577d4dec7529efec28a5bd0edad0fd30 r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 316.628µs| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 201 #033[0m| 67.158336ms| match|#033[43m PUT #033[0m /v2/errandsmoketest/busybox/manifests/latest r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 43.513105ms| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019-03-19T12:37:21Z [INFO] Handle notification with topic 'OnPush': notification.OnPushNotification{Image:"errandsmoketest/busybox:latest"} +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 284.756µs| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[43m 401 #033[0m| 2.531966ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 28.124757ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 4.690525ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[43m 401 #033[0m| 3.614495ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 30.690429ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 251.226µs| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 33.74484ms| match|#033[44m GET #033[0m /v2/errandsmoketest/busybox/manifests/latest r:/v2/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 1.015052ms| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019-03-19T12:37:21Z [ERROR] [helper.go:100]: Repository not exist, repo: pksharbor.opendc.com/errandsmoketest/busybox, error: notary-server:4443 does not have trust data for pksharbor.opendc.com/errandsmoketest/busybox, returning empty signature +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 215.535µs| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 203.4µs| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019-03-19T12:37:21Z [INFO] delete tag: errandsmoketest/busybox:latest +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019-03-19T12:37:21Z [INFO] Handle notification with topic 'OnDeletion': notification.OnDeletionNotification{Image:"errandsmoketest/busybox:latest"} +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.18.0.3|#033[42m 200 #033[0m| 521.666µs| match|#033[46m POST #033[0m /service/notifications r:/service/notifications#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 138.021056ms| match|#033[41m DELETE #033[0m /api/repositories/errandsmoketest/busybox r:/api/repositories/*#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 15.199072ms| match|#033[44m GET #033[0m /api/projects r:/api/projects/#033[0m +Mar 19 12:37:21 172.18.0.1 core[8188]: 2019/03/19 12:37:21 #033[1;44m[D] [server.go:2619] | 172.31.0.13|#033[42m 200 #033[0m| 22.837654ms| match|#033[41m DELETE #033[0m /api/projects/2 r:/api/projects/:id([0-9]+)#033[0m +Mar 19 12:37:51 172.18.0.1 core[8188]: 2019/03/19 12:37:51 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.373319ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:38:01 172.18.0.1 core[8188]: 2019/03/19 12:38:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 6.750886ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:38:01 172.18.0.1 core[8188]: 2019/03/19 12:38:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 4.396347ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:38:01 172.18.0.1 core[8188]: 2019/03/19 12:38:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 29.98101ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:38:01 172.18.0.1 core[8188]: 2019/03/19 12:38:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 2.914537ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:38:21 172.18.0.1 core[8188]: 2019/03/19 12:38:21 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.402622ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:38:51 172.18.0.1 core[8188]: 2019/03/19 12:38:51 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.271274ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:39:21 172.18.0.1 core[8188]: 2019/03/19 12:39:21 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 5.932917ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:39:51 172.18.0.1 core[8188]: 2019/03/19 12:39:51 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.946484ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:40:01 172.18.0.1 core[8188]: 2019/03/19 12:40:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 4.990851ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:40:02 172.18.0.1 core[8188]: 2019/03/19 12:40:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 4.227635ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:40:02 172.18.0.1 core[8188]: 2019/03/19 12:40:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 24.346023ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:40:02 172.18.0.1 core[8188]: 2019/03/19 12:40:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 2.789886ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:40:21 172.18.0.1 core[8188]: 2019/03/19 12:40:21 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 3.042565ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:40:51 172.18.0.1 core[8188]: 2019/03/19 12:40:51 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.359124ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:41:21 172.18.0.1 core[8188]: 2019/03/19 12:41:21 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 4.678742ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:41:51 172.18.0.1 core[8188]: 2019/03/19 12:41:51 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.281185ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:42:01 172.18.0.1 core[8188]: 2019/03/19 12:42:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 6.151161ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:42:01 172.18.0.1 core[8188]: 2019/03/19 12:42:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 5.140206ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:42:01 172.18.0.1 core[8188]: 2019/03/19 12:42:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 31.413998ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:42:01 172.18.0.1 core[8188]: 2019/03/19 12:42:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 3.084734ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:42:22 172.18.0.1 core[8188]: 2019/03/19 12:42:22 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 3.741307ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:42:52 172.18.0.1 core[8188]: 2019/03/19 12:42:52 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.65481ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:43:22 172.18.0.1 core[8188]: 2019/03/19 12:43:22 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.478782ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:43:52 172.18.0.1 core[8188]: 2019/03/19 12:43:52 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.834162ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:44:01 172.18.0.1 core[8188]: 2019/03/19 12:44:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 5.729978ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:44:01 172.18.0.1 core[8188]: 2019/03/19 12:44:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 3.267458ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:44:01 172.18.0.1 core[8188]: 2019/03/19 12:44:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 29.992328ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:44:01 172.18.0.1 core[8188]: 2019/03/19 12:44:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 2.437427ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:44:22 172.18.0.1 core[8188]: 2019/03/19 12:44:22 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.129687ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:44:52 172.18.0.1 core[8188]: 2019/03/19 12:44:52 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.275487ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:45:22 172.18.0.1 core[8188]: 2019/03/19 12:45:22 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 5.468859ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:45:52 172.18.0.1 core[8188]: 2019/03/19 12:45:52 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 3.883718ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:46:02 172.18.0.1 core[8188]: 2019/03/19 12:46:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 4.112602ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:46:02 172.18.0.1 core[8188]: 2019/03/19 12:46:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 3.497234ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:46:02 172.18.0.1 core[8188]: 2019/03/19 12:46:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 30.010274ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:46:02 172.18.0.1 core[8188]: 2019/03/19 12:46:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 5.973529ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:46:23 172.18.0.1 core[8188]: 2019/03/19 12:46:23 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 3.162478ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:46:53 172.18.0.1 core[8188]: 2019/03/19 12:46:53 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.009288ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:47:23 172.18.0.1 core[8188]: 2019/03/19 12:47:23 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 5.247765ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:47:53 172.18.0.1 core[8188]: 2019/03/19 12:47:53 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 1.847279ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:48:01 172.18.0.1 core[8188]: 2019/03/19 12:48:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 6.387329ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:48:01 172.18.0.1 core[8188]: 2019/03/19 12:48:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 3.819339ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:48:01 172.18.0.1 core[8188]: 2019/03/19 12:48:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 31.661762ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:48:01 172.18.0.1 core[8188]: 2019/03/19 12:48:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 3.480124ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:48:23 172.18.0.1 core[8188]: 2019/03/19 12:48:23 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 5.727201ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:48:53 172.18.0.1 core[8188]: 2019/03/19 12:48:53 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.193369ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:49:23 172.18.0.1 core[8188]: 2019/03/19 12:49:23 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.855111ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:49:53 172.18.0.1 core[8188]: 2019/03/19 12:49:53 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.110888ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:50:02 172.18.0.1 core[8188]: 2019/03/19 12:50:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 7.150414ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:50:02 172.18.0.1 core[8188]: 2019/03/19 12:50:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 4.332007ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:50:02 172.18.0.1 core[8188]: 2019/03/19 12:50:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 30.362359ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:50:02 172.18.0.1 core[8188]: 2019/03/19 12:50:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 4.847472ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:50:23 172.18.0.1 core[8188]: 2019/03/19 12:50:23 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.076008ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:50:54 172.18.0.1 core[8188]: 2019/03/19 12:50:54 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.183799ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:51:24 172.18.0.1 core[8188]: 2019/03/19 12:51:24 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.766273ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:51:54 172.18.0.1 core[8188]: 2019/03/19 12:51:54 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.442362ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:52:01 172.18.0.1 core[8188]: 2019/03/19 12:52:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 6.023211ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:52:01 172.18.0.1 core[8188]: 2019/03/19 12:52:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 3.44847ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:52:01 172.18.0.1 core[8188]: 2019/03/19 12:52:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 30.549598ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:52:01 172.18.0.1 core[8188]: 2019/03/19 12:52:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 2.862251ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:52:24 172.18.0.1 core[8188]: 2019/03/19 12:52:24 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 3.164715ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:52:54 172.18.0.1 core[8188]: 2019/03/19 12:52:54 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 3.062933ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:53:24 172.18.0.1 core[8188]: 2019/03/19 12:53:24 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.085709ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:53:54 172.18.0.1 core[8188]: 2019/03/19 12:53:54 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.223595ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:54:01 172.18.0.1 core[8188]: 2019/03/19 12:54:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 8.469219ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:54:02 172.18.0.1 core[8188]: 2019/03/19 12:54:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 2.955256ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:54:02 172.18.0.1 core[8188]: 2019/03/19 12:54:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 23.839053ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:54:02 172.18.0.1 core[8188]: 2019/03/19 12:54:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 4.02656ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:54:24 172.18.0.1 core[8188]: 2019/03/19 12:54:24 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 1.842321ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:54:55 172.18.0.1 core[8188]: 2019/03/19 12:54:55 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.093892ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:55:25 172.18.0.1 core[8188]: 2019/03/19 12:55:25 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 7.823017ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:55:55 172.18.0.1 core[8188]: 2019/03/19 12:55:55 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.439695ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:56:01 172.18.0.1 core[8188]: 2019/03/19 12:56:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 5.613111ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:56:01 172.18.0.1 core[8188]: 2019/03/19 12:56:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 4.551849ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:56:01 172.18.0.1 core[8188]: 2019/03/19 12:56:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 31.893063ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:56:01 172.18.0.1 core[8188]: 2019/03/19 12:56:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 2.985837ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:56:25 172.18.0.1 core[8188]: 2019/03/19 12:56:25 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 4.812971ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:56:55 172.18.0.1 core[8188]: 2019/03/19 12:56:55 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.124162ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:57:25 172.18.0.1 core[8188]: 2019/03/19 12:57:25 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 4.565592ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:57:55 172.18.0.1 core[8188]: 2019/03/19 12:57:55 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.728811ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:58:01 172.18.0.1 core[8188]: 2019/03/19 12:58:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 8.703956ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 12:58:01 172.18.0.1 core[8188]: 2019/03/19 12:58:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 3.073086ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:58:01 172.18.0.1 core[8188]: 2019/03/19 12:58:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 30.741321ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 12:58:01 172.18.0.1 core[8188]: 2019/03/19 12:58:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 6.992504ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 12:58:25 172.18.0.1 core[8188]: 2019/03/19 12:58:25 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.785165ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:58:55 172.18.0.1 core[8188]: 2019/03/19 12:58:55 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 1.906476ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:59:26 172.18.0.1 core[8188]: 2019/03/19 12:59:26 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.567999ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 12:59:56 172.18.0.1 core[8188]: 2019/03/19 12:59:56 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.492075ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 13:00:02 172.18.0.1 core[8188]: 2019/03/19 13:00:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 7.714592ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 13:00:02 172.18.0.1 core[8188]: 2019/03/19 13:00:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 5.226376ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 13:00:02 172.18.0.1 core[8188]: 2019/03/19 13:00:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 31.122702ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 13:00:02 172.18.0.1 core[8188]: 2019/03/19 13:00:02 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 4.834111ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 13:00:26 172.18.0.1 core[8188]: 2019/03/19 13:00:26 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.055412ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 13:00:56 172.18.0.1 core[8188]: 2019/03/19 13:00:56 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 1.989599ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 13:01:26 172.18.0.1 core[8188]: 2019/03/19 13:01:26 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.834664ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 13:01:56 172.18.0.1 core[8188]: 2019/03/19 13:01:56 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.341489ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 13:02:01 172.18.0.1 core[8188]: 2019/03/19 13:02:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 3.472989ms| match|#033[44m GET #033[0m /api/systeminfo r:/api/systeminfo#033[0m +Mar 19 13:02:01 172.18.0.1 core[8188]: 2019/03/19 13:02:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[43m 401 #033[0m| 2.942381ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 13:02:01 172.18.0.1 core[8188]: 2019/03/19 13:02:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 24.579534ms| match|#033[44m GET #033[0m /service/token r:/service/token#033[0m +Mar 19 13:02:01 172.18.0.1 core[8188]: 2019/03/19 13:02:01 #033[1;44m[D] [server.go:2619] | 172.31.0.14|#033[42m 200 #033[0m| 2.214257ms| match|#033[44m GET #033[0m /v2/ r:/v2/*#033[0m +Mar 19 13:02:26 172.18.0.1 core[8188]: 2019/03/19 13:02:26 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.00152ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 13:02:56 172.18.0.1 core[8188]: 2019/03/19 13:02:56 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.232816ms| match|#033[44m GET #033[0m /api/ping r:/api/ping#033[0m +Mar 19 13:03:26 172.18.0.1 core[8188]: 2019/03/19 13:03:26 #033[1;44m[D] [server.go:2619] | 127.0.0.1|#033[42m 200 #033[0m| 2.63494 \ No newline at end of file diff --git a/src/pkg/task/mock_task_manager_test.go b/src/pkg/task/mock_task_manager_test.go index 17665a53c..21b16b2fb 100644 --- a/src/pkg/task/mock_task_manager_test.go +++ b/src/pkg/task/mock_task_manager_test.go @@ -132,6 +132,29 @@ func (_m *mockTaskManager) GetLog(ctx context.Context, id int64) ([]byte, error) return r0, r1 } +// GetLogByJobID provides a mock function with given fields: ctx, jobID +func (_m *mockTaskManager) GetLogByJobID(ctx context.Context, jobID string) ([]byte, error) { + ret := _m.Called(ctx, jobID) + + var r0 []byte + if rf, ok := ret.Get(0).(func(context.Context, string) []byte); ok { + r0 = rf(ctx, jobID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, jobID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // List provides a mock function with given fields: ctx, query func (_m *mockTaskManager) List(ctx context.Context, query *q.Query) ([]*Task, error) { ret := _m.Called(ctx, query) diff --git a/src/pkg/task/task.go b/src/pkg/task/task.go index 05d529ad1..88fae3092 100644 --- a/src/pkg/task/task.go +++ b/src/pkg/task/task.go @@ -53,6 +53,8 @@ type Manager interface { UpdateExtraAttrs(ctx context.Context, id int64, extraAttrs map[string]interface{}) (err error) // Get the log of the specified task GetLog(ctx context.Context, id int64) (log []byte, err error) + // GetLogByJobID get the log of specified job id + GetLogByJobID(ctx context.Context, jobID string) (log []byte, err error) // Count counts total of tasks according to the query. // Query the "ExtraAttrs" by setting 'query.Keywords["ExtraAttrs.key"]="value"' Count(ctx context.Context, query *q.Query) (int64, error) @@ -259,3 +261,7 @@ func (m *manager) UpdateStatusInBatch(ctx context.Context, jobIDs []string, stat func (m *manager) ExecutionIDsByVendorAndStatus(ctx context.Context, vendorType, status string) ([]int64, error) { return m.dao.ExecutionIDsByVendorAndStatus(ctx, vendorType, status) } + +func (m *manager) GetLogByJobID(ctx context.Context, jobID string) (log []byte, err error) { + return m.jsClient.GetJobLog(jobID) +} diff --git a/src/server/v2.0/handler/jobservice.go b/src/server/v2.0/handler/jobservice.go index 92ea66d54..33084a2eb 100644 --- a/src/server/v2.0/handler/jobservice.go +++ b/src/server/v2.0/handler/jobservice.go @@ -196,3 +196,14 @@ func (j *jobServiceAPI) ActionPendingJobs(ctx context.Context, params jobservice } return jobservice.NewActionPendingJobsOK() } + +func (j *jobServiceAPI) ActionGetJobLog(ctx context.Context, params jobservice.ActionGetJobLogParams) middleware.Responder { + if err := j.RequireSystemAccess(ctx, rbac.ActionList, rbac.ResourceJobServiceMonitor); err != nil { + return j.SendError(ctx, err) + } + log, err := j.jobCtr.GetJobLog(ctx, params.JobID) + if err != nil { + return j.SendError(ctx, err) + } + return jobservice.NewActionGetJobLogOK().WithContentType("text/plain").WithPayload(string(log)) +} diff --git a/src/testing/pkg/task/manager.go b/src/testing/pkg/task/manager.go index 83e042f84..aee36e265 100644 --- a/src/testing/pkg/task/manager.go +++ b/src/testing/pkg/task/manager.go @@ -134,6 +134,29 @@ func (_m *Manager) GetLog(ctx context.Context, id int64) ([]byte, error) { return r0, r1 } +// GetLogByJobID provides a mock function with given fields: ctx, jobID +func (_m *Manager) GetLogByJobID(ctx context.Context, jobID string) ([]byte, error) { + ret := _m.Called(ctx, jobID) + + var r0 []byte + if rf, ok := ret.Get(0).(func(context.Context, string) []byte); ok { + r0 = rf(ctx, jobID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, jobID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // List provides a mock function with given fields: ctx, query func (_m *Manager) List(ctx context.Context, query *q.Query) ([]*task.Task, error) { ret := _m.Called(ctx, query)