[cipd] Add NewClientFromEnv to simplify creating clients.

I noticed that cipd.NewClient is often misused in infra.git codebase.
It almost always needs to be paired with ClientOptions.LoadFromEnv to
pick up env vars such as CIPD_CACHE_DIR, and it is almost always
forgotten.

NewClientFromEnv makes it easier to construct cipd.Client that
looks more like `cipd` CLI's internal client (which what people
usually want).

Whether directly linking to CIPD client library (vs calling `cipd`
binary) is a good idea is a separate discussion, but there's a plenty
of incomplete calls to cipd.NewClient already and this CL will be
used to fix them.

BUG=1310363
R=iannucci@chromium.org, yiwzhang@google.com

Change-Id: I8b18c84aa503258bdcb162577b12535038e2901a
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-go/+/3717105
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
3 files changed
tree: 567f4ea56e5b11f806870c038c788eab0e85f397
  1. appengine/
  2. auth/
  3. auth_service/
  4. build/
  5. buildbucket/
  6. casviewer/
  7. cipd/
  8. client/
  9. cmdrunner/
  10. common/
  11. config/
  12. cv/
  13. deploy/
  14. examples/
  15. gae/
  16. gce/
  17. grpc/
  18. hacks/
  19. hardcoded/
  20. led/
  21. logdog/
  22. luci_notify/
  23. lucicfg/
  24. lucictx/
  25. luciexe/
  26. mailer/
  27. milo/
  28. mmutex/
  29. provenance/
  30. resultdb/
  31. scheduler/
  32. scripts/
  33. server/
  34. starlark/
  35. swarming/
  36. tokenserver/
  37. tools/
  38. vpython/
  39. web/
  40. .gitallowed
  41. .gitattributes
  42. .golangci.yml
  43. AUTHORS
  44. codereview.settings
  45. CONTRIBUTING.md
  46. CONTRIBUTORS
  47. go.mod
  48. go.sum
  49. LICENSE
  50. OWNERS
  51. PRESUBMIT.py
  52. README.md
  53. tools.go
  54. WATCHLISTS
README.md

luci-go: LUCI services and tools in Go

GoDoc

Installing

LUCI Go code is meant to be worked on from an Chromium infra.git checkout, which enforces packages versions and Go toolchain version. First get fetch via depot_tools.git then run:

fetch infra
cd infra/go
eval `./env.py`
cd src/go.chromium.org/luci

Contributing

Contributing uses the same flow as Chromium contributions.