[neon/snap-packaging/gwenview-snap/Neon/release-24.08] debian: 24.08 support

Carlos De Maine null at kde.org
Mon Aug 19 14:45:06 BST 2024


Git commit 3d4c293c93410b6173c8a07a9bf5f2783e91b3ee by Carlos De Maine.
Committed on 19/08/2024 at 13:42.
Pushed by carlosdem into branch 'Neon/release-24.08'.

24.08 support

M  +7    -3    debian/.gitlab-ci-neon.yml
A  +34   -0    debian/snap-base-proto.yml
A  +70   -0    debian/snap-snapcraft-lxd-proto.yml

https://invent.kde.org/neon/snap-packaging/gwenview-snap/-/commit/3d4c293c93410b6173c8a07a9bf5f2783e91b3ee

diff --git a/debian/.gitlab-ci-neon.yml b/debian/.gitlab-ci-neon.yml
index ab2589a..2094c46 100644
--- a/debian/.gitlab-ci-neon.yml
+++ b/debian/.gitlab-ci-neon.yml
@@ -1,8 +1,12 @@
 # SPDX-FileCopyrightText: none
 # SPDX-License-Identifier: CC0-1.0
 
+#include:
+#  - project: sysadmin/ci-utilities
+#    file:
+#      - /gitlab-templates/snap-snapcraft-destructive.yml
+#      - /gitlab-templates/snap-snapcraft-lxd.yml
 include:
   - project: sysadmin/ci-utilities
-    file:
-#      - /gitlab-templates/snap-snapcraft-destructive.yml
-      - /gitlab-templates/snap-snapcraft-lxd.yml
+  - local: debian/snap-snapcraft-lxd-proto.yml
+  - local: debian/snap-base-proto.yml
diff --git a/debian/snap-base-proto.yml b/debian/snap-base-proto.yml
new file mode 100644
index 0000000..32203f5
--- /dev/null
+++ b/debian/snap-base-proto.yml
@@ -0,0 +1,34 @@
+.snap_base:
+  stage: build
+  tags:
+    - Snap
+  variables:
+    KDE_SNAP_MODULE_NAME: ${CI_PROJECT_NAME}
+    KDE_SNAP_BRANCH: $CI_COMMIT_REF_NAME
+    SNAPCRAFT_BUILD_ENVIRONMENT: "lxd"
+    SNAPCRAFT_MANAGED_MODE: "y"
+  interruptible: true
+  before_script:
+    - git clone https://invent.kde.org/sysadmin/ci-utilities.git --depth=1
+    - git clone https://invent.kde.org/sysadmin/repo-metadata.git ci-utilities/repo-metadata/ --depth=1
+  script:
+    - git config --global --add safe.directory $CI_PROJECT_DIR
+    - |
+      if [ "$KDE_SNAP_BRANCH" == "Neon/master" ]; then
+        $KDE_SNAP_CHANNEL = "edge"
+      done
+      if [ "$KDE_SNAP_BRANCH" == "Neon/release-24.08" ]; then
+        $KDE_SNAP_CHANNEL = "candidate"
+      done
+      if [ "$KDE_SNAP_BRANCH" == "Neon/release-24.05" ]; then
+        $KDE_SNAP_CHANNEL = "stable"
+      done
+  artifacts:
+    name: Snap artifacts
+    expose_as: 'KDE neon snaps'
+    when: always
+    paths:
+      - ".kde-ci-packages/"
+      - "task.log"
+      - "task-debug.log"
+    expire_in: 7 days
diff --git a/debian/snap-snapcraft-lxd-proto.yml b/debian/snap-snapcraft-lxd-proto.yml
new file mode 100644
index 0000000..9fb8b59
--- /dev/null
+++ b/debian/snap-snapcraft-lxd-proto.yml
@@ -0,0 +1,70 @@
+include:
+  - project: sysadmin/ci-utilities
+    file:
+      #- /gitlab-templates/blocks/snap-base.yml
+      - /gitlab-templates/blocks/workflow.yml
+
+snap_snapcraft_lxd:
+  extends: .snap_base
+  stage: deploy
+  inherit:
+    default: true
+  before_script:
+    # double check  lxd instances that can pollute subsequent rebuilds in the persistent vm have been cleaned up
+    # being snapcraft, of course different builds are in different projects, work around that with an if else ...
+    - |
+      if [ "$KDE_SNAP_MODULE_NAME" == "plasma-desktop-session-snap" || "$KDE_SNAP_MODULE_NAME" == "ubuntu-core" ]; then
+        # firstly remove any snapcraft-created LXD containers
+        for c in $(lxc storage info default | awk '{print $2}' | grep snapcraft-);
+                do lxc delete --force $c
+        done
+        # then remove any snapcraft-created LXD base-instances
+        for d in $(lxc storage info default | awk '{print $2}' | grep base-instance-snapcraft-);
+                do lxc delete --force $d
+        done
+      else
+        # firstly remove any snapcraft-created LXD containers
+        for c in $(lxc storage info default | awk '{print $2}' | grep snapcraft-);
+                do lxc delete --force $c --project snapcraft
+        done
+        # then remove any snapcraft-created LXD base-instances
+        for d in $(lxc storage info default | awk '{print $2}' | grep base-instance-snapcraft-);
+                do lxc delete --force $d --project snapcraft
+        done
+      fi
+  script:
+    # clean
+    - snapcraft clean
+    # Force usage of LXD for building Snaps
+    - echo building $KDE_SNAP_MODULE_NAME with LXD for branch $KDE_SNAP_BRANCH...
+    - snapcraft --use-lxd --verbose 2>&1 | tee task.log
+    # Make the artifacts dir
+    - mkdir -p $CI_PROJECT_DIR/.kde-ci-packages/
+    # copy the snap to the artifacts dir
+    - cp -vf ./*.snap  $CI_PROJECT_DIR/.kde-ci-packages/
+  # being snapcraft, of course different builds are in different projects, work around that with an if else ...
+    - |
+      if [ "$KDE_SNAP_MODULE_NAME" == "plasma-desktop-session-snap" || "$KDE_SNAP_MODULE_NAME" == "ubuntu-core" ]; then
+        # firstly remove any snapcraft-created LXD containers
+        for c in $(lxc storage info default | awk '{print $2}' | grep snapcraft-);
+                do lxc delete --force $c
+        done
+        # then remove any snapcraft-created LXD base-instances
+        for d in $(lxc storage info default | awk '{print $2}' | grep base-instance-snapcraft-);
+                do lxc delete --force $d
+        done
+      else
+        # firstly remove any snapcraft-created LXD containers
+        for c in $(lxc storage info default | awk '{print $2}' | grep snapcraft-);
+                do lxc delete --force $c --project snapcraft
+        done
+        # then remove any snapcraft-created LXD base-instances
+        for d in $(lxc storage info default | awk '{print $2}' | grep base-instance-snapcraft-);
+                do lxc delete --force $d --project snapcraft
+        done
+      fi
+    # upload to the snap store last as if snap upload fails, the lxc cleanup is never run
+    # super hacky upload of snap to store
+    - snapcraft push --release=$KDE_SNAP_CHANNEL *.snap
+  allow_failure: true
+  interruptible: true


More information about the Neon-commits mailing list