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>
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:
- "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'"
args:
chdir: ceph
+- import_tasks: write_sha1_file.yml
+
- name: push version commit to BRANCH-release branch
command: git push upstream {{ branch }}-release
args:
--- /dev/null
+---
+# 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
artifact-num-to-keep: -1
- github:
url: https://github.com/ceph/ceph
+ - copyartifact:
+ projects: ceph-dev-pipeline,ceph-release-pipeline
parameters:
- string:
- ../../../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