-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JF_MSI env var #883
Add JF_MSI env var #883
Conversation
# Conflicts: # .github/workflows/analysis.yml # go.mod # go.sum # utils/utils.go # xray/services/scan.go # xray/services/scan_test.go
# Conflicts: # utils/utils.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we can merge this PR, you should go ahead and create two additional PRs for the jfrog-cli-core and jfrog-cli projects, so that we can see that the tests that those projects include, and may be impacted by this change, as passing.
You'll need to use the replace
statements in the go.mod
files of those projects, to reference this PR's branch (your fork) for both of your jfrog-client-go
and jfrog-cli-core
. It'll be helpfull if you link all of the 3 PRs by adding referencing them in the descriptions of the PRs.
xray/services/scan.go
Outdated
err = os.Setenv("JF_MSI", multiScanId) | ||
if err != nil { | ||
return "", fmt.Errorf("failed setting msi as environment variable") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above code can be simplified as follows. In addition, the error created should be wrapped with errorutils.CheckErrorf(err)
iin this case, beucase os.Setenv
, which may return the error, is an external API to the jfrog-client-go
codebase. Also notice that in the above code the original error is lost, and the below code fixes that as well.
if err = os.Setenv("JF_MSI", multiScanId); err != nil {
errorutils.CheckErrorf("failed setting msi as environment variable. Cause: %s", err.Error())
}
… into XRAY-36857---Add-JF_MSI-env-var
Analyzer Manager is expecting to get the multi_scan_id as env variable named JF_MSI. Added this variable right after we get the multi_scan_id from xsc.
PR in jfrog-cli-security using this branch as jfrog-client-go package (for test purposes):
jfrog/jfrog-cli-security#5