From 743c3a8e575b20398e982f2874c2ae841e7ec01d Mon Sep 17 00:00:00 2001
From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
Date: Tue, 2 Mar 2021 16:27:18 +0100
Subject: [PATCH] Split off .stage from check-layer job

The .stage job can be shared between layer-check and the upcoming
bitbake parse job.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
---
 .ostc-ci/gitlab-ci.yml | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/.ostc-ci/gitlab-ci.yml b/.ostc-ci/gitlab-ci.yml
index 4bb29bf..8fa3e51 100644
--- a/.ostc-ci/gitlab-ci.yml
+++ b/.ostc-ci/gitlab-ci.yml
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-check-layer:
+.stage:
   stage: test
   image:
     name: registry.ostc-eu.org/ostc/containers/ostc-builder:latest
@@ -40,7 +40,7 @@ check-layer:
     # https://git.ostc-eu.org/OSTC/infrastructure/ostc-manifest-mirror/-/issues/2
     - git clone --depth 1 --branch dunfell git://git.openembedded.org/meta-openembedded.git
 
-  script:
+  script: &stage-do
     # Reload the value of SCRATCH_DIR set in the before_script phase. Those run
     # in separate shell processes and do not share environment variables.
     - SCRATCH_DIR="$(cat "$CI_PROJECT_DIR"/.scratch-dir-name)"
@@ -51,8 +51,6 @@ check-layer:
     # devtool and other related tools.
     # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
-    # Run yocto-layer-check with the meta-python and meta-oe layers as dependencies.
-    - yocto-check-layer --dependency "$SCRATCH_DIR"/meta-openembedded/meta-python/ "$SCRATCH_DIR"/meta-openembedded/meta-oe/ --with-software-layer-signature-check --debug "$CI_PROJECT_DIR"
 
   after_script:
     # Reload the value of SCRATCH_DIR set in the before_script phase.
@@ -60,3 +58,10 @@ check-layer:
     # Clean up after ourselves.
     - rm -f "$CI_PROJECT_DIR"/.scratch-dir-name
     - rm -rf "$SCRATCH_DIR"
+
+check-layer:
+  extends: .stage
+  script:
+    - *stage-do
+    # Run yocto-layer-check with the meta-python and meta-oe layers as dependencies.
+    - yocto-check-layer --dependency "$SCRATCH_DIR"/meta-openembedded/meta-python/ "$SCRATCH_DIR"/meta-openembedded/meta-oe/ --with-software-layer-signature-check --debug "$CI_PROJECT_DIR"
-- 
GitLab