Skip to content

Commit

Permalink
UPSTREAM: <carry>: Fix a bug ListArtifacts and Getartifacts with olde…
Browse files Browse the repository at this point in the history
…r rhoai releases

This bug was introduced adter kfp 2.2.0 code rebase

Signed-off-by: Ricardo M. Oliveira <rmartine@redhat.com>
  • Loading branch information
rimolive committed Oct 10, 2024
1 parent 028d903 commit 7ccd7de
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion backend/src/apiserver/resource/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,40 @@ func (r *ResourceManager) GetArtifactSessionInfo(ctx context.Context, artifact *
}

// Retrieve Session info
sessionInfoString := artifactCtx.CustomProperties["store_session_info"].GetStringValue()
storeSessionInfo, ok_session := artifactCtx.CustomProperties["store_session_info"]

var sessionInfoString = ""

if ok_session {
sessionInfoString = storeSessionInfo.GetStringValue()
} else {
// bucket_session_info is an old struct that needs to be converted to store_session_info
bucketSession := &objectstore.S3Params{}
err := json.Unmarshal([]byte(artifactCtx.CustomProperties["bucket_session_info"].GetStringValue()), bucketSession)
if err != nil {
return nil, "", err
}
sessionInfoParams := &map[string]string{
"fromEnv": "false",
"endpoint": bucketSession.Endpoint,
"region": bucketSession.Region,
"disableSSL": strconv.FormatBool(bucketSession.DisableSSL),
"decretName": bucketSession.SecretName,
"accessKeyKey": bucketSession.AccessKeyKey,
"secretKeyKey": bucketSession.SecretKeyKey,
}

sessionInfo := &objectstore.SessionInfo{
Provider: "s3",
Params: *sessionInfoParams,
}
sessionInfoBytes, err := json.Marshal(*sessionInfo)
if err != nil {
return nil, "", err
}
sessionInfoString = string(sessionInfoBytes)
}

if sessionInfoString == "" {
return nil, "", fmt.Errorf("Unable to retrieve artifact session info via context property.")
}
Expand Down

0 comments on commit 7ccd7de

Please sign in to comment.