[gnome-build-meta/abderrahim/image-job: 2/2] .gitlab-ci.yml: split building the VM image into its own jobs



commit a0125164da6a42b6145fe8e5597679d0fb9e1ce1
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Mon Apr 6 16:50:10 2020 +0100

    .gitlab-ci.yml: split building the VM image into its own jobs
    
    This allows to make it run automatically only on master and stable
    branches
    
    Also tweak the time artifacts are kept

 .gitlab-ci.yml | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6090f583..a79c960a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,6 +18,7 @@ variables:
 stages:
 - track
 - build
+- image
 - prepare_flatpak
 - flatpak
 - finish_flatpak
@@ -84,9 +85,6 @@ default:
     # Only run this build for x86_64, instead of building it somewhere else
     if [ "${ARCH}" == "x86_64" ]; then
         ${BST} build openh264-extension.bst:flatpak-repo.bst
-
-        ${BST_NO_PUSH} --max-jobs $(( $(nproc) / 4 )) -o arch "${ARCH}" build vm/image.bst
-        ${BST_NO_PUSH} -o arch "${ARCH}" checkout --hardlinks vm/image.bst image
     fi
 
   # Store all the downloaded git repos and tarballs in the cache.
@@ -96,11 +94,27 @@ default:
     paths:
     - "${XDG_CACHE_HOME}/buildstream/sources/"
   # Store artifacts so we can inspect build failures
-  artifacts: &logging-artifacts
+  artifacts:
+    when: always
+    paths:
+    - logs
+    expire_in: '1 week'
+
+.vm-image-template:
+  stage: image
+  script:
+    - ${BST_NO_PUSH} --max-jobs $(( $(nproc) / 4 )) -o arch "${ARCH}" build vm/image.bst
+    - ${BST_NO_PUSH} -o arch "${ARCH}" checkout --hardlinks vm/image.bst image
+  rules:
+  - if: $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^gnome-\d-\d\d$/
+    when: on_success
+  - if: $CI_MERGE_REQUEST_ID == null
+    when: manual
+  cache: *bst-cache
+  artifacts:
     when: always
     paths:
     - logs
-    - project.refs
     - image
     expire_in: '2 days'
 
@@ -191,7 +205,9 @@ track:
   rules:
   - if: $FLATPAK_BRANCH == 'master' && $CI_MERGE_REQUEST_ID == null
   cache: *bst-cache
-  artifacts: *logging-artifacts
+  artifacts:
+    paths:
+    - project.refs
 
 
 build-gnome-core-x86_64:
@@ -211,6 +227,13 @@ build-gnome-core-arm:
   <<: *arm
 
 
+vm-image-x86_64:
+  extends: .vm-image-template
+  # run as soon as the x86_64 build job is done, don't wait for other arches
+  needs: [ build-gnome-core-x86_64 ]
+  <<: *x86_64
+
+
 flatpak-prepare:
   stage: prepare_flatpak
   dependencies: []


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]