[neon/snap-packaging/gwenview-snap/Neon/master] debian: DEBUG

Carlos De Maine null at kde.org
Mon Aug 19 13:30:15 BST 2024


Git commit e18a036d9ce5a89dd83cf5027b60baffa4a0d13c by Carlos De Maine.
Committed on 19/08/2024 at 12:30.
Pushed by carlosdem into branch 'Neon/master'.

DEBUG

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

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

diff --git a/debian/.gitlab-ci-neon.yml b/debian/.gitlab-ci-neon.yml
index ab2589a..04f3e68 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-image-dangerous-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..9cfdc85
--- /dev/null
+++ b/debian/snap-base-proto.yml
@@ -0,0 +1,24 @@
+.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
+  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.yml b/debian/snap-snapcraft-lxd.yml
new file mode 100644
index 0000000..2b21a70
--- /dev/null
+++ b/debian/snap-snapcraft-lxd.yml
@@ -0,0 +1,68 @@
+include:
+  - /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...
+    - 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=edge *.snap
+  allow_failure: true
+  interruptible: true


More information about the Neon-commits mailing list