From dfc9a721b52f60e1628b118f43386a64979ffbd7 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Wed, 20 Aug 2025 17:22:21 -0400 Subject: [PATCH] ceph-tag: Write a sha1 file for later consumption 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 --- ansible/roles/ceph-release/tasks/create.yml | 2 ++ ansible/roles/ceph-release/tasks/main.yml | 6 +++++ ansible/roles/ceph-release/tasks/push.yml | 2 ++ .../ceph-release/tasks/write_sha1_file.yml | 23 +++++++++++++++++++ ceph-tag/config/definitions/ceph-tag.yml | 8 +++++++ 5 files changed, 41 insertions(+) create mode 100644 ansible/roles/ceph-release/tasks/write_sha1_file.yml diff --git a/ansible/roles/ceph-release/tasks/create.yml b/ansible/roles/ceph-release/tasks/create.yml index e8f2d64c..e70af80a 100644 --- a/ansible/roles/ceph-release/tasks/create.yml +++ b/ansible/roles/ceph-release/tasks/create.yml @@ -106,6 +106,8 @@ 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: diff --git a/ansible/roles/ceph-release/tasks/main.yml b/ansible/roles/ceph-release/tasks/main.yml index 43b9a09f..7e89761d 100644 --- a/ansible/roles/ceph-release/tasks/main.yml +++ b/ansible/roles/ceph-release/tasks/main.yml @@ -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'" diff --git a/ansible/roles/ceph-release/tasks/push.yml b/ansible/roles/ceph-release/tasks/push.yml index feef5d75..f7901f06 100644 --- a/ansible/roles/ceph-release/tasks/push.yml +++ b/ansible/roles/ceph-release/tasks/push.yml @@ -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 index 00000000..35e53290 --- /dev/null +++ b/ansible/roles/ceph-release/tasks/write_sha1_file.yml @@ -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 diff --git a/ceph-tag/config/definitions/ceph-tag.yml b/ceph-tag/config/definitions/ceph-tag.yml index ed39b1b5..e9526b0a 100644 --- a/ceph-tag/config/definitions/ceph-tag.yml +++ b/ceph-tag/config/definitions/ceph-tag.yml @@ -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 -- 2.39.5