Skip to content

[ISSUES-3699] Initial implementation for external variables

What does this MR do?

This MR provides the initial implementation for fetching external variables from a bring-your-own HTTP service.

The new ExternalVariablesClient is a field to a Build. This client has a GetExternalVariables() function which is called in build.GetAllVariables() to fetch external variables from the HTTP service at the start of the build after starting the executor (the executor makes the first call). Any failures from this process or from the external service will log the error as a warning in the runner logs, print a WARNING: Preparation of external variables failed: (...) in the build trace, and continue the build. Build failure depends on how the build handles/uses the external variables. For example, an echo of an unset environment variable will not fail the build, but if it is used as part of a command or as a credential, then the build should fail (this is also described in external-variables.md).

Notes:

  • newHTTPTransport() is a modified version of docker_helpers.newHTTPTransport()
  • configureTransport() is a copy of docker_helpers.configureTransport(). This includes the same transport timeouts.
  • There is a TODO comment for adding request retries when POSTing to the external service. This is not a blocker since the build can be retried (as with other runner system failures).

Please see documentation for feature usage:

Why was this MR needed?

See #3699 (closed).

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

#3699 (closed)

Edited by Ailsa Chiu

Merge request reports