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



commit e920ed34f1489081fdbef69007dae9ccec3877c5
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 42cc1c09..4b372bf2 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/repo-devel.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/repo-devel.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/ $(ostree --repo=repo/ refs)
+  rules: &ostree-publish-rules
+  - if: $CI_COMMIT_REF_NAME == "master"
+
 #
 # Architecture specific settings
 #
@@ -307,7 +334,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
@@ -317,6 +344,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
@@ -334,9 +372,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)
@@ -346,7 +391,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)
@@ -357,6 +402,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]