Add {packs,results} to minio store artifact names
This commit is contained in:
committed by
=Michael Hohn
parent
8577e1775a
commit
0115e74d07
@@ -39,7 +39,7 @@ func (store *InMemoryArtifactStore) SaveQueryPack(sessionId int, data []byte) (A
|
|||||||
store.mu.Lock()
|
store.mu.Lock()
|
||||||
defer store.mu.Unlock()
|
defer store.mu.Unlock()
|
||||||
|
|
||||||
key := fmt.Sprintf("%d", sessionId)
|
key := fmt.Sprintf("%d-packs", sessionId)
|
||||||
store.packs[key] = data
|
store.packs[key] = data
|
||||||
|
|
||||||
location := ArtifactLocation{
|
location := ArtifactLocation{
|
||||||
@@ -80,7 +80,7 @@ func (store *InMemoryArtifactStore) SaveResult(jobSpec common.JobSpec, data []by
|
|||||||
store.mu.Lock()
|
store.mu.Lock()
|
||||||
defer store.mu.Unlock()
|
defer store.mu.Unlock()
|
||||||
|
|
||||||
key := fmt.Sprintf("%d-%s", jobSpec.SessionID, jobSpec.NameWithOwner)
|
key := fmt.Sprintf("%d-results-%s", jobSpec.SessionID, jobSpec.NameWithOwner)
|
||||||
store.results[key] = data
|
store.results[key] = data
|
||||||
|
|
||||||
location := ArtifactLocation{
|
location := ArtifactLocation{
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func (store *MinIOArtifactStore) GetQueryPack(location ArtifactLocation) ([]byte
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (store *MinIOArtifactStore) SaveQueryPack(jobId int, data []byte) (ArtifactLocation, error) {
|
func (store *MinIOArtifactStore) SaveQueryPack(jobId int, data []byte) (ArtifactLocation, error) {
|
||||||
key := fmt.Sprintf("%d", jobId)
|
key := fmt.Sprintf("%d-packs", jobId)
|
||||||
return store.saveArtifact(AF_BUCKETNAME_PACKS, key, data, "application/gzip")
|
return store.saveArtifact(AF_BUCKETNAME_PACKS, key, data, "application/gzip")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ func (store *MinIOArtifactStore) GetResultSize(location ArtifactLocation) (int,
|
|||||||
return int(objectInfo.Size), nil
|
return int(objectInfo.Size), nil
|
||||||
}
|
}
|
||||||
func (store *MinIOArtifactStore) SaveResult(jobSpec common.JobSpec, data []byte) (ArtifactLocation, error) {
|
func (store *MinIOArtifactStore) SaveResult(jobSpec common.JobSpec, data []byte) (ArtifactLocation, error) {
|
||||||
key := fmt.Sprintf("%d-%s", jobSpec.SessionID, jobSpec.NameWithOwner)
|
key := fmt.Sprintf("%d-results-%s", jobSpec.SessionID, jobSpec.NameWithOwner)
|
||||||
return store.saveArtifact(AF_BUCKETNAME_RESULTS, key, data, "application/zip")
|
return store.saveArtifact(AF_BUCKETNAME_RESULTS, key, data, "application/zip")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -326,11 +326,13 @@ func (c *CommanderSingle) MRVAStatus(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Download artifacts
|
// Download artifacts
|
||||||
func (c *CommanderSingle) MRVADownloadArtifactCommon(w http.ResponseWriter, r *http.Request, jobRepoId int, jobSpec common.JobSpec) {
|
func (c *CommanderSingle) MRVADownloadArtifactCommon(w http.ResponseWriter,
|
||||||
|
r *http.Request, jobRepoId int, jobSpec common.JobSpec) {
|
||||||
slog.Debug("MRVA artifact download",
|
slog.Debug("MRVA artifact download",
|
||||||
"codeql_variant_analysis_id", jobSpec.SessionID,
|
"codeql_variant_analysis_id", jobSpec.SessionID,
|
||||||
"repo_owner", jobSpec.NameWithOwner.Owner,
|
"repo_owner", jobSpec.NameWithOwner.Owner,
|
||||||
"repo_name", jobSpec.NameWithOwner.Repo,
|
"repo_name", jobSpec.NameWithOwner.Repo,
|
||||||
|
"jobRepoId", jobRepoId,
|
||||||
)
|
)
|
||||||
|
|
||||||
c.sendArtifactDownloadResponse(w, jobRepoId, jobSpec)
|
c.sendArtifactDownloadResponse(w, jobRepoId, jobSpec)
|
||||||
@@ -424,7 +426,8 @@ func (c *CommanderSingle) MRVADownloadArtifact(w http.ResponseWriter, r *http.Re
|
|||||||
c.MRVADownloadArtifactCommon(w, r, -1, jobSpec)
|
c.MRVADownloadArtifactCommon(w, r, -1, jobSpec)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CommanderSingle) sendArtifactDownloadResponse(w http.ResponseWriter, jobRepoId int, jobSpec common.JobSpec) {
|
func (c *CommanderSingle) sendArtifactDownloadResponse(w http.ResponseWriter,
|
||||||
|
jobRepoId int, jobSpec common.JobSpec) {
|
||||||
var response common.DownloadResponse
|
var response common.DownloadResponse
|
||||||
|
|
||||||
slog.Debug("Forming download response", "job", jobSpec)
|
slog.Debug("Forming download response", "job", jobSpec)
|
||||||
@@ -511,6 +514,8 @@ func (c *CommanderSingle) sendArtifactDownloadResponse(w http.ResponseWriter, jo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slog.Debug("MRVA: Sending download response", "responseJson", responseJson)
|
||||||
|
|
||||||
// Send analysisReposJSON via ResponseWriter
|
// Send analysisReposJSON via ResponseWriter
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.Write(responseJson)
|
w.Write(responseJson)
|
||||||
|
|||||||
Reference in New Issue
Block a user