mirror of
https://github.com/frappe/bench.git
synced 2024-11-11 15:51:03 +00:00
Merge branch 'master' into vm_build
This commit is contained in:
commit
35f3e88ddf
@ -172,6 +172,7 @@ def pull_all_apps(bench_path='.', reset=False):
|
||||
app_dir = get_repo_dir(app, bench_path=bench_path)
|
||||
if os.path.exists(os.path.join(app_dir, '.git')):
|
||||
out = subprocess.check_output(["git", "status"], cwd=app_dir)
|
||||
out = out.decode('utf-8')
|
||||
if not re.search(r'nothing to commit, working (directory|tree) clean', out):
|
||||
print('''
|
||||
|
||||
@ -234,6 +235,7 @@ def get_remote(app, bench_path='.'):
|
||||
repo_dir = get_repo_dir(app, bench_path=bench_path)
|
||||
contents = subprocess.check_output(['git', 'remote', '-v'], cwd=repo_dir,
|
||||
stderr=subprocess.STDOUT)
|
||||
contents = contents.decode('utf-8')
|
||||
if re.findall('upstream[\s]+', contents):
|
||||
remote = 'upstream'
|
||||
else:
|
||||
@ -273,6 +275,7 @@ def get_upstream_version(app, branch=None, bench_path='.'):
|
||||
branch = get_current_branch(app, bench_path=bench_path)
|
||||
try:
|
||||
contents = subprocess.check_output(['git', 'show', 'upstream/{branch}:{app}/__init__.py'.format(branch=branch, app=app)], cwd=repo_dir, stderr=subprocess.STDOUT)
|
||||
contents = contents.decode('utf-8')
|
||||
except subprocess.CalledProcessError as e:
|
||||
if b"Invalid object" in e.output:
|
||||
return None
|
||||
|
@ -96,7 +96,7 @@ def get_frappe_commands(bench_path='.'):
|
||||
return []
|
||||
try:
|
||||
output = get_cmd_output("{python} -m frappe.utils.bench_helper get-frappe-commands".format(python=python), cwd=sites_path)
|
||||
output = output.decode('utf-8')
|
||||
# output = output.decode('utf-8')
|
||||
return json.loads(output)
|
||||
except subprocess.CalledProcessError:
|
||||
return []
|
||||
|
@ -24,6 +24,7 @@ github_password = None
|
||||
def release(bench_path, app, bump_type, from_branch='develop', to_branch='master',
|
||||
remote='upstream', owner='frappe', repo_name=None):
|
||||
|
||||
confirm_testing()
|
||||
config = get_config(bench_path)
|
||||
|
||||
if not config.get('release_bench'):
|
||||
@ -53,6 +54,15 @@ def validate(bench_path, config):
|
||||
r = requests.get('https://api.github.com/user', auth=HTTPBasicAuth(github_username, github_password))
|
||||
r.raise_for_status()
|
||||
|
||||
def confirm_testing():
|
||||
print('')
|
||||
print('================ CAUTION ==================')
|
||||
print('Never miss this, even if it is a really small release!!')
|
||||
print('Manual Testing Checklisk: https://github.com/frappe/bench/wiki/Testing-Checklist')
|
||||
print('')
|
||||
print('')
|
||||
click.confirm('Is manual testing done?', abort = True)
|
||||
|
||||
def bump(bench_path, app, bump_type, from_branch, to_branch, remote, owner, repo_name=None):
|
||||
assert bump_type in ['minor', 'major', 'patch', 'stable', 'prerelease']
|
||||
|
||||
@ -306,18 +316,18 @@ def push_branch_for_old_major_version(bench_path, bump_type, app, repo_path, fro
|
||||
|
||||
current_version = get_current_version(repo_path)
|
||||
old_major_version_branch = "v{major}.x.x".format(major=current_version.split('.')[0])
|
||||
|
||||
|
||||
click.confirm('Do you want to push {branch}?'.format(branch=old_major_version_branch), abort=True)
|
||||
|
||||
|
||||
update_branch(repo_path, to_branch, remote=remote)
|
||||
|
||||
|
||||
g = git.Repo(repo_path).git
|
||||
g.checkout(b=old_major_version_branch)
|
||||
|
||||
|
||||
args = [
|
||||
'{old_major_version_branch}:{old_major_version_branch}'.format(old_major_version_branch=old_major_version_branch),
|
||||
]
|
||||
|
||||
|
||||
print("Pushing {old_major_version_branch} ".format(old_major_version_branch=old_major_version_branch))
|
||||
print(g.push(remote, *args))
|
||||
|
||||
|
@ -373,7 +373,9 @@ def check_git_for_shallow_clone():
|
||||
|
||||
def get_cmd_output(cmd, cwd='.'):
|
||||
try:
|
||||
return subprocess.check_output(cmd, cwd=cwd, shell=True, stderr=open(os.devnull, 'wb')).strip()
|
||||
output = subprocess.check_output(cmd, cwd=cwd, shell=True, stderr=open(os.devnull, 'wb')).strip()
|
||||
output = output.decode('utf-8')
|
||||
return output
|
||||
except subprocess.CalledProcessError as e:
|
||||
if e.output:
|
||||
print(e.output)
|
||||
|
1
patches.txt
Normal file
1
patches.txt
Normal file
@ -0,0 +1 @@
|
||||
bench.patches.v3.deprecate_old_config
|
@ -13,8 +13,8 @@ def install_bench(args):
|
||||
|
||||
success = run_os_command({
|
||||
'apt-get': [
|
||||
'sudo apt-get update'
|
||||
# 'sudo apt-get install -y git build-essential python-setuptools python-dev libffi-dev libssl-dev'
|
||||
'sudo apt-get update',
|
||||
'sudo apt-get install -y git build-essential python-setuptools python-dev libffi-dev libssl-dev'
|
||||
],
|
||||
'yum': [
|
||||
'sudo yum groupinstall -y "Development tools"',
|
||||
|
@ -32,9 +32,9 @@
|
||||
command: bench init {{ bench_path }} --frappe-branch {{ branch }} --python python3
|
||||
args:
|
||||
creates: "{{ bench_path }}"
|
||||
when: not bench_stat.stat.exists and develop
|
||||
when: not bench_stat.stat.exists and not production
|
||||
|
||||
- name: python2 bench init for develop
|
||||
- name: python2 bench init for production
|
||||
command: bench init {{ bench_path }} --frappe-branch {{ branch }}
|
||||
args:
|
||||
creates: "{{ bench_path }}"
|
||||
@ -47,16 +47,25 @@
|
||||
creates: "{{ bench_path }}/sites/common_site_config.json"
|
||||
chdir: "{{ bench_path }}"
|
||||
|
||||
- name: install frappe app
|
||||
command: bench get-app frappe https://github.com/frappe/frappe
|
||||
- include_tasks: setup_inputrc.yml
|
||||
|
||||
# Setup Procfile
|
||||
- name: Setup Procfile
|
||||
command: bench setup procfile
|
||||
args:
|
||||
creates: "{{ bench_path }}/apps/frappe"
|
||||
creates: "{{ bench_path }}/Procfile"
|
||||
chdir: "{{ bench_path }}"
|
||||
|
||||
- include_tasks: setup_dev_env.yml
|
||||
when: not run_travis and not production and (not without_bench_setup and ansible_distribution == 'Ubuntu')
|
||||
# Setup Redis env for RQ
|
||||
- name: Setup Redis
|
||||
command: bench setup redis
|
||||
args:
|
||||
creates: "{{ bench_path }}/config/redis_socketio.conf"
|
||||
chdir: "{{ bench_path }}"
|
||||
|
||||
- include_tasks: setup_inputrc.yml
|
||||
# Setup an ERPNext site called site1.local
|
||||
- include_tasks: setup_erpnext.yml
|
||||
when: not run_travis
|
||||
|
||||
# Setup Bench for production environment
|
||||
- include_tasks: setup_bench_production.yml
|
||||
|
@ -1,42 +1,4 @@
|
||||
---
|
||||
# In case we are re-running the script, we would like to skip the site creation
|
||||
- name: Check whether a site exists
|
||||
stat: path="{{ bench_path }}/sites/{{ site }}"
|
||||
register: site_folder
|
||||
|
||||
- name: Create new site
|
||||
command: bench new-site {{ site }} --admin-password {{ admin_password }} --mariadb-root-password {{ mysql_root_password }}
|
||||
args:
|
||||
chdir: "{{ bench_path }}"
|
||||
when: not site_folder.stat.exists
|
||||
|
||||
- name: Check ERPNext App exists
|
||||
stat: path="{{ bench_path }}/apps/erpnext"
|
||||
register: app
|
||||
|
||||
# In case we are re-running the script, we would like to skip getting ERPNext App
|
||||
- name: Get-app erpnext app
|
||||
command: bench get-app erpnext https://github.com/frappe/erpnext.git --branch {{ branch }}
|
||||
args:
|
||||
chdir: '{{ bench_path }}'
|
||||
when: not app.stat.exists
|
||||
|
||||
- name: Install erpnext app
|
||||
command: bench --site {{ site }} install-app erpnext
|
||||
args:
|
||||
chdir: '{{ bench_path }}'
|
||||
|
||||
- name: Change permissions for frappe home folder
|
||||
become: yes
|
||||
become_user: root
|
||||
file:
|
||||
dest: '/home/{{ frappe_user }}'
|
||||
owner: '{{ frappe_user }}'
|
||||
group: '{{ frappe_user }}'
|
||||
mode: 0755
|
||||
recurse: yes
|
||||
state: directory
|
||||
|
||||
- name: Setup production
|
||||
become: yes
|
||||
become_user: root
|
||||
|
@ -1,21 +0,0 @@
|
||||
---
|
||||
# Setup Procfile
|
||||
- name: setup procfile
|
||||
command: bench setup procfile
|
||||
args:
|
||||
creates: "{{ bench_path }}/Procfile"
|
||||
chdir: "{{ bench_path }}"
|
||||
|
||||
|
||||
# Setup Redis env for RQ
|
||||
- name: setup redis
|
||||
command: bench setup redis
|
||||
args:
|
||||
creates: "{{ bench_path }}/config/redis_socketio.conf"
|
||||
chdir: "{{ bench_path }}"
|
||||
|
||||
|
||||
# Setup an ERPNext site called site1.local
|
||||
- include_tasks: setup_erpnext.yml
|
||||
hosts: localhost
|
||||
...
|
@ -3,7 +3,7 @@
|
||||
stat: path="{{ bench_path }}/apps/erpnext"
|
||||
register: app
|
||||
|
||||
- name: get erpnext
|
||||
- name: Get the ERPNext app
|
||||
command: bench get-app erpnext https://github.com/frappe/erpnext --branch {{ branch }}
|
||||
args:
|
||||
creates: "{{ bench_path }}/apps/erpnext"
|
||||
@ -14,15 +14,14 @@
|
||||
stat: path="{{ bench_path }}/sites/site1.local"
|
||||
register: site_folder
|
||||
|
||||
- name: create a new default site
|
||||
- name: Create a new site
|
||||
command: bench new-site site1.local --admin-password {{ admin_password }} --mariadb-root-password {{ mysql_root_password }}
|
||||
args:
|
||||
chdir: "{{ bench_path }}"
|
||||
when: not site_folder.stat.exists
|
||||
|
||||
- name: install erpnext to default site
|
||||
- name: Install ERPNext to default site
|
||||
command: bench --site site1.local install-app erpnext
|
||||
args:
|
||||
chdir: "{{ bench_path }}"
|
||||
|
||||
...
|
Loading…
Reference in New Issue
Block a user