[neon/snap-packaging/gwenview-snap/Neon/master] debian: try to publish to store channels dynamically
Carlos De Maine
null at kde.org
Mon Nov 11 05:29:12 GMT 2024
Git commit dbfce5bb2132225b2c6c75b36565bd6fe7556e71 by Carlos De Maine.
Committed on 11/11/2024 at 05:29.
Pushed by carlosdem into branch 'Neon/master'.
try to publish to store channels dynamically
M +46 -4 debian/snap-base-proto.yml
M +18 -25 debian/snap-snapcraft-lxd-proto.yml
https://invent.kde.org/neon/snap-packaging/gwenview-snap/-/commit/dbfce5bb2132225b2c6c75b36565bd6fe7556e71
diff --git a/debian/snap-base-proto.yml b/debian/snap-base-proto.yml
index d0b1b8a..477eccf 100644
--- a/debian/snap-base-proto.yml
+++ b/debian/snap-base-proto.yml
@@ -4,8 +4,6 @@
- Snap
variables:
KDE_SNAP_MODULE_NAME: ${CI_PROJECT_NAME}
- KDE_SNAP_BRANCH: $CI_COMMIT_REF_NAME
- KDE_SNAP_CHANNEL: "default"
SNAPCRAFT_BUILD_ENVIRONMENT: "lxd"
SNAPCRAFT_MANAGED_MODE: "y"
interruptible: true
@@ -16,10 +14,54 @@
- git config --global --add safe.directory $CI_PROJECT_DIR
artifacts:
name: Snap artifacts
- expose_as: 'KDE neon snaps'
+ expose_as: 'KDE neon snaps build'
when: always
paths:
- - ".kde-ci-packages/"
+ - "kde-ci-packages/"
+ - "task.log"
+ - "task-debug.log"
+ expire_in: 7 days
+
+.snap_deploy:
+ stage: deploy
+ rules:
+ # run the job on mainline branches of mainline repositories
+ #- if: $KDECI_SECURE_SERVICES_KEY
+ # when: on_success
+ # or when triggered manually
+ - when: manual
+ # we don't want the manual job to block the pipeline
+ allow_failure: true
+ tags:
+ - Snap
+ variables:
+ GIT_STRATEGY: none
+ interruptible: true
+ script:
+ - |
+ # upload to the snap store with the channel dependent on which branch we are building
+ # master = edge
+ if [ $CI_COMMIT_BRANCH == "master" ]; then
+ snapcraft push --release=edge *.snap
+ # RC branch = beta
+ elif [ $CI_COMMIT_BRANCH == "Neon/release-24.12" ]; then
+ snapcraft push --release=beta *.snap
+ # Branch tags = candidate
+ elif [ $CI_COMMIT_BRANCH == "Neon/release-24.08" ]; then
+ - snapcraft push --release=candidate *.snap
+ # new release tag (new tarball release) = stable needs to be set off manually until ephemeral vm's are a thing
+ #elif [ $CI_COMMIT_TAG == "v24.08.3" ]; then
+ elif [ $SNAP_PUBLISH_TYPE" == "manual" ]; then
+ - snapcraft push --release=stable *.snap
+ else
+ exit
+ fi
+artifacts:
+ name: Snap artifacts
+ expose_as: 'KDE neon snaps deploy'
+ 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
index 4f16303..89cfd62 100644
--- a/debian/snap-snapcraft-lxd-proto.yml
+++ b/debian/snap-snapcraft-lxd-proto.yml
@@ -1,19 +1,17 @@
include:
- - project: sysadmin/ci-utilities
- file:
- #- /gitlab-templates/blocks/snap-base.yml
- - /gitlab-templates/blocks/workflow.yml
+ - /gitlab-templates/blocks/snap-base.yml
+ - /gitlab-templates/blocks/workflow.yml
snap_snapcraft_lxd:
extends: .snap_base
- stage: deploy
+ stage: build
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
+ if [ "$SNAP_BUILD_TYPE" == "legacy" ]; 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
@@ -33,29 +31,20 @@ snap_snapcraft_lxd:
done
fi
script:
- # choose channel for publishing based on branch
- - |
- if [ "$KDE_SNAP_BRANCH" == "Neon/master" ]; then
- export KDE_SNAP_CHANNEL="edge"
- fi
- if [ "$KDE_SNAP_BRANCH" == "Neon/release-24.08" ]; then
- export KDE_SNAP_CHANNEL="candidate"
- fi
- if [ "$KDE_SNAP_BRANCH" == "Neon/release-24.05" ]; then
- export KDE_SNAP_CHANNEL="stable"
- fi
# clean
- snapcraft clean
# Force usage of LXD for building Snaps
- - echo building $KDE_SNAP_MODULE_NAME with LXD for branch $KDE_SNAP_BRANCH and we will publish to $KDE_SNAP_CHANNEL
+ - 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/
+ - 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 ...
+ - cp -vf ./*.snap $CI_PROJECT_DIR/kde-ci-packages/
+ after_script:
+ # clean up lxd instances that can pollute subsequent rebuilds in the persistent vm
+ # 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
+ if [ "$SNAP_BUILD_TYPE" == "legacy" ]; 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
@@ -74,8 +63,12 @@ snap_snapcraft_lxd:
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
+
+snap_snapcraft_deploy:
+ extends: .snap_deploy
+ stage: deploy
+ needs: snap_snapcraft_lxd
+ inherit:
+ default: true
More information about the Neon-commits
mailing list