diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 165b33a5a2a9ca4490b0171eec95d4fc7c4ef1c4..0e359c8b315319e33616616c84b2b98f6a808088 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,7 +10,8 @@ tests:
       - _opam
   script:
   - if [ ! -d _opam ]; then echo "no local switch in the CI cache, we setup a new switch"; opam switch create --yes --no-install . ocaml-base-compiler.4.13.1; fi
-  - eval $(opam env)
+  - opam switch 4.13
+  - eval $(opam env --switch=4.13 --set-switch)
   - opam switch
   - sudo apt-get update
   - sudo apt install -y protobuf-compiler