]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-tag: Write a sha1 file for later consumption
authorDavid Galloway <david.galloway@ibm.com>
Wed, 20 Aug 2025 21:22:21 +0000 (17:22 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Thu, 21 Aug 2025 20:02:06 +0000 (16:02 -0400)
In a regular build, ceph-dev-pipeline just takes a branch name and makes a source tarball in ceph-source-dist.  ceph-dev-pipeline takes that tarball from the ceph-source-dist job and builds from it so it's able to just get the SHA1 from it.

In a /release/ build, a release branch (e.g., reef-release) is specified and we add an additional version commit on top of it.  So we don't know the SHA1 just based on the branch name.  My solution was to write the version commit's SHA1 to a file and consume it later.

Signed-off-by: David Galloway <david.galloway@ibm.com>
ansible/roles/ceph-release/tasks/create.yml
ansible/roles/ceph-release/tasks/main.yml
ansible/roles/ceph-release/tasks/push.yml
ansible/roles/ceph-release/tasks/write_sha1_file.yml [new file with mode: 0644]
ceph-tag/config/definitions/ceph-tag.yml

index e8f2d64ccf200ba1d064c3f574b7942a0a1726d3..e70af80a9bfb2edbb02eda355a9537a7b0c1f9a0 100644 (file)
     chdir: ceph
   when: tag|bool is true
 
+- import_tasks: write_sha1_file.yml
+
 - name: tag the version
   command: git tag -f "v{{ version }}" -m "v{{ version }}"
   args:
index 43b9a09fcc6c3e0c681b4c5d35b1d2a95edccfb1..7e89761d9aec6878b3462a7a196b87d4df39688d 100644 (file)
@@ -7,3 +7,9 @@
     - "stage == 'push'"
     - "release != 'SECURITY'"
     - tag|bool is true
+
+# This only runs to prevent the Archive Artifacts plugin from hanging
+- import_tasks: write_sha1_file.yml
+  when:
+    - "stage == 'push'"
+    - "release == 'SECURITY'"
index feef5d7529edb53685a1b35481b40f11fff6f139..f7901f06a15de88237092e10c2c02d703dc63eac 100644 (file)
@@ -36,6 +36,8 @@
   args:
     chdir: ceph
 
+- import_tasks: write_sha1_file.yml
+
 - name: push version commit to BRANCH-release branch
   command: git push upstream {{ branch }}-release
   args:
diff --git a/ansible/roles/ceph-release/tasks/write_sha1_file.yml b/ansible/roles/ceph-release/tasks/write_sha1_file.yml
new file mode 100644 (file)
index 0000000..35e5329
--- /dev/null
@@ -0,0 +1,23 @@
+---
+# These tasks write the version commit's sha1 to a file for
+# ceph-source-dist and ceph-dev-pipeline to later consume.
+#
+# We write it again when running the playbook with stage=push only so
+# the Archive Artifacts plugin doesn't hang indefinitely.  We don't want
+# to configure the plugin to allow an empty or missing file.
+
+- name: record commit sha1
+  command: git rev-parse HEAD
+  args:
+    chdir: ceph
+  register: commit_sha
+
+- name: ensure ceph/dist dir exists
+  file:
+    path: ceph/dist
+    state: directory
+
+- name: save commit sha1 to file
+  copy:
+    content: "{{ commit_sha.stdout }}"
+    dest: ceph/dist/sha1
index ed39b1b5f6329bb2f9562f6ebff4bfbaf1bea00c..e9526b0ae5e31cd41e2fa9f9a22d5ed9310c1a9e 100644 (file)
@@ -13,6 +13,8 @@
           artifact-num-to-keep: -1
       - github:
           url: https://github.com/ceph/ceph
+      - copyartifact:
+          projects: ceph-dev-pipeline,ceph-release-pipeline
 
     parameters:
       - string:
@@ -66,6 +68,12 @@ SECURITY: Builds from BRANCH-release branch in ceph-private.git (private repo)."
             - ../../../scripts/build_utils.sh
             - ../../build/build
 
+    publishers:
+      - archive:
+          artifacts: 'ceph-build/ansible/ceph/dist/sha1'
+          allow-empty: false
+          latest-only: false
+
     wrappers:
       - inject-passwords:
           global: true