2016-06-24 21:46:12 +02:00
|
|
|
- hosts: localhost
|
|
|
|
gather_facts: no
|
2016-07-07 15:45:36 +02:00
|
|
|
vars_files:
|
2016-07-08 17:08:25 +02:00
|
|
|
- vars/versions.yml
|
2016-06-24 21:46:12 +02:00
|
|
|
vars:
|
|
|
|
release_dir: "./ansible_release"
|
|
|
|
release_date: "{{lookup('pipe', 'date +\"%m-%d-%Y\"')}}"
|
|
|
|
rpm_spec_line: |
|
|
|
|
|
2016-10-13 22:28:21 +02:00
|
|
|
* {{lookup('pipe', 'date +"%a %b %d %Y"')}} Ansible, Inc. <info@ansible.com> - {{ansible_release_version}}-{{ansible_release_string}}
|
2016-06-24 21:46:12 +02:00
|
|
|
- Release {{ansible_release_version}}-{{ansible_release_string}}
|
|
|
|
deb_changelog_line: |
|
|
|
|
|
|
|
|
ansible ({{ansible_release_version}}) unstable; urgency=low
|
2016-07-07 15:45:36 +02:00
|
|
|
|
2016-06-24 21:46:12 +02:00
|
|
|
* {{ansible_release_version}}
|
2016-07-07 15:45:36 +02:00
|
|
|
|
2016-10-13 22:28:21 +02:00
|
|
|
-- Ansible, Inc. <info@ansible.com> {{lookup('pipe', 'date -R')}}
|
2016-06-24 21:46:12 +02:00
|
|
|
|
|
|
|
vars_prompt:
|
|
|
|
- name: ansible_release_branch
|
|
|
|
prompt: "Enter the release branch"
|
|
|
|
private: no
|
|
|
|
- name: ansible_release_version
|
|
|
|
prompt: "Enter the release version"
|
|
|
|
private: no
|
|
|
|
- name: ansible_release_string
|
|
|
|
prompt: "Enter the release string (ie. 0.1.beta1, or just 1 for final releases)"
|
|
|
|
private: no
|
|
|
|
#- name: ansible_release_codename
|
|
|
|
# prompt: "Enter the release code name (only used if doing a final release)"
|
|
|
|
# default: ""
|
|
|
|
# private: no
|
2016-12-06 19:51:27 +01:00
|
|
|
- name: has_submodules
|
|
|
|
prompt: "Does this branch have git submodules?"
|
|
|
|
default: "yes"
|
|
|
|
private: no
|
2016-06-24 21:46:12 +02:00
|
|
|
- name: is_final
|
|
|
|
prompt: "Is this a final release (not a beta/rc)?"
|
|
|
|
default: "no"
|
|
|
|
private: no
|
|
|
|
- name: do_push
|
|
|
|
prompt: "Push repositories upstream when done?"
|
|
|
|
default: "no"
|
|
|
|
private: no
|
|
|
|
tasks:
|
2017-05-11 17:54:40 +02:00
|
|
|
- pause:
|
|
|
|
prompt: "Has the CHANGELOG and any other files been updated and are ready to go?"
|
|
|
|
when: is_final|bool
|
|
|
|
|
2016-06-24 21:46:12 +02:00
|
|
|
- name: create a combined version string from the specified values
|
|
|
|
set_fact:
|
|
|
|
new_version: "v{{ansible_release_version}}-{{ansible_release_string}}"
|
|
|
|
|
|
|
|
- name: assert certain variables are defined
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- ansible_release_branch is defined
|
|
|
|
- ansible_release_version is defined
|
|
|
|
- ansible_release_string is defined
|
|
|
|
|
|
|
|
- name: Remove ansible_release (if it exists)
|
|
|
|
file:
|
|
|
|
path: "{{release_dir}}/"
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Clone the official repo
|
|
|
|
git:
|
2016-07-08 19:59:20 +02:00
|
|
|
#repo: "git@github.com:ansible/ansible.git"
|
|
|
|
repo: "https://github.com/ansible/ansible.git"
|
2016-06-24 21:46:12 +02:00
|
|
|
dest: "{{release_dir}}"
|
|
|
|
version: "{{ansible_release_branch}}"
|
|
|
|
recursive: yes
|
|
|
|
|
|
|
|
- name: get the latest version
|
|
|
|
shell:
|
|
|
|
_raw_params: git tag | tail -1
|
|
|
|
chdir: "{{release_dir}}"
|
|
|
|
register: latest_version
|
|
|
|
|
|
|
|
- name: "assert the specified version ({{new_version}}) is greater than the latest version ({{latest_version.stdout}})"
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- new_version|version_compare(latest_version.stdout, "gt")
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Update the VERSION file for the main repo
|
|
|
|
copy:
|
|
|
|
dest: "{{release_dir}}/VERSION"
|
|
|
|
content: "{{ansible_release_version}} {{ansible_release_string}}\n"
|
|
|
|
|
|
|
|
- name: Update the library version
|
|
|
|
lineinfile:
|
|
|
|
dest: "{{release_dir}}/lib/ansible/release.py"
|
|
|
|
regexp: "^__version__ ="
|
|
|
|
line: "__version__ = '{{ansible_release_version}}'"
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Update the spec file release list
|
|
|
|
lineinfile:
|
|
|
|
dest: "{{release_dir}}/packaging/rpm/ansible.spec"
|
|
|
|
regexp: "^- Release {{ansible_release_version}}-{{ansible_release_string}}"
|
|
|
|
line: "{{rpm_spec_line.rstrip()}}"
|
|
|
|
insertafter: "^%changelog"
|
|
|
|
- name: Update the deb changelog file
|
|
|
|
lineinfile:
|
|
|
|
dest: "{{release_dir}}/packaging/debian/changelog"
|
|
|
|
regexp: "^ansible ({{ansible_release_version}})"
|
|
|
|
line: "{{deb_changelog_line}}"
|
2016-10-13 22:28:21 +02:00
|
|
|
insertafter: "-- Ansible, Inc. <info@ansible.com> %DATE%"
|
2016-07-08 19:59:20 +02:00
|
|
|
- name: Update RELEASES.txt
|
|
|
|
template:
|
|
|
|
dest: "{{release_dir}}/RELEASES.txt"
|
|
|
|
src: "templates/RELEASES.tmpl"
|
2016-06-24 21:46:12 +02:00
|
|
|
when: is_final|bool
|
|
|
|
|
|
|
|
- name: "Make sure modules are checked out to {{ansible_release_branch}}"
|
|
|
|
shell:
|
|
|
|
_raw_params: "git checkout {{ansible_release_branch}}"
|
|
|
|
chdir: "{{release_dir}}/lib/ansible/modules/{{item}}/"
|
|
|
|
with_items:
|
|
|
|
- core
|
|
|
|
- extras
|
2016-12-06 19:51:27 +01:00
|
|
|
when: has_submodules|bool
|
2016-06-24 21:46:12 +02:00
|
|
|
|
|
|
|
- name: Update the VERSION file for the modules
|
|
|
|
copy:
|
|
|
|
dest: "{{release_dir}}/lib/ansible/modules/{{item}}/VERSION"
|
|
|
|
content: "{{ansible_release_version}} {{ansible_release_string}}\n"
|
|
|
|
with_items:
|
|
|
|
- core
|
|
|
|
- extras
|
2016-12-06 19:51:27 +01:00
|
|
|
when: has_submodules|bool
|
2016-06-24 21:46:12 +02:00
|
|
|
|
|
|
|
- name: Add and commit the updated files for the core modules
|
|
|
|
shell:
|
|
|
|
_raw_params: "git add ./ && git commit -m 'New release {{new_version}}'"
|
|
|
|
chdir: "{{release_dir}}/lib/ansible/modules/{{item}}/"
|
|
|
|
with_items:
|
|
|
|
- core
|
|
|
|
- extras
|
2016-12-06 19:51:27 +01:00
|
|
|
when: has_submodules|bool
|
2016-06-24 21:46:12 +02:00
|
|
|
|
|
|
|
- name: Add and commit the updated files for the main repo
|
|
|
|
shell:
|
|
|
|
_raw_params: "git add ./ && git commit -m 'New release {{new_version}}'"
|
|
|
|
chdir: "{{release_dir}}/"
|
|
|
|
|
|
|
|
- name: Tag the release
|
|
|
|
shell:
|
|
|
|
_raw_params: "git tag -fa {{new_version}} -m 'New release {{new_version}}'"
|
|
|
|
chdir: "{{release_dir}}/"
|
|
|
|
|
2016-07-08 19:59:20 +02:00
|
|
|
- name: update git config for the main repo
|
|
|
|
lineinfile:
|
|
|
|
dest: "{{release_dir}}/.git/config"
|
|
|
|
regexp: "upstream"
|
|
|
|
line: |
|
|
|
|
[remote "upstream"]
|
|
|
|
url = git@github.com:ansible/ansible.git
|
|
|
|
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
|
|
|
2016-06-24 21:46:12 +02:00
|
|
|
- name: update git config for submodules
|
|
|
|
lineinfile:
|
|
|
|
dest: "{{release_dir}}/.git/modules/lib/ansible/modules/{{item}}/config"
|
|
|
|
regexp: "submodule_upstream"
|
|
|
|
line: |
|
|
|
|
[remote "submodule_upstream"]
|
|
|
|
url = git@github.com:ansible/ansible-modules-{{item}}.git
|
|
|
|
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
|
|
with_items:
|
|
|
|
- core
|
|
|
|
- extras
|
2016-12-06 19:51:27 +01:00
|
|
|
when: has_submodules|bool
|
2016-06-24 21:46:12 +02:00
|
|
|
|
2016-07-08 19:59:20 +02:00
|
|
|
- name: create the dist tar.gz
|
|
|
|
command:
|
|
|
|
_raw_params: make sdist
|
|
|
|
chdir: "{{release_dir}}/"
|
|
|
|
environment:
|
|
|
|
OFFICIAL: yes
|
|
|
|
|
|
|
|
- name: rename the dist tar.gz to include the full release
|
2016-07-25 05:31:15 +02:00
|
|
|
command:
|
|
|
|
_raw_params: "mv dist/ansible-{{ansible_release_version}}.tar.gz dist/ansible-{{ansible_release_version}}-{{ansible_release_string}}.tar.gz"
|
|
|
|
chdir: "{{release_dir}}/"
|
|
|
|
|
|
|
|
- name: generate the SHA file for the tar.gz
|
|
|
|
shell:
|
|
|
|
_raw_params: "sha256sum dist/ansible-{{ansible_release_version}}-{{ansible_release_string}}.tar.gz > dist/ansible-{{ansible_release_version}}-{{ansible_release_string}}.tar.gz.sha"
|
|
|
|
chdir: "{{release_dir}}/"
|
2016-07-08 19:59:20 +02:00
|
|
|
|
2016-06-24 21:46:12 +02:00
|
|
|
- block:
|
|
|
|
- pause:
|
|
|
|
prompt: "Ready to push, this is the last chance to abort..."
|
|
|
|
|
|
|
|
- name: Push the submodule repos
|
|
|
|
shell:
|
|
|
|
_raw_params: "git push submodule_upstream {{ansible_release_branch}}"
|
|
|
|
chdir: "{{release_dir}}/lib/ansible/modules/{{item}}/"
|
|
|
|
with_items:
|
|
|
|
- core
|
|
|
|
- extras
|
2016-12-06 19:51:27 +01:00
|
|
|
when: has_submodules|bool
|
2016-06-24 21:46:12 +02:00
|
|
|
|
|
|
|
- name: Push the updates and/or tag
|
|
|
|
shell:
|
2016-07-08 19:59:20 +02:00
|
|
|
_raw_params: "git push --tags upstream {{ansible_release_branch}}"
|
2016-06-24 21:46:12 +02:00
|
|
|
chdir: "{{release_dir}}/lib/ansible/modules/{{item}}/"
|
|
|
|
when: do_push|bool
|