From 1c54c8c4ef97398a958bcbce940d6919aa347c78 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Wed, 28 Oct 2015 08:04:33 -0400 Subject: [PATCH] fix ceph-release role to behave like an actual role, not a playbook Signed-off-by: Alfredo Deza --- ansible/roles/ceph-release/tasks/main.yml | 151 ++++++++++------------ 1 file changed, 68 insertions(+), 83 deletions(-) diff --git a/ansible/roles/ceph-release/tasks/main.yml b/ansible/roles/ceph-release/tasks/main.yml index 96362291..9c7e35b2 100644 --- a/ansible/roles/ceph-release/tasks/main.yml +++ b/ansible/roles/ceph-release/tasks/main.yml @@ -1,85 +1,70 @@ --- -- hosts: local - - connection: local - - vars: - # should be passed in the CLI like `--extra-vars "version=1.23.45 branch=master"` - version: 0-dev # e.g. 0.78 - branch: master # any existing branch on Github - release: stable # stable, development, or rc are valid options - clean: true # if re-doing a deployment this deletes the remote branch in Jenkin's git repo - force_dch: false # if coming from a rc and wanting to release a stable you need to force dch - debemail: adeza@redhat.com - debfullname: "Alfredo Deza" - - tasks: - - name: check if ceph repo exists - stat: path='./ceph' - register: 'ceph_repo' - - - name: clone the ceph repository - git: - repo: git@github.com:ceph/ceph - remote: upstream - dest: ceph - when: ceph_repo.stat.exists is defined and ceph_repo.stat.exists == false - - - name: add origin - command: git remote add origin git://github.com/ceph/ceph-releases.git chdir=ceph - - - name: clear the previous local tag - command: git tag -d v{{ version }} chdir=ceph - ignore_errors: yes - when: clean - - - name: clear the previous remote tag - command: git push origin :v{{ version }} chdir=ceph - ignore_errors: yes - when: clean - - - name: reset --hard to upstream - command: git fetch - command: git reset --hard /{{ branch }} - ignore_errors: yes - when: clean - - - name: force git checkout {{ branch }} branch - command: git checkout -f {{ branch }} chdir=ceph - - - name: fetch upstream - command: git fetch upstream -v - - - name: git submodule update - command: git submodule update --init chdir=ceph - - - name: replace the version in configure.ac - lineinfile: dest=ceph/configure.ac - regexp='^AC_INIT\(\[ceph\],' - line='AC_INIT([ceph], [{{ version }}], [ceph-devel@vger.kernel.org])' - - - include: release/candidate.yml - when: "release in ['candidate', 'rc']" - - - include: release/development.yml - when: "release == 'development'" - - - include: release/stable.yml - when: "release == 'stable'" - - - name: commit the version changes - command: git commit -a -m "{{ version }}" chdir=ceph - - # from script: /srv/ceph-build/tag_release.sh - - name: tag and commit the version - # we used to sign releases like: - # GNUPGHOME=~/build/gnupg.ceph-release - # git tag -s "v{{ version }}" -u 17ED316D -m "v{{ version }}" chdir=ceph - command: git tag "v{{ version }}" -m "v{{ version }}" chdir=ceph - - - name: push changes to ceph-releases git repo - command: git push origin {{ branch }} chdir=ceph - - - name: push the newly created tag - command: git push origin v{{ version }} chdir=ceph +- name: check if ceph repo exists + stat: path='./ceph' + register: 'ceph_repo' + +- name: clone the ceph repository + git: + repo: git@github.com:ceph/ceph + remote: upstream + dest: ceph + when: ceph_repo.stat.exists is defined and ceph_repo.stat.exists == false + +- name: add origin + command: git remote add origin git://github.com/ceph/ceph-releases.git chdir=ceph + +- name: clear the previous local tag + command: git tag -d v{{ version }} chdir=ceph + ignore_errors: yes + when: clean + +- name: clear the previous remote tag + command: git push origin :v{{ version }} chdir=ceph + ignore_errors: yes + when: clean + +- name: reset --hard to upstream + command: git fetch + command: git reset --hard /{{ branch }} + ignore_errors: yes + when: clean + +- name: force git checkout {{ branch }} branch + command: git checkout -f {{ branch }} chdir=ceph + +- name: fetch upstream + command: git fetch upstream -v + +- name: git submodule update + command: git submodule update --init chdir=ceph + +- name: replace the version in configure.ac + lineinfile: dest=ceph/configure.ac + regexp='^AC_INIT\(\[ceph\],' + line='AC_INIT([ceph], [{{ version }}], [ceph-devel@vger.kernel.org])' + +- include: release/candidate.yml + when: "release in ['candidate', 'rc']" + +- include: release/development.yml + when: "release == 'development'" + +- include: release/stable.yml + when: "release == 'stable'" + +- name: commit the version changes + command: git commit -a -m "{{ version }}" chdir=ceph + + # from script: /srv/ceph-build/tag_release.sh +- name: tag and commit the version + # we used to sign releases like: + # GNUPGHOME=~/build/gnupg.ceph-release + # git tag -s "v{{ version }}" -u 17ED316D -m "v{{ version }}" chdir=ceph + command: git tag "v{{ version }}" -m "v{{ version }}" chdir=ceph + +- name: push changes to ceph-releases git repo + command: git push origin {{ branch }} chdir=ceph + +- name: push the newly created tag + command: git push origin v{{ version }} chdir=ceph -- 2.39.5