diff --git a/cmd/server/run-analysis.sh b/cmd/server/bin/run-analysis.sh similarity index 72% rename from cmd/server/run-analysis.sh rename to cmd/server/bin/run-analysis.sh index 076fd00..7e98e60 100755 --- a/cmd/server/run-analysis.sh +++ b/cmd/server/bin/run-analysis.sh @@ -12,7 +12,9 @@ DBOWNER=$1 shift DBREPO=$1 +# FIXME Provide this via environment or explicit argument GMSROOT=/Users/hohn/local/ghes-mirva-server +GMSROOT=/Users/hohn/work-gh/mrva/mrvacommander/cmd/server #* Set up derived paths DBPATH=$GMSROOT/var/codeql/dbs/$DBOWNER/$DBREPO @@ -30,7 +32,6 @@ QUERYOUTF=$QUERYOUTD/${DBOWNER}_${DBREPO}.sarif #** Extract database mkdir -p $DBEXTRACT && cd $DBEXTRACT unzip -o -q $DBZIP -DBINFIX=`\ls | head -1` # Could be cpp, codeql_db, or whatever # Extract query pack mkdir -p $QUERYEXTRACT && cd $QUERYEXTRACT @@ -41,17 +42,17 @@ mkdir -p $QUERYOUTD #* run database analyze cd $GMSROOT -codeql database analyze --format=sarif-latest --rerun \ - --output $QUERYOUTF \ - -j8 \ - -- $DBPATH/$DBINFIX $QUERYEXTRACT +codeql database analyze --format=sarif-latest --rerun \ + --output $QUERYOUTF \ + -j8 \ + -- $DBPATH $QUERYEXTRACT #* report result -# var/codeql/sarif/localrun/google/flatbuffers/google_flatbuffers.sarif printf "run-analysis-output in %s\n" $QUERYOUTF + # TODO Is the bqrs really necessary? It can also be found by the go code at this point. -# The name of the query is only found in the query pack itself and would have to be -# extracted from there. -# var/codeql/dbs/google/flatbuffers/cpp/results/codeql-remote/query/FlatBuffersFunc.bqrs +# TODO The name of the query is only found in the query pack itself and would have +# to be extracted from there. + # BQRSPATH=$GMSROOT/var/codeql/dbs/$DBOWNER/$DBREPO/$LANGUAGE/results/codeql-remote/query/ # printf "run-analysis-bqrs in %s\n" $QUERYOUTF diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index dcd2bb5..179b362 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -45,7 +45,7 @@ func (r *RunnerSingle) worker(wid int) { slog.Debug("Analysis: running", "job", job) storage.SetStatus(job.QueryPackId, job.ORL, common.StatusQueued) - cmd := exec.Command(path.Join(cwd, "cmd", "run-analysis.sh"), + cmd := exec.Command(path.Join(cwd, "bin", "run-analysis.sh"), strconv.FormatInt(int64(job.QueryPackId), 10), job.QueryLanguage, job.ORL.Owner, job.ORL.Repo)