[gnome-build-meta/valentindavid/publish-vm-ostree-clean: 2/2] ci: Publish VM OSTree repository



commit 978db48f33afd0c8991ca5f2ff4023c2a1bb29af
Author: Valentin David <valentin david codethink co uk>
Date:   Mon Jul 13 13:25:01 2020 +0200

    ci: Publish VM OSTree repository

 .gitlab-ci.yml | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 73 insertions(+), 7 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1898867a..af25aeab 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,9 +19,9 @@ stages:
 - track
 - build
 - image
-- prepare_flatpak
-- flatpak
-- finish_flatpak
+- prepare_publish
+- publish
+- finish_publish
 - reports
 
 default:
@@ -71,6 +71,11 @@ default:
         fi
       ;;
     esac
+
+  - |
+    export OSTREE_FLAT_MANAGER_SERVER=https://flatmgr-ostree.openshift.gnome.org/
+    export OSTREE_FLAT_MANAGER_REPO=gnomeos
+
 #
 # Templates shared by multiple jobs
 #
@@ -128,7 +133,7 @@ default:
     expire_in: '2 days'
 
 .flatpak-template:
-  stage: flatpak
+  stage: publish
   dependencies: [track, flatpak-prepare]
   script:
   - ostree init --repo repo/ --mode archive
@@ -162,6 +167,28 @@ default:
     when: never
   - if: $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^gnome-\d-\d\d$/
 
+.ostree-template:
+  stage: publish
+  dependencies: [track, ostree-prepare]
+  script:
+  - export REPO_TOKEN=$OSTREE_REPO_TOKEN
+
+  - ostree init --repo repo/ --mode archive
+
+  - ${BST} -o arch "${ARCH}" pull vm/repo.bst vm-devel/repo.bst
+
+  - ${BST} -o arch "${ARCH}" checkout --hardlinks vm/repo.bst checkout-repo/
+  - flatpak build-commit-from --src-repo=checkout-repo/ repo/
+  - rm -rf checkout-repo/
+
+  - ${BST} -o arch "${ARCH}" checkout --hardlinks vm-devel/repo.bst checkout-devel-repo/
+  - flatpak build-commit-from --src-repo=checkout-devel-repo/ repo/
+  - rm -rf checkout-devel-repo/
+
+  - flat-manager-client push $(cat build.txt) repo/
+  rules: &ostree-publish-rules
+  - if: $CI_COMMIT_REF_NAME == "master"
+
 #
 # Architecture specific settings
 #
@@ -306,7 +333,7 @@ raspberrypi-4-image:
 
 
 flatpak-prepare:
-  stage: prepare_flatpak
+  stage: prepare_publish
   dependencies: []
   script:
   - flat-manager-client create $FLAT_MANAGER_SERVER $FLAT_MANAGER_REPO > build.txt
@@ -316,6 +343,17 @@ flatpak-prepare:
   rules: *flatpak-publish-rules
   <<: *x86_64
 
+ostree-prepare:
+  stage: prepare_publish
+  dependencies: []
+  script:
+  - export REPO_TOKEN=$OSTREE_REPO_TOKEN
+  - flat-manager-client create $OSTREE_FLAT_MANAGER_SERVER $OSTREE_FLAT_MANAGER_REPO > build.txt
+  artifacts:
+    paths:
+    - build.txt
+  rules: *ostree-publish-rules
+  <<: *x86_64
 
 flatpak-x86_64:
   extends: .flatpak-template
@@ -333,9 +371,16 @@ flatpak-arm:
   extends: .flatpak-template
   <<: *arm
 
+ostree-x86_64:
+  extends: .ostree-template
+  <<: *x86_64
+
+ostree-aarch64:
+  extends: .ostree-template
+  <<: *aarch64
 
 flatpak-finish:
-  stage: finish_flatpak
+  stage: finish_publish
   dependencies: [flatpak-prepare]
   script:
   - flat-manager-client commit --wait $(cat build.txt)
@@ -345,7 +390,7 @@ flatpak-finish:
   <<: *x86_64
 
 flatpak-finish-failed:
-  stage: finish_flatpak
+  stage: finish_publish
   dependencies: [flatpak-prepare]
   script:
   - flat-manager-client purge $(cat build.txt)
@@ -356,6 +401,27 @@ flatpak-finish-failed:
     when: on_failure
   <<: *x86_64
 
+ostree-finish:
+  stage: finish_publish
+  dependencies: [ostree-prepare]
+  script:
+  - export REPO_TOKEN=$OSTREE_REPO_TOKEN
+  - flat-manager-client commit --wait $(cat build.txt)
+  - flat-manager-client publish --wait $(cat build.txt)
+  - flat-manager-client purge $(cat build.txt)
+  rules: *ostree-publish-rules
+  <<: *x86_64
+
+ostree-finish-failed:
+  stage: finish_publish
+  dependencies: [ostree-prepare]
+  script:
+  - export REPO_TOKEN=$OSTREE_REPO_TOKEN
+  - flat-manager-client purge $(cat build.txt)
+  rules:
+  - if: $CI_COMMIT_REF_NAME == "master"
+    when: on_failure
+  <<: *x86_64
 
 cve_report:
   <<: *x86_64


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