[gnome-build-meta/abderrahim/ci-improvements: 1/5] .gitlab-ci.yml: only install bst/flat-manager in jobs that need them



commit 14aea00d5f374991767b952c1d646aee3fc48465
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Fri Apr 19 17:08:06 2019 +0100

    .gitlab-ci.yml: only install bst/flat-manager in jobs that need them

 .gitlab-ci.yml | 81 ++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 50 insertions(+), 31 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6f708d6e..6db4ab41 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,28 +24,28 @@ stages:
 
 
 before_script:
-  # Use specific version of BuildStream
-  - git clone https://gitlab.com/BuildStream/buildstream.git
-  - git -C buildstream/ checkout $BST_SHA
-  - pip3 install buildstream/
-
-  # install bst-external nedded for the flatpak_image plugin
-  - git clone https://gitlab.com/BuildStream/bst-external.git
-  - git -C bst-external/ checkout $BST_EXTERNAL_SHA
-  - pip3 install bst-external/
-
-  # Ensure the log directory exists
-  - mkdir -p logs
-
-  # Setup certificate for pushing to the cache
   - |
-    if [ -n "$GITLAB_CAS_PUSH_CERT" ]; then
-       echo "$GITLAB_CAS_PUSH_CERT" > client.crt
-       echo "$GITLAB_CAS_PUSH_KEY" > client.key
-    fi
-
-    cat >> build.conf << EOF
-
+    if [ -n "$NEED_BST"]; then
+      # Use specific version of BuildStream
+      git clone https://gitlab.com/BuildStream/buildstream.git
+      git -C buildstream/ checkout $BST_SHA
+      pip3 install buildstream/
+
+      # install bst-external nedded for the flatpak_image plugin
+      git clone https://gitlab.com/BuildStream/bst-external.git
+      git -C bst-external/ checkout $BST_EXTERNAL_SHA
+      pip3 install bst-external/
+
+      # Ensure the log directory exists
+      mkdir -p logs
+
+      # Setup certificate for pushing to the cache
+      if [ -n "$GITLAB_CAS_PUSH_CERT" ]; then
+        echo "$GITLAB_CAS_PUSH_CERT" > client.crt
+        echo "$GITLAB_CAS_PUSH_KEY" > client.key
+      fi
+
+      cat >> build.conf << EOF
     projects:
       gnome:
         artifacts:
@@ -55,18 +55,22 @@ before_script:
           push: true
     EOF
 
-  # flat-manager-client to push to flathub
-  - git clone https://github.com/flatpak/flat-manager
+    fi
 
+  # flat-manager-client to push to flathub
   - |
-    if [ "$FLATPAK_BRANCH" = master ] && [ -n "$NIGHTLY_REPO_TOKEN" ]; then
-      export REPO_TOKEN=$NIGHTLY_REPO_TOKEN
-      export FLAT_MANAGER_SERVER=https://gbm.gnome.org/
-      export FLAT_MANAGER_REPO=nightly
-    elif [ "$FLATPAK_BRANCH" != master ] && [ -n "$FLATHUB_REPO_TOKEN" ]; then
-      export REPO_TOKEN=$FLATHUB_REPO_TOKEN
-      export FLAT_MANAGER_SERVER=https://hub.flathub.org/
-      export FLAT_MANAGER_REPO=stable
+    if [ -n "$NEED_FLATMGR" ]; then
+      git clone https://github.com/flatpak/flat-manager
+
+      if [ "$FLATPAK_BRANCH" = master ] && [ -n "$NIGHTLY_REPO_TOKEN" ]; then
+        export REPO_TOKEN=$NIGHTLY_REPO_TOKEN
+        export FLAT_MANAGER_SERVER=https://gbm.gnome.org/
+        export FLAT_MANAGER_REPO=nightly
+      elif [ "$FLATPAK_BRANCH" != master ] && [ -n "$FLATHUB_REPO_TOKEN" ]; then
+        export REPO_TOKEN=$FLATHUB_REPO_TOKEN
+        export FLAT_MANAGER_SERVER=https://hub.flathub.org/
+        export FLAT_MANAGER_REPO=stable
+      fi
     fi
 
 #
@@ -76,6 +80,8 @@ before_script:
 .build-template:
   stage: build
   dependencies: [track]
+  variables:
+    NEED_BST: true
   script:
     - ${BST} -o arch "${ARCH}" build core.bst flatpak-runtimes.bst platform-manifest.bst sdk-manifest.bst
   # Store all the downloaded git repos and tarballs in the cache.
@@ -94,6 +100,9 @@ before_script:
 .flatpak-template:
   stage: flatpak
   dependencies: [track, flatpak-prepare]
+  variables:
+    NEED_BST: true
+    NEED_FLATMGR: true
   script:
     - ${BST} -o arch "${ARCH}" build flatpak-runtimes.bst
 
@@ -150,6 +159,8 @@ before_script:
 track:
   <<: *x86_64
   stage: track
+  variables:
+    NEED_BST: true
   script:
     - ${BST} track --deps all core.bst flatpak-runtimes.bst
   retry: 2
@@ -185,6 +196,8 @@ build-gnome-core-arm:
 flatpak-prepare:
   stage: prepare_flatpak
   dependencies: []
+  variables:
+    NEED_FLATMGR: true
   script:
     - flat-manager/flat-manager-client create $FLAT_MANAGER_SERVER $FLAT_MANAGER_REPO > build.txt
   artifacts:
@@ -219,6 +232,8 @@ flatpak-arm:
 flatpak-finish:
   stage: finish_flatpak
   dependencies: [flatpak-prepare]
+  variables:
+    NEED_FLATMGR: true
   script:
     - flat-manager/flat-manager-client commit --wait $(cat build.txt)
     - flat-manager/flat-manager-client publish --wait $(cat build.txt)
@@ -233,6 +248,8 @@ flatpak-finish:
 
 flatpak-finish-failed:
   stage: finish_flatpak
+  variables:
+    NEED_FLATMGR: true
   dependencies: [flatpak-prepare]
   script:
     - flat-manager/flat-manager-client purge $(cat build.txt)
@@ -250,6 +267,8 @@ cve_report:
   <<: *x86_64
   stage: reports
   dependencies: [track]
+  variables:
+    NEED_BST: true
   script:
     - pip3 install --user lxml
 


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