Skip to content

Add support for mock server sidecar component

George Koltsov requested to merge andrey-update-mock-ports-hosts into master

What does this MR do and why?

This change introduces ability to redirect all calls to https://api.github.com to mock instance in Import scenario type.

Changes

  • Adds ability to pass additional hosts to started docker containers
  • Adds mock server component with tls capability
  • Improves tls cert mounts, making it work for local and remote docker contexts
  • Adds generic alpine helper component which can be used to populate volumes or any other kind of action which should be executed before target component starts

Notes

  • Certs will have to be regenerated if mock service component needs to support additional hosts when ssl is enabled. Following commands can be used where subjectAltName should contain additional domains:
$ cd tls_certificates/smocker
$ openssl req -new -key smocker.key -out smocker.csr -subj "/C=US/ST=California/L=San Francisco/O=Gitlab Authors/CN=api.github.com" -addext "subjectAltName=DNS:api.github.com,DNS:smocker.test"
$ openssl x509 -req -days 3650 -in smocker.csr -CA ../authority/ca.crt -CAkey ../authority/ca.key -set_serial 1 -out smocker.crt -extfile <(printf "subjectAltName=DNS:api.github.com,DNS:smocker.test")
  • This change also properly fixes mounting tls certs when docker is using remote context where folders on the host running gitlab-qa command will not be available in the docker host (removes previous workaround to copy tls certs to temporary directory which is shared between hosts which only works on in CI where dind container shares project folder).

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to: https://gitlab.com/gitlab-org/gitlab/-/issues/383886

Edited by George Koltsov

Merge request reports