[gnome-build-meta/valentindavid/oci: 5/5] Build OCI images




commit a2f53b90e4c8099fc9582c114f34fae26bba18b7
Author: Valentin David <me valentindavid com>
Date:   Sun Oct 10 15:05:18 2021 +0200

    Build OCI images
    
    Part of #350

 .gitlab-ci.yml                                |  2 +-
 elements/oci/debug.bst                        | 43 +++++++++++++++++++++++++++
 elements/oci/layers/debug.bst                 | 11 +++++++
 elements/oci/layers/platform-init-scripts.bst |  7 +++++
 elements/oci/layers/platform.bst              | 14 +++++++++
 elements/oci/layers/sdk-init-scripts.bst      |  7 +++++
 elements/oci/layers/sdk-stack.bst             | 21 +++++++++++++
 elements/oci/layers/sdk.bst                   | 12 ++++++++
 elements/oci/layers/toolbox-init-scripts.bst  |  7 +++++
 elements/oci/layers/toolbox-stack.bst         | 21 +++++++++++++
 elements/oci/layers/toolbox.bst               | 13 ++++++++
 elements/oci/platform.bst                     | 40 +++++++++++++++++++++++++
 elements/oci/sdk.bst                          | 43 +++++++++++++++++++++++++++
 project.conf                                  |  9 ++++++
 14 files changed, 249 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 271e35a6f..c7921bad3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -39,7 +39,7 @@ default:
     optional: true
   interruptible: true
   script:
-  - TARGETS=(core.bst flatpak-runtimes.bst flatpak-platform-extensions.bst flatpak/platform-manifest.bst 
flatpak/sdk-manifest.bst)
+  - TARGETS=(core.bst flatpak-runtimes.bst flatpak-platform-extensions.bst flatpak/platform-manifest.bst 
flatpak/sdk-manifest.bst oci/debug.bst oci/platform.bst oci/sdk.bst)
 
   - |
     case "${ARCH}" in
diff --git a/elements/oci/debug.bst b/elements/oci/debug.bst
new file mode 100644
index 000000000..1304bd08a
--- /dev/null
+++ b/elements/oci/debug.bst
@@ -0,0 +1,43 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:oci/oci-builder.bst
+- oci/sdk.bst
+- oci/layers/debug.bst
+- oci/layers/sdk-init-scripts.bst
+
+config:
+  layout:
+  - element: oci/oci-builder.bst
+    destination: /
+  - element: oci/layers/debug.bst
+    destination: /layer
+  - element: oci/sdk.bst
+    destination: /parent
+  - element: oci/layers/sdk-init-scripts.bst
+    destination: /
+
+  commands:
+  - |
+    if [ -d /initial_scripts ]; then
+      for i in /initial_scripts/*; do
+        "${i}" /layer
+      done
+    fi
+
+  - |
+    cd "%{install-root}"
+    build-oci <<EOF
+    mode: oci
+    gzip: False
+    images:
+    - os: linux
+      architecture: "%{go-arch}"
+      parent:
+        image: /parent
+      layer: /layer
+      comment: "Import debuginfo files from GNOME SDK"
+      config:
+        Labels:
+          'com.github.containers.toolbox': 'true'
+    EOF
diff --git a/elements/oci/layers/debug.bst b/elements/oci/layers/debug.bst
new file mode 100644
index 000000000..d553e68a8
--- /dev/null
+++ b/elements/oci/layers/debug.bst
@@ -0,0 +1,11 @@
+kind: compose
+
+build-depends:
+- oci/layers/sdk-stack.bst
+
+config:
+  exclude:
+  - locale
+  - extra
+  - static-blocklist
+  - vm-only
diff --git a/elements/oci/layers/platform-init-scripts.bst b/elements/oci/layers/platform-init-scripts.bst
new file mode 100644
index 000000000..2b9ff801f
--- /dev/null
+++ b/elements/oci/layers/platform-init-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- sdk-platform.bst
+
+config:
+  path: /initial_scripts
diff --git a/elements/oci/layers/platform.bst b/elements/oci/layers/platform.bst
new file mode 100644
index 000000000..38acf8f12
--- /dev/null
+++ b/elements/oci/layers/platform.bst
@@ -0,0 +1,14 @@
+kind: compose
+
+build-depends:
+- sdk-platform.bst
+- sdk/os-release.bst
+
+config:
+  exclude:
+  - debug
+  - devel
+  - doc
+  - locale
+  - extra
+  - vm-only
diff --git a/elements/oci/layers/sdk-init-scripts.bst b/elements/oci/layers/sdk-init-scripts.bst
new file mode 100644
index 000000000..4a3b5e2b3
--- /dev/null
+++ b/elements/oci/layers/sdk-init-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- oci/layers/sdk-stack.bst
+
+config:
+  path: /initial_scripts
diff --git a/elements/oci/layers/sdk-stack.bst b/elements/oci/layers/sdk-stack.bst
new file mode 100644
index 000000000..94ac8a27d
--- /dev/null
+++ b/elements/oci/layers/sdk-stack.bst
@@ -0,0 +1,21 @@
+kind: stack
+
+depends:
+- sdk.bst
+- sdk/os-release.bst
+- freedesktop-sdk.bst:components/sudo.bst
+- freedesktop-sdk.bst:components/shadow.bst
+
+public:
+  bst:
+    integration-commands:
+    - groupadd root -r -g 0
+    - useradd root -rm -u 0 -g 0 -d /root
+    - groupadd -r wheel
+    - |
+      cat <<EOF >>/etc/sudoers
+      %wheel ALL=(ALL) NOPASSWD: ALL
+      EOF
+    - mkdir -p /media
+    - mkdir -p /home
+    - touch /etc/machine-id
diff --git a/elements/oci/layers/sdk.bst b/elements/oci/layers/sdk.bst
new file mode 100644
index 000000000..df6546778
--- /dev/null
+++ b/elements/oci/layers/sdk.bst
@@ -0,0 +1,12 @@
+kind: compose
+
+build-depends:
+- oci/layers/sdk-stack.bst
+
+config:
+  exclude:
+  - debug
+  - locale
+  - extra
+  - static-blocklist
+  - vm-only
diff --git a/elements/oci/layers/toolbox-init-scripts.bst b/elements/oci/layers/toolbox-init-scripts.bst
new file mode 100644
index 000000000..64f1cc19e
--- /dev/null
+++ b/elements/oci/layers/toolbox-init-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- oci/layers/toolbox-stack.bst
+
+config:
+  path: /initial_scripts
diff --git a/elements/oci/layers/toolbox-stack.bst b/elements/oci/layers/toolbox-stack.bst
new file mode 100644
index 000000000..94ac8a27d
--- /dev/null
+++ b/elements/oci/layers/toolbox-stack.bst
@@ -0,0 +1,21 @@
+kind: stack
+
+depends:
+- sdk.bst
+- sdk/os-release.bst
+- freedesktop-sdk.bst:components/sudo.bst
+- freedesktop-sdk.bst:components/shadow.bst
+
+public:
+  bst:
+    integration-commands:
+    - groupadd root -r -g 0
+    - useradd root -rm -u 0 -g 0 -d /root
+    - groupadd -r wheel
+    - |
+      cat <<EOF >>/etc/sudoers
+      %wheel ALL=(ALL) NOPASSWD: ALL
+      EOF
+    - mkdir -p /media
+    - mkdir -p /home
+    - touch /etc/machine-id
diff --git a/elements/oci/layers/toolbox.bst b/elements/oci/layers/toolbox.bst
new file mode 100644
index 000000000..e0e9673aa
--- /dev/null
+++ b/elements/oci/layers/toolbox.bst
@@ -0,0 +1,13 @@
+kind: compose
+
+build-depends:
+- oci/layers/toolbox-stack.bst
+
+config:
+  exclude:
+  - debug
+  - doc
+  - locale
+  - extra
+  - static-blocklist
+  - vm-only
diff --git a/elements/oci/platform.bst b/elements/oci/platform.bst
new file mode 100644
index 000000000..6a0891d7f
--- /dev/null
+++ b/elements/oci/platform.bst
@@ -0,0 +1,40 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:oci/oci-builder.bst
+- freedesktop-sdk.bst:oci/platform-oci.bst
+- oci/layers/platform.bst
+- oci/layers/platform-init-scripts.bst
+
+config:
+  layout:
+  - element: oci/oci-builder.bst
+    destination: /
+  - element: oci/layers/platform.bst
+    destination: /layer
+  - element: oci/platform-oci.bst
+    destination: /parent
+  - element: oci/layers/platform-init-scripts.bst
+    destination: /
+
+  commands:
+  - |
+    if [ -d /initial_scripts ]; then
+      for i in /initial_scripts/*; do
+        "${i}" /layer
+      done
+    fi
+
+  - |
+    cd "%{install-root}"
+    build-oci <<EOF
+    mode: oci
+    gzip: False
+    images:
+    - os: linux
+      architecture: "%{go-arch}"
+      parent:
+        image: /parent
+      layer: /layer
+      comment: "Import platform layer from GNOME SDK"
+    EOF
diff --git a/elements/oci/sdk.bst b/elements/oci/sdk.bst
new file mode 100644
index 000000000..9eeecf3b7
--- /dev/null
+++ b/elements/oci/sdk.bst
@@ -0,0 +1,43 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:oci/oci-builder.bst
+- oci/platform.bst
+- oci/layers/sdk.bst
+- oci/layers/sdk-init-scripts.bst
+
+config:
+  layout:
+  - element: oci/oci-builder.bst
+    destination: /
+  - element: oci/layers/sdk.bst
+    destination: /layer
+  - element: oci/platform.bst
+    destination: /parent
+  - element: oci/layers/sdk-init-scripts.bst
+    destination: /
+
+  commands:
+  - |
+    if [ -d /initial_scripts ]; then
+      for i in /initial_scripts/*; do
+        "${i}" /layer
+      done
+    fi
+
+  - |
+    cd "%{install-root}"
+    build-oci <<EOF
+    mode: oci
+    gzip: False
+    images:
+    - os: linux
+      architecture: "%{go-arch}"
+      parent:
+        image: /parent
+      layer: /layer
+      comment: "Import SDK layer from GNOME SDK"
+      config:
+        Labels:
+          'com.github.containers.toolbox': 'true'
+    EOF
diff --git a/project.conf b/project.conf
index 1cbebfc3b..cfc6935e0 100644
--- a/project.conf
+++ b/project.conf
@@ -335,12 +335,21 @@ variables:
   local_flags: ''
 
   (?):
+  - arch == "x86_64":
+      go-arch: "amd64"
   - arch == "i686":
       gcc_arch: "i386"
+      go-arch: "386"
+  - arch == "aarch64":
+      go-arch: "arm64"
   - arch == "arm":
       abi: "gnueabihf"
+      go-arch: "arm"
   - arch == "ppc64le":
       gcc_arch: "powerpc64le"
+      go-arch: "ppc64le"
+  - arch == "riscv64":
+      go-arch: "riscv64"
 
 plugins:
 - origin: pip


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