[gvfs/wip/oholy/gnome-build-meta] ci: Build images over CI



commit e80a331c405dd0d7b877e8b479fb8da474c7404d
Author: Ondrej Holy <oholy redhat com>
Date:   Tue Jan 15 13:01:59 2019 +0100

    ci: Build images over CI

 .gitlab-ci.yml           | 44 ++++++++++++++++++++++++++++----------------
 .gitlab-ci/Dockerfile    | 12 +++++++++++-
 .gitlab-ci/run-docker.sh | 14 --------------
 3 files changed, 39 insertions(+), 31 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e9ff2128..d4440101 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,28 +1,40 @@
+variables:
+    NAME: "fedora"
+
+stages:
+    - build
+    - image
+
 fedora:
     stage: build
-    image: registry.gitlab.gnome.org/gnome/gvfs/master:v4
+    image: "$CI_REGISTRY_IMAGE/$NAME"
     script:
         - meson build --werror
         - ninja -C build
+    except:
+        - triggers
 
 gnome-build-meta:
     stage: build
-    image: buildstream/buildstream-fedora:master-123-abef70fe
-    cache:
-        key: bst
-        paths:
-            - "/root/.cache/buildstream"
-    before_script:
-        - pip3 uninstall -y buildstream
-        - git clone https://gitlab.com/BuildStream/buildstream.git
-        - git -C buildstream/ checkout 10abe77fe8d77385d86f225b503d9185f4ef7f3a
-        - pip3 install buildstream/
-        - git clone https://gitlab.com/BuildStream/bst-external.git
-        - git -C bst-external/ checkout 0.8.0-0-g762ea216b751bf89ac15350e1cb98542963bbf33
-        - pip3 install bst-external/
-        - git clone --depth 1 https://gitlab.gnome.org/GNOME/gnome-build-meta.git
+    image: "$CI_REGISTRY_IMAGE/$NAME"
     script:
         - cd gnome-build-meta
-        - bst build --track-all sdk/gvfs.bst
         - bst workspace open --no-checkout sdk/gvfs.bst ..
         - bst build sdk/gvfs.bst
+    except:
+        - triggers
+
+docker:
+    stage: image
+    image: docker:latest
+    services:
+        - docker:dind
+    script:
+        - docker build --tag "$CI_REGISTRY_IMAGE/$NAME" gitlab-ci/Dockerfile
+        - docker run --privileged --name $NAME "$CI_REGISTRY_IMAGE/$NAME" bash -c "cd gnome-build-meta && 
bst build --track-all sdk/gvfs.bst"
+        - docker commit $NAME "$CI_REGISTRY_IMAGE:$NAME"
+        - docker tag "$CI_REGISTRY_IMAGE/$NAME" "$CI_REGISTRY_IMAGE/$NAME:v$CI_JOB_ID"
+        - docker login ${CI_REGISTRY} -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD}
+        - docker push "$CI_REGISTRY_IMAGE/$NAME"
+    only:
+        - triggers
\ No newline at end of file
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
index 73d876cf..8089c7c4 100644
--- a/.gitlab-ci/Dockerfile
+++ b/.gitlab-ci/Dockerfile
@@ -11,4 +11,14 @@ RUN dnf install -y --best elfutils-libelf-devel gamin-devel gcc gcc-c++ gdbm get
  && ninja -C _build \
  && ninja -C _build install \
  && cd .. \
- && rm -rf glib
\ No newline at end of file
+ && rm -rf glib
+
+RUN git clone https://gitlab.com/BuildStream/buildstream.git \
+ && git -C buildstream/ checkout 10abe77fe8d77385d86f225b503d9185f4ef7f3a \
+ && pip3 install buildstream/ \
+ && git clone https://gitlab.com/BuildStream/bst-external.git \
+ && git -C bst-external/ checkout 0.8.0-0-g762ea216b751bf89ac15350e1cb98542963bbf33 \
+ && pip3 install bst-external/ \
+ && git clone --depth 1 https://gitlab.gnome.org/GNOME/gnome-build-meta.git \
+ && cd gnome-build-meta \
+ && bst build --track-all sdk/gvfs.bst


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