diff --git a/README.org b/README.org index b55721e..cc56bcb 100644 --- a/README.org +++ b/README.org @@ -194,7 +194,9 @@ ./gh-mrva -h # Submit the mrva job - ./gh-mrva submit --language cpp --session mirva-session-6 \ + SN=9 + ./gh-mrva submit --language cpp --session mirva-session-$SN \ --list mirva-list \ - --query /Users/hohn/local/gh-mrva/FlatBuffersFunc.ql + --query /Users/hohn/local/gh-mrva/FlatBuffersFunc.ql >& log-$SN.out & + tail -f log-$SN.out #+END_SRC diff --git a/log-submit-the-mrva-job.log b/log-submit-the-mrva-job.log new file mode 100644 index 0000000..1a932a4 --- /dev/null +++ b/log-submit-the-mrva-job.log @@ -0,0 +1,143 @@ +SN=10 +./gh-mrva submit --language cpp --session mirva-session-$SN \ + --list mirva-list \ + --query /Users/hohn/local/gh-mrva/FlatBuffersFunc.ql >& log-$SN.out & +tail -f log-$SN.out + + +Resolving mirva-list repositories from /Users/hohn/local/gh-mrva/databases.json +Submitting 1 queries for 1 repositories +Generating query pack for /Users/hohn/local/gh-mrva/FlatBuffersFunc.ql +Resolving query id for /Users/hohn/local/gh-mrva/FlatBuffersFunc.ql +Metadata: { + "name" : "pickfun", + "description" : "pick function from FlatBuffers", + "kind" : "problem", + "id" : "cpp-flatbuffer-func", + "problem.severity" : "warning" +} + +QLPack exists, stripping all other queries from /Users/hohn/local/gh-mrva +Preparing stripped QLPack in /var/folders/bk/dt0jx9f92zq876lmm3f2dpk40000gn/T/query-pack-1881677116 +Fixing QLPack in /var/folders/bk/dt0jx9f92zq876lmm3f2dpk40000gn/T/query-pack-1881677116 +Installing QLPack dependencies +Compiling and bundling the QLPack (This may take a while) +Generated encoded bundle for /Users/hohn/local/gh-mrva/FlatBuffersFunc.ql (cpp-flatbuffer-func) +2024/02/08 14:54:14 >> POST https://api.github.com/repos/hohn/mirva-controller/code-scanning/codeql/variant-analyses +2024/02/08 14:54:14 >> Request body: {"repositories":["google/flatbuffers"],"language":"cpp","query_pack":"H4sIAAAA...","action_repo_ref":"main"} +2024/02/08 14:54:17 << 201 https://api.github.com/repos/hohn/mirva-controller/code-scanning/codeql/variant-analyses +2024/02/08 14:54:17 >> Response body: { + "id": 8985, + "controller_repo": { + "id": 747492529, + "node_id": "R_kgDOLI3UsQ", + "name": "mirva-controller", + "full_name": "hohn/mirva-controller", + "private": false, + "owner": { + "login": "hohn", + "id": 2253228, + "node_id": "MDQ6VXNlcjIyNTMyMjg=", + "avatar_url": "https://avatars.githubusercontent.com/u/2253228?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hohn", + "html_url": "https://github.com/hohn", + "followers_url": "https://api.github.com/users/hohn/followers", + "following_url": "https://api.github.com/users/hohn/following{/other_user}", + "gists_url": "https://api.github.com/users/hohn/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hohn/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hohn/subscriptions", + "organizations_url": "https://api.github.com/users/hohn/orgs", + "repos_url": "https://api.github.com/users/hohn/repos", + "events_url": "https://api.github.com/users/hohn/events{/privacy}", + "received_events_url": "https://api.github.com/users/hohn/received_events", + "type": "User", + "site_admin": true + }, + "html_url": "https://github.com/hohn/mirva-controller", + "description": "Controller for MRVA", + "fork": false, + "url": "https://api.github.com/repos/hohn/mirva-controller", + "forks_url": "https://api.github.com/repos/hohn/mirva-controller/forks", + "keys_url": "https://api.github.com/repos/hohn/mirva-controller/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hohn/mirva-controller/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hohn/mirva-controller/teams", + "hooks_url": "https://api.github.com/repos/hohn/mirva-controller/hooks", + "issue_events_url": "https://api.github.com/repos/hohn/mirva-controller/issues/events{/number}", + "events_url": "https://api.github.com/repos/hohn/mirva-controller/events", + "assignees_url": "https://api.github.com/repos/hohn/mirva-controller/assignees{/user}", + "branches_url": "https://api.github.com/repos/hohn/mirva-controller/branches{/branch}", + "tags_url": "https://api.github.com/repos/hohn/mirva-controller/tags", + "blobs_url": "https://api.github.com/repos/hohn/mirva-controller/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hohn/mirva-controller/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hohn/mirva-controller/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hohn/mirva-controller/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hohn/mirva-controller/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hohn/mirva-controller/languages", + "stargazers_url": "https://api.github.com/repos/hohn/mirva-controller/stargazers", + "contributors_url": "https://api.github.com/repos/hohn/mirva-controller/contributors", + "subscribers_url": "https://api.github.com/repos/hohn/mirva-controller/subscribers", + "subscription_url": "https://api.github.com/repos/hohn/mirva-controller/subscription", + "commits_url": "https://api.github.com/repos/hohn/mirva-controller/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hohn/mirva-controller/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hohn/mirva-controller/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hohn/mirva-controller/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hohn/mirva-controller/contents/{+path}", + "compare_url": "https://api.github.com/repos/hohn/mirva-controller/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hohn/mirva-controller/merges", + "archive_url": "https://api.github.com/repos/hohn/mirva-controller/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hohn/mirva-controller/downloads", + "issues_url": "https://api.github.com/repos/hohn/mirva-controller/issues{/number}", + "pulls_url": "https://api.github.com/repos/hohn/mirva-controller/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hohn/mirva-controller/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hohn/mirva-controller/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hohn/mirva-controller/labels{/name}", + "releases_url": "https://api.github.com/repos/hohn/mirva-controller/releases{/id}", + "deployments_url": "https://api.github.com/repos/hohn/mirva-controller/deployments" + }, + "actor": { + "login": "hohn", + "id": 2253228, + "node_id": "MDQ6VXNlcjIyNTMyMjg=", + "avatar_url": "https://avatars.githubusercontent.com/u/2253228?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hohn", + "html_url": "https://github.com/hohn", + "followers_url": "https://api.github.com/users/hohn/followers", + "following_url": "https://api.github.com/users/hohn/following{/other_user}", + "gists_url": "https://api.github.com/users/hohn/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hohn/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hohn/subscriptions", + "organizations_url": "https://api.github.com/users/hohn/orgs", + "repos_url": "https://api.github.com/users/hohn/repos", + "events_url": "https://api.github.com/users/hohn/events{/privacy}", + "received_events_url": "https://api.github.com/users/hohn/received_events", + "type": "User", + "site_admin": true + }, + "query_language": "cpp", + "query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/8985/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20240208%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240208T225421Z&X-Amz-Expires=3600&X-Amz-Signature=732819ba6d72cfd402c4c491b9e64b6e324fd781d11560fccbdf8645e827a252&X-Amz-SignedHeaders=host", + "created_at": "2024-02-08T22:54:21Z", + "updated_at": "2024-02-08T22:54:21Z", + "status": "in_progress", + "skipped_repositories": { + "access_mismatch_repos": { + "repository_count": 0, + "repositories": [] + }, + "not_found_repos": { + "repository_count": 0, + "repository_full_names": [] + }, + "no_codeql_db_repos": { + "repository_count": 0, + "repositories": [] + }, + "over_limit_repos": { + "repository_count": 0, + "repositories": [] + } + } +} + +Done! diff --git a/main.go b/main.go index 2e08a2a..94edab7 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,8 @@ THE SOFTWARE. package main import ( + "bytes" + "io" "log" "net/http" "time" @@ -44,9 +46,20 @@ func main() { cmd.Execute() } -// Used if transport.LogRequest is not set. func LogRequestDump(req *http.Request) { log.Printf(">> %s %s", req.Method, req.URL) + + buf, err := io.ReadAll(req.Body) + if err != nil { + var w http.ResponseWriter + log.Printf("Error reading request body: %v", err.Error()) + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + log.Printf(">> Request body: %v", string(buf)) + + reader := io.NopCloser(bytes.NewBuffer(buf)) + req.Body = reader } type contextKey struct { @@ -55,7 +68,6 @@ type contextKey struct { var ContextKeyRequestStart = &contextKey{"RequestStart"} -// Used if transport.LogResponse is not set. func LogResponseDump(resp *http.Response) { ctx := resp.Request.Context() if start, ok := ctx.Value(ContextKeyRequestStart).(time.Time); ok { @@ -64,4 +76,17 @@ func LogResponseDump(resp *http.Response) { } else { log.Printf("<< %d %s", resp.StatusCode, resp.Request.URL) } + + buf, err := io.ReadAll(resp.Body) + if err != nil { + var w http.ResponseWriter + log.Printf("Error reading response body: %v", err.Error()) + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + log.Printf(">> Response body: %v", string(buf)) + + reader := io.NopCloser(bytes.NewBuffer(buf)) + resp.Body = reader + }