diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d0d0982745ac95edadccfef823ac0931c6a5e39e..369576142f716feb3677c4f158a7ea0543f8d318 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -124,7 +124,7 @@ test:
     SERVICE_PORT_2376_TCP_PORT: 2375
   stage: test
   image: $CI_REGISTRY_IMAGE_BASE
-  needs: ["cert"]
+  needs: [cert]
   script:
       - *env
       - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
@@ -210,6 +210,9 @@ cert:
   tags: [docker]
   stage: cert
   image: $CI_REGISTRY_IMAGE
+  needs:
+    - job: build-testenv
+      optional: true
   artifacts:
     paths:
       - .docker/cert/
@@ -222,7 +225,9 @@ style:
   tags: [docker]
   stage: style
   image: $CI_REGISTRY_IMAGE
-  needs: []
+  needs:
+    - job: build-testenv
+      optional: true
   script:
       - autopep8 -r --diff --exit-code .
   allow_failure: true