Repository navigation
🐛 QD-16308 Report "undefined" for a plain docker run and pass QODANA_ENV to the container - #1144
Open
Jakub Andrzejewski (bonepl) wants to merge 1 commit into
Open
Jakub Andrzejewski (bonepl) wants to merge 1 commit into
Jakub Andrzejewski (bonepl) wants to merge 1 commit into
Conversation
…ENV to the container
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Qodana for Go127 new problems were found
@@ Code coverage @@
+ 65% total lines covered
10636 lines analyzed, 6985 lines covered
# Calculated according to the filters of your coverage tool☁️ View the detailed Qodana report Contact Qodana teamContact us at qodana-support@jetbrains.com
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two changes in
qdenv.ExtractQodanaEnvironment(internal/platform/qdenv/qdenv.go):QODANA_DOCKERis set) and finds no CI, Space or Bitbucket, it does not setQODANA_ENV. The IDE then reportssystem=undefinedto FUS instead ofcli.QODANA_ENVfrom the process env is now copied withsetEnvironmentFunc, the same way asQODANA_BRANCHandQODANA_REVISION. In docker mode, the value now gets to the container.Order of precedence for
QODANA_ENV:--env, then the process env, then the computed value (<ci>:<ver>orcli:<ver>). Native mode does not change, becauseSetEnvdoes not overwrite a non-empty variable.Related Issue
https://youtrack.jetbrains.com/issue/QD-16308
Motivation and Context
docker run jetbrains/qodana-*starts the bundled CLI, which goes through the native path and always setcli:<ver>. Because of this, FUS never gotundefined, also with-e QODANA_ENV=.QODANA_ENV=gradle/mavenonly in the process env of the CLI. By default they run in docker mode, andgetDockerOptionspasses onlyc.Env()to the container. Their value was lost, so FUS showedclior the CI name.docker run,QODANA_ENVnot set or emptycliundefinedqodana scaninside a Qodana image, no CI detectedcliundefinedqodana scanon the host (native or docker mode)clicli<ci><ci>clior<ci>gradle/maven--env QODANA_ENV=...(TeamCity plugin)--env--envdocker run -e QODANA_ENV=...Known behavior changes:
gradle/maveninstead of the CI name. Native mode already works this way.QODANA_ENVexported in the shell now gets to the container in docker mode too.undefinedvalue appears only in images with this CLI version. Older images still reportcli.The linter part (
bitbucketandmavenas known systems, FUS group version 18) is in a separate IntelliJ change.How Has This Been Tested
internal/core/corescan/env_test.go,Test_ExtractEnvironmentVariables, new cases:Plain docker runandPlain docker run with empty QODANA_ENVexpect an emptyQODANA_ENV.BitBucket Pipelines in Qodana imageexpectsbitbucket:<ver>, so a detected CI still wins inside the image.Test_ExtractQodanaEnvironment_PassesOsQodanaEnvToContainer: the process env hasQODANA_ENV=gradleandContext{}is empty. The test expectsgradleinc.Env().cli:dev).go test ./internal/platform/qdenv/ ./internal/core/...passes.gofmt -lreports no files.Types of changes
Checklist