[gnome-build-meta/valentindavid/gnome-os-ostree: 14/14] Build GNOME OS OSTree in CI



commit 0d2699c49ca6463e579d57e3cced78eff2acfb30
Author: Valentin David <valentin david codethink co uk>
Date:   Fri Dec 13 11:39:14 2019 +0100

    Build GNOME OS OSTree in CI

 .gitlab-ci.yml                | 63 +++++++++++++++++++++-------
 Makefile                      | 96 -------------------------------------------
 elements/vm/image.bst         |  5 +--
 elements/vm/ostree-config.bst |  4 --
 elements/vm/repo.bst          |  3 --
 project.conf                  |  2 +
 6 files changed, 51 insertions(+), 122 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2b3c5d9a..f7d8c12e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,6 +22,8 @@ stages:
 - flatpak
 - finish_flatpak
 - reports
+- publish_ostree
+- build_bootable_image
 
 default:
   before_script:
@@ -85,20 +87,7 @@ default:
     if [ "${ARCH}" == "x86_64" ]; then
         ${BST} build openh264-extension.bst:flatpak-repo.bst
 
-        #
-        # Don't try to push the resulting artifacts, the huge image doesnt
-        # work well with the artifact cache right now.
-        #
-        ${BST_NO_PUSH} --max-jobs $(( $(nproc) / 4 )) -o arch "${ARCH}" build vm/desktop-vm-image-x86_64.bst
-
-        # Checkout the image for the gitlab artifact.
-        #
-        # Accept using hardlinks here as the upload will not
-        # corrupt the local artifact cache.
-        #
-        ${BST} checkout --hardlinks vm/desktop-vm-image-x86_64.bst image
-        qemu-img convert -f raw -O qcow2 image/sda.img image/sda.qcow2
-        rm image/sda.img
+        ${BST} --max-jobs $(( $(nproc) / 4 )) -o arch "${ARCH}" build vm/repo.bst
     fi
 
   # Store all the downloaded git repos and tarballs in the cache.
@@ -199,7 +188,7 @@ track:
   stage: track
   script:
   - 'sed -i "s/track-tags: False/track-tags: ${BST_TRACK_TAGS}/" project.conf'
-  - ${BST} track --deps all core.bst flatpak-runtimes.bst
+  - ${BST} track --deps all core.bst flatpak-runtimes.bst vm/repo.bst core-deps/ostree.bst 
core-deps/ostree.bst
   retry: 2
   # only run on branches targeting master
   only:
@@ -321,3 +310,47 @@ cve_report:
   only:
   - master
   - /^gnome-\d-\d\d$/
+
+publish_ostree_x86_64:
+  stage: publish_ostree
+  dependencies: [track]
+  script:
+  - |
+    if [ -n "${GBM_SSH_KEY}" ]; then
+      mkdir -p ~/.ssh
+      rm -f ~/.ssh/id_rsa
+      touch ~/.ssh/id_rsa
+      chmod 600 ~/.ssh/id_rsa
+      echo "${GBM_SSH_KEY}" | base64 --decode >>~/.ssh/id_rsa
+      cat >~/.ssh/known_hosts <<EOF
+    |1|aok+cG86yan2cP42RSwCy2E7X+8=|KBvi7XIpU/CgWzQvRLOVQ+c7+50= ecdsa-sha2-nistp256 
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAGixpYwAfvRyHOlqpKnrpo3iG5zPjQNL0hcay90SlNMfZ4W6+QUoFTZ/rQXDQFbBrOgTXzFDEQxKxxo350n6dw=
+    EOF
+    fi
+
+  - OSTREE_BRANCH="gnome-os-${FLATPAK_BRANCH}-${ARCH}"
+  - BUILD_BRANCH="${OSTREE_BRANCH}-${CI_COMMIT_SHA}"
+  - ${BST} build vm/repo.bst
+  - ${BST} checkout --hardlinks vm/repo.bst import-repo
+  - ostree --repo=import-repo/ostree/repo refs -A --create="${BUILD_BRANCH}" "${OSTREE_BRANCH}"
+  - ostree-push --repo=import-repo/ostree/repo "${GBM_PUSH_ADDRESS}:incoming-repo" "${BUILD_BRANCH}"
+  - ssh "${GBM_PUSH_ADDRESS}" commit "${BUILD_BRANCH}" "${OSTREE_BRANCH}"
+  variables:
+    ARCH: x86_64
+  only:
+  - master
+  # For testing only:
+  - valentindavid/gnome-os-ostree
+
+build_bootable_image_x86_64:
+  stage: build_bootable_image
+  dependencies: [track]
+  script:
+  - ${BST} -o arch "${ARCH}" track vm/image.bst
+  - ${BST} --max-jobs $(( $(nproc) / 4 )) -o arch "${ARCH}" build vm/image.bst
+  # TODO: Upload it somewhere.
+  variables:
+    ARCH: x86_64
+  only:
+  - master
+  # For testing only:
+  - valentindavid/gnome-os-ostree
diff --git a/elements/vm/image.bst b/elements/vm/image.bst
index f902b52b..73935bb8 100644
--- a/elements/vm/image.bst
+++ b/elements/vm/image.bst
@@ -17,9 +17,6 @@ variables:
   - arch == "aarch64":
       linux-root: B921B045-1DF0-41C3-AF44-4C6F280D3FAE
 
-  (@):
-  - ostree-config.yml
-
   sysroot: "%{build-root}/sysroot"
 
 environment:
@@ -106,6 +103,6 @@ config:
 sources:
 - kind: ostree_mirror
   gpg: gnome.gpg
-  path: ostree-repo
+  url: https://nightly.gnome.org/
   match: 'gnome-os-*'
   directory: source-repo
diff --git a/elements/vm/ostree-config.bst b/elements/vm/ostree-config.bst
index 4e92a630..62fe0b8f 100644
--- a/elements/vm/ostree-config.bst
+++ b/elements/vm/ostree-config.bst
@@ -8,10 +8,6 @@ runtime-depends:
 - freedesktop-sdk.bst:components/systemd.bst
 - core-deps/ostree.bst
 
-variables:
-  (@):
-  - ostree-config.yml
-
 config:
   build-commands:
   - |
diff --git a/elements/vm/repo.bst b/elements/vm/repo.bst
index 7235cb0f..90e8bea2 100644
--- a/elements/vm/repo.bst
+++ b/elements/vm/repo.bst
@@ -9,9 +9,6 @@ build-depends:
 variables:
   uuidnamespace: aea54278-2587-4075-ae67-8688ace4ce3d
 
-  (@):
-  - ostree-config.yml
-
 environment:
   OSTREE_REPO: "%{install-root}/ostree/repo"
 
diff --git a/project.conf b/project.conf
index 3d1a6ecf..97ee74e9 100644
--- a/project.conf
+++ b/project.conf
@@ -205,6 +205,8 @@ shell:
 
 variables:
   branch: master
+  ostree-remote-url: "https://nightly.gnome.org/gnomeos/repo";
+  ostree-branch: "gnome-os-%{branch}-%{arch}"
   gcc_arch: "%{arch}"
   abi: "gnu"
   gcc_triplet: "%{gcc_arch}-linux-%{abi}"


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