From 24ba1cd5518054f8f3c47333389ca1451fd9c46e Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Fri, 2 Apr 2021 07:26:44 +0530 Subject: [PATCH] chore: change ci script to build v13 --- .travis.yml | 42 ++++++++++++++++++++--------------------- docs/docker-swarm.md | 10 +++++----- docs/multi-bench.md | 2 +- docs/single-bench.md | 4 ++-- docs/site-operations.md | 4 ++-- tests/docker-test.sh | 10 +++++----- travis.py | 9 +++++++-- 7 files changed, 43 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc5b100b..9a2b7c9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,36 +60,36 @@ jobs: - ./travis.py erpnext --nginx --tag latest - ./travis.py erpnext --nginx --tag edge --tag-only - ./travis.py erpnext --nginx --tag develop --tag-only - - stage: "Frappe (v13-beta)" + - stage: "Frappe (v13)" if: branch = master AND type != pull_request script: - - ./travis.py frappe --worker --git-version 13-beta - - ./travis.py frappe --worker --tag v13-beta --tag-only - - ./travis.py frappe --worker --tag version-13-beta --tag-only - - stage: "Frappe (v13-beta)" + - ./travis.py frappe --worker --git-version 13 + - ./travis.py frappe --worker --tag v13 --tag-only + - ./travis.py frappe --worker --tag version-13 --tag-only + - stage: "Frappe (v13)" if: branch = master AND type != pull_request script: - - ./travis.py frappe --nginx --git-version 13-beta - - ./travis.py frappe --nginx --tag v13-beta --tag-only - - ./travis.py frappe --nginx --tag version-13-beta --tag-only - - stage: "Frappe (v13-beta)" + - ./travis.py frappe --nginx --git-version 13 + - ./travis.py frappe --nginx --tag v13 --tag-only + - ./travis.py frappe --nginx --tag version-13 --tag-only + - stage: "Frappe (v13)" if: branch = master AND type != pull_request script: - - ./travis.py frappe --socketio --git-version 13-beta - - ./travis.py frappe --socketio --tag v13-beta --tag-only - - ./travis.py frappe --socketio --tag version-13-beta --tag-only - - stage: "ERPNext (v13-beta)" + - ./travis.py frappe --socketio --git-version 13 + - ./travis.py frappe --socketio --tag v13 --tag-only + - ./travis.py frappe --socketio --tag version-13 --tag-only + - stage: "ERPNext (v13)" if: branch = master AND type != pull_request script: - - ./travis.py erpnext --worker --git-version 13-beta - - ./travis.py erpnext --worker --tag v13-beta --tag-only - - ./travis.py erpnext --worker --tag version-13-beta --tag-only - - stage: "ERPNext (v13-beta)" + - ./travis.py erpnext --worker --git-version 13 + - ./travis.py erpnext --worker --tag v13 --tag-only + - ./travis.py erpnext --worker --tag version-13 --tag-only + - stage: "ERPNext (v13)" if: branch = master AND type != pull_request script: - - ./travis.py erpnext --nginx --git-version 13-beta - - ./travis.py erpnext --nginx --tag v13-beta --tag-only - - ./travis.py erpnext --nginx --tag version-13-beta --tag-only + - ./travis.py erpnext --nginx --git-version 13 + - ./travis.py erpnext --nginx --tag v13 --tag-only + - ./travis.py erpnext --nginx --tag version-13 --tag-only - stage: "Frappe (v12)" if: branch = master AND type != pull_request script: @@ -183,4 +183,4 @@ jobs: script: - git clone git@github.com:frappe/helm.git && cd helm - pip install -r release_wizard/requirements.txt - - ./release_wizard/wizard 12 patch --remote origin --ci + - ./release_wizard/wizard 13 patch --remote origin --ci diff --git a/docs/docker-swarm.md b/docs/docker-swarm.md index 6c762911..6372d65b 100644 --- a/docs/docker-swarm.md +++ b/docs/docker-swarm.md @@ -103,7 +103,7 @@ networks: ### Deploy Frappe/ERPNext -Stacks > Add Stacks > `frappe-bench-v12` +Stacks > Add Stacks > `frappe-bench-v13` ```yaml version: "3.7" @@ -272,10 +272,10 @@ SITES=`site1.example.com`,`site2.example.com` ### Create new site job 1. Containers > Add Container > `add-site1-example-com` -2. Select Image frappe/erpnext-worker:v12 +2. Select Image frappe/erpnext-worker:v13 3. Set command as `new` 4. Select network `frappe-network` -5. Select Volume `frappe-bench-v12_sites_vol` and mount in container `/home/frappe/frappe-bench/sites` +5. Select Volume `frappe-bench-v13_sites_vol` and mount in container `/home/frappe/frappe-bench/sites` 6. Env variables: - MYSQL_ROOT_PASSWORD=longsecretpassword - SITE_NAME=site1.example.com @@ -284,10 +284,10 @@ SITES=`site1.example.com`,`site2.example.com` ### Migrate Sites job 1. Containers > Add Container > `migrate-sites` -2. Select Image frappe/erpnext-worker:v12 +2. Select Image frappe/erpnext-worker:v13 3. Set command as `migrate` 4. Select network `frappe-network` -5. Select Volume `frappe-bench-v12_sites_vol` and mount in container `/home/frappe/frappe-bench/sites` +5. Select Volume `frappe-bench-v13_sites_vol` and mount in container `/home/frappe/frappe-bench/sites` 6. Env variables: - MAINTENANCE_MODE=1 7. Start container diff --git a/docs/multi-bench.md b/docs/multi-bench.md index 9b386b33..ebd64bd9 100644 --- a/docs/multi-bench.md +++ b/docs/multi-bench.md @@ -17,7 +17,7 @@ cp env-example .env To get started, copy the existing `env-example` file to `.env`. By default, the file will contain the following variables: - `VERSION=edge` - - In this case, `edge` corresponds to `develop`. To setup any other version, you may use the branch name or version specific tags. (eg. version-12, v11.1.15, v11) + - In this case, `edge` corresponds to `develop`. To setup any other version, you may use the branch name or version specific tags. (eg. v13.0.0, version-12, v11.1.15, v11) - `MYSQL_ROOT_PASSWORD=admin` - Bootstraps a MariaDB container with this value set as the root password. If a managed MariaDB instance is used, there is no need to set the password here. - `MARIADB_HOST=mariadb` diff --git a/docs/single-bench.md b/docs/single-bench.md index 1b5da2c7..a84c4862 100644 --- a/docs/single-bench.md +++ b/docs/single-bench.md @@ -26,9 +26,9 @@ cp env-production .env To get started, copy the existing `env-local` or `env-production` file to `.env`. By default, the file will contain the following variables: - `ERPNEXT_VERSION=edge` - - In this case, `edge` corresponds to `develop`. To setup any other version, you may use the branch name or version specific tags. (eg. version-12, v11.1.15, v11). + - In this case, `edge` corresponds to `develop`. To setup any other version, you may use the branch name or version specific tags. (eg. v13.0.0, version-12, v11.1.15, v11). - `FRAPPE_VERSION=edge` - - In this case, `edge` corresponds to `develop`. To setup any other version, you may use the branch name or version specific tags. (eg. version-12, v11.1.15, v11). + - In this case, `edge` corresponds to `develop`. To setup any other version, you may use the branch name or version specific tags. (eg. v13.0.0, version-12, v11.1.15, v11). - `MARIADB_HOST=mariadb` - Sets the hostname to `mariadb`. This is required if the database is managed by the containerized MariaDB instance. - `MYSQL_ROOT_PASSWORD=admin` diff --git a/docs/site-operations.md b/docs/site-operations.md index b90a7a96..f8a37417 100644 --- a/docs/site-operations.md +++ b/docs/site-operations.md @@ -128,7 +128,7 @@ Environment Variables Note: -- Above example will backup files in bucket called `backup` at location `frappe-bench-v12/site.name.com/DATE_TIME/DATE_TIME-site_name_com-{filetype}.{extension}`, +- Above example will backup files in bucket called `backup` at location `frappe-bench-v13/site.name.com/DATE_TIME/DATE_TIME-site_name_com-{filetype}.{extension}`, - example DATE_TIME: 20200325_042020. - example filetype: database, files or private-files - example extension: sql.gz or tar @@ -266,7 +266,7 @@ Environment Variables needed: - `DB_ROOT_USER`: MariaDB/PostgreSQL Root user. - `MYSQL_ROOT_PASSWORD`: Root User password for MariaDB. - `FORCE=1`: optional variable which force deletion of the same site. -- `NO_BACKUP=1`: option variable to skip the process of taking backup before deleting the site. +- `NO_BACKUP=1`: option variable to skip the process of taking backup before deleting the site. Environment Variables for PostgreSQL only: diff --git a/tests/docker-test.sh b/tests/docker-test.sh index 0a0d8c45..f1ca5972 100755 --- a/tests/docker-test.sh +++ b/tests/docker-test.sh @@ -48,8 +48,8 @@ echo -e "\e[1m\e[4mCopy env-example file\e[0m" cp env-example .env echo -e "\n" -echo -e "\e[1m\e[4mSet version to v12\e[0m" -sed -i -e "s/edge/v12/g" .env +echo -e "\e[1m\e[4mSet version to v13\e[0m" +sed -i -e "s/edge/v13/g" .env echo -e "\n" echo -e "\e[1m\e[4mStart Services\e[0m" @@ -76,13 +76,13 @@ docker run --name postgresql -d \ loopHealthCheck echo -e "\n" -echo -e "\e[1m\e[4mCreate new site (v12)\e[0m" +echo -e "\e[1m\e[4mCreate new site (v13)\e[0m" docker run -it \ -e "SITE_NAME=test.localhost" \ -e "INSTALL_APPS=erpnext" \ -v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \ --network frappebench00_default \ - frappe/erpnext-worker:v12 new + frappe/erpnext-worker:v13 new echo -e "\n" echo -e "\e[1m\e[4mPing created site\e[0m" @@ -94,7 +94,7 @@ curl -s http://test.localhost | w3m -T text/html -dump echo -e "\n" echo -e "\e[1m\e[4mSet version to edge\e[0m" -sed -i -e "s/v12/edge/g" .env +sed -i -e "s/v13/edge/g" .env echo -e "\n" echo -e "\e[1m\e[4mRestart containers with edge image\e[0m" diff --git a/travis.py b/travis.py index f8224053..6f801d36 100755 --- a/travis.py +++ b/travis.py @@ -9,6 +9,7 @@ def parse_args(): parser.add_argument('service', action='store', type=str, help='Name of the service to build: "erpnext" or "frappe"') parser.add_argument('-o', '--tag-only', required=False, action='store_true', dest='tag_only', help='Only tag an image and push it.') + parser.add_argument('-b', '--is-beta', required=False, default=False, action='store_true', dest='is_beta', help='Specify if tag is beta') image_type = parser.add_mutually_exclusive_group(required=True) image_type.add_argument('-a', '--nginx', action='store_const', dest='image_type', const='nginx', help='Build the nginx + static assets image') @@ -23,7 +24,7 @@ def parse_args(): return args -def git_version(service, version, branch): +def git_version(service, version, branch, is_beta=False): print(f'Pulling {service} v{version}') subprocess.run(f'git clone https://github.com/frappe/{service} --branch {branch}', shell=True) cd = os.getcwd() @@ -34,6 +35,10 @@ def git_version(service, version, branch): version = version.split('-')[0] version_tag = subprocess.check_output(f'git tag --list --sort=-version:refname "v{version}*" | sed -n 1p | sed -e \'s#.*@\(\)#\\1#\'', shell=True).strip().decode('ascii') + + if not is_beta: + version_tag = version_tag.split("-")[0] + os.chdir(cd) return version_tag @@ -61,7 +66,7 @@ def main(): if args.version: branch = 'version-' + args.version - tag = git_version(args.service, args.version, branch) + tag = git_version(args.service, args.version, branch, args.is_beta) if args.tag_only: tag_and_push(f'{args.service}-{args.image_type}', tag)