blob: 49de59fd4f6b2ebb06d44dbaba9cc50de0eefd10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
- hosts: localhost
gather_facts: no
vars_files:
- versions.yml
vars:
release_dir: "./ansible_release"
release_date: "{{lookup('pipe', 'date +\"%m-%d-%Y\"')}}"
rpm_spec_line: |
* {{lookup('pipe', 'date +"%a %b %d %Y"')}} Ansible, Inc. <support@ansible.com> - {{ansible_release_version}}-{{ansible_release_string}}
- Release {{ansible_release_version}}-{{ansible_release_string}}
deb_changelog_line: |
ansible ({{ansible_release_version}}) unstable; urgency=low
* {{ansible_release_version}}
-- Ansible, Inc. <support@ansible.com> {{lookup('pipe', 'date -R')}}
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
- 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:
- 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:
repo: "git@github.com:ansible/ansible.git"
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}}"
insertafter: "-- Ansible, Inc. <support@ansible.com> %DATE%"
#- name: Update RELEASES.txt
# lineinfile:
# dest: "{{release_dir}}/RELEASES.txt"
# regexp: "^{{ansible_release_version}}"
# line: '{{ansible_release_version}} "{{ansible_release_codename}}" {{release_date}}'
# insertafter: ""
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
- 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
- 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
- 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}}/"
- 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
- 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
- name: Push the updates and/or tag
shell:
_raw_params: "git push --tags origin {{ansible_release_branch}}"
chdir: "{{release_dir}}/lib/ansible/modules/{{item}}/"
when: do_push|bool
|