Skip to content
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

docs: added environment variables documentation #8680

Merged

Conversation

HariSekhon
Copy link
Contributor

@HariSekhon HariSekhon commented Mar 4, 2022

I'd like an environment variables documentation reference page.

It's the sort of thing I use a lot in other projects documentation so I've created one.

I've added a documentation page on some useful environment variables that I add a lot as I've pieced these together over time from other pages, this is slightly different to the build environment page, but feel free to incorporate or restructure this as you see fit.

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@HariSekhon HariSekhon force-pushed the environment-variable-documentation branch from cf78b2d to aa038fc Compare March 4, 2022 13:50
@codecov
Copy link

codecov bot commented Mar 4, 2022

Codecov Report

Merging #8680 (66b0129) into master (b8f6b1c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #8680   +/-   ##
=======================================
  Coverage   45.90%   45.90%           
=======================================
  Files         222      222           
  Lines       26461    26461           
=======================================
  Hits        12146    12146           
  Misses      12658    12658           
  Partials     1657     1657           
Impacted Files Coverage Δ
util/settings/settings.go 48.16% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8f6b1c...66b0129. Read the comment docs.

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, and apologies for the slow review! Added one nitpick.

docs/user-guide/environment-variables.md Outdated Show resolved Hide resolved
@crenshaw-dev crenshaw-dev changed the title Added Environment Variables documentation docs: added environment variables documentation Jun 9, 2022
@lucasff
Copy link

lucasff commented Jun 12, 2022

this is ready, no? is there any way to passing the username or password via env?

@HariSekhon
Copy link
Contributor Author

HariSekhon commented Jun 13, 2022

@lucasff you got me curious, so I've just grep'd the entire ArgoCD codebase for tokens using a new script I just rustled up:

https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/git_grep_env_vars.sh

This has led to me finding some new environment variables:

  • ARGOCD_CONFIG_DIR
  • XDG_CONFIG_HOME

and some other interesting bits:

pkg/apiclient/apiclient.go: EnvArgoCDAuthToken = "ARGOCD_AUTH_TOKEN"
pkg/apiclient/apiclient.go: EnvArgoCDServer = "ARGOCD_SERVER"
pkg/apiclient/apiclient.go: EnvArgoCDgRPCMaxSizeMB = "ARGOCD_GRPC_MAX_SIZE_MB"
...

common/common.go:   EnvAppConfigPath = "ARGOCD_APP_CONF_PATH"
common/common.go:   EnvControllerReplicas = "ARGOCD_CONTROLLER_REPLICAS"
common/common.go:   EnvControllerShard = "ARGOCD_CONTROLLER_SHARD"
common/common.go:   EnvEnableGRPCTimeHistogramEnv = "ARGOCD_ENABLE_GRPC_TIME_HISTOGRAM"
common/common.go:   EnvGitAttemptsCount = "ARGOCD_GIT_ATTEMPTS_COUNT"
common/common.go:   EnvGitRetryDuration = "ARGOCD_GIT_RETRY_DURATION"
common/common.go:   EnvGitRetryFactor = "ARGOCD_GIT_RETRY_FACTOR"
common/common.go:   EnvGitRetryMaxDuration = "ARGOCD_GIT_RETRY_MAX_DURATION"
common/common.go:   EnvGitSubmoduleEnabled = "ARGOCD_GIT_MODULES_ENABLED"
common/common.go:   EnvGithubAppCredsExpirationDuration = "ARGOCD_GITHUB_APP_CREDS_EXPIRATION_DURATION"
common/common.go:   EnvGnuPGHome = "ARGOCD_GNUPGHOME"
common/common.go:   EnvHelmIndexCacheDuration = "ARGOCD_HELM_INDEX_CACHE_DURATION"
common/common.go:   EnvLogFormat = "ARGOCD_LOG_FORMAT"
common/common.go:   EnvLogLevel = "ARGOCD_LOG_LEVEL"
common/common.go:   EnvMaxCookieNumber = "ARGOCD_MAX_COOKIE_NUMBER"
common/common.go:   EnvPauseGenerationAfterFailedAttempts = "ARGOCD_PAUSE_GEN_AFTER_FAILED_ATTEMPTS"
common/common.go:   EnvPauseGenerationMinutes = "ARGOCD_PAUSE_GEN_MINUTES"
common/common.go:   EnvPauseGenerationRequests = "ARGOCD_PAUSE_GEN_REQUESTS"
common/common.go:   EnvPluginSockFilePath = "ARGOCD_PLUGINSOCKFILEPATH"
common/common.go:   EnvVarRBACDebug = "ARGOCD_RBAC_DEBUG"
common/common.go:   EnvVarSSHDataPath = "ARGOCD_SSH_DATA_PATH"
common/common.go:   EnvVarSSODebug = "ARGOCD_SSO_DEBUG"
common/common.go:   EnvVarTLSDataPath = "ARGOCD_TLS_DATA_PATH"
common/common.go:   EnvWatchAPIBufferSize = "ARGOCD_WATCH_API_BUFFER_SIZE"
...

util/cache/cache.go:    envRedisPassword = "REDIS_PASSWORD"
...

reposerver/cache/cache.go:  cmd.Flags().DurationVar(&repoCacheExpiration, "repo-cache-expiration", env.ParseDurationFromEnv("ARGOCD_REPO_CACHE_EXPIRATION", 24*time.Hour, 0, math.MaxInt64), "Cache expiration for repo state, incl. app lists, app details, manifest generation, revision meta-data")
reposerver/cache/cache.go:  cmd.Flags().DurationVar(&revisionCacheExpiration, "revision-cache-expiration", env.ParseDurationFromEnv("ARGOCD_RECONCILIATION_TIMEOUT", 3*time.Minute, 0, math.MaxInt64), "Cache expiration for cached revision")
...

cmd/argocd-repo-server/commands/argocd_repo_server.go:  command.Flags().BoolVar(&disableTLS, "disable-tls", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_DISABLE_TLS", false), "Disable TLS on the gRPC endpoint")
cmd/argocd-repo-server/commands/argocd_repo_server.go:  command.Flags().Int64Var(&parallelismLimit, "parallelismlimit", int64(env.ParseNumFromEnv("ARGOCD_REPO_SERVER_PARALLELISM_LIMIT", 0, 0, math.MaxInt32)), "Limit on number of concurrent manifests generate requests. Any value less the 1 means no limit.")
cmd/argocd-repo-server/commands/argocd_repo_server.go:  command.Flags().StringVar(&cmdutil.LogFormat, "logformat", env.StringFromEnv("ARGOCD_REPO_SERVER_LOGFORMAT", "text"), "Set the logging format. One of: text|json")
cmd/argocd-repo-server/commands/argocd_repo_server.go:  command.Flags().StringVar(&cmdutil.LogLevel, "loglevel", env.StringFromEnv("ARGOCD_REPO_SERVER_LOGLEVEL", "info"), "Set the logging level. One of: debug|info|warn|error")

among other environment variables too many to list here.

This is also:

test/e2e/fixture/fixture.go:    EnvAdminPassword = "ARGOCD_E2E_ADMIN_PASSWORD"

but that looks like something only for tests and not what you want, so @lucasff think you'll have to stick with ARGOCD_AUTH_TOKEN.

Since I don't have a thorough experience with all the environment variables, I'd rather limit this PR to the ones I know and merge this so users can actually find it in the current documentation.

@crenshaw-dev
Copy link
Member

@HariSekhon yeah documenting the env vars is tricky, because where they get used depends a lot on context. Many of these are specific to running the CLI to start an api server or controller or repo server.

This is a good start, 'cause it's focused on env vars that generically make sense for all CLI operations.

@crenshaw-dev crenshaw-dev merged commit d4c277b into argoproj:master Jun 13, 2022
@crenshaw-dev
Copy link
Member

Cherry-picked onto 2.4 (I'm trying to be more aggressive about cherry-picking docs-only PRs - they're useful and virtually zero risk.)

@crenshaw-dev crenshaw-dev added type:docs cherry-pick/2.4 Candidate for cherry picking into the 2.4 release branch labels Jun 13, 2022
crenshaw-dev added a commit that referenced this pull request Jun 13, 2022
* added environment variables page

Signed-off-by: Hari Sekhon <[email protected]>

* added Environment Variables page to User Guide

Signed-off-by: Hari Sekhon <[email protected]>

* reformatted table cells as multiline for clarity

Signed-off-by: Hari Sekhon <[email protected]>

* fixed typo

Co-authored-by: Michael Crenshaw <[email protected]>
Signed-off-by: Michael Crenshaw <[email protected]>
@HariSekhon HariSekhon deleted the environment-variable-documentation branch June 13, 2022 15:00
@lucasff
Copy link

lucasff commented Jun 18, 2022

@HariSekhon thanks a lot for doing that! I ended up using manually assigned env vars to run argocd login on my GitHub Actions workflows ;)

@HariSekhon
Copy link
Contributor Author

@lucasff you're welcome. Btw if it's public, please post a link as I'm always interested in seeing how other people solve CI/CD as I do a lot of this work myself too, and have a couple repos you might find interesting for Jenkins and GitHub-Actions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick/2.4 Candidate for cherry picking into the 2.4 release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants