Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
087d272
Filter out empty missing_revs results in mem3_rep
nickva Dec 6, 2018
53dca95
Fix function_clause error
Nov 28, 2018
0c54ac9
Fix end_time field in /_replicate response
nickva Jan 8, 2019
047179a
Fix fabric_open_doc_revs
davisp Jan 15, 2019
c95a40d
Support one purge request with more than 100 docid
jiangphcn Jan 17, 2019
d01dbc4
Fix timeout in chttpd_purge_tests
davisp Jan 18, 2019
d167f70
Add new /{db}/_sync_shards endpoint (admin-only) (#1811)
wohali Jan 18, 2019
bec41ac
add default fabric request timeouts
garrensmith Nov 29, 2018
40a1350
Update to mochiweb 2.19.0
nickva Jan 22, 2019
eb676ff
restrict _purge to server admin
jiangphcn Jan 28, 2019
d681748
Compaction: Add snooze_period_ms for finer tuning (#1880)
adrienverge Jan 31, 2019
d06641b
Fix badarg crash on invalid rev for individual doc update
eiri Feb 5, 2019
bc31155
Fix from_json_obj_validate crash when provided rev isn't a valid hex
eiri Feb 1, 2019
aeb7772
dev/run: do not create needless dev/data/ dir
wohali Nov 30, 2018
7c1ed3e
Format and check all code using python black (#1776)
wohali Dec 6, 2018
6d82d96
Fix python2 compatibility for couchup (#1868)
pealthoff Jan 21, 2019
008ce52
fix couchup for python3 (#1905)
klaemo Feb 7, 2019
9a8f0cc
Blacklist known bad Erlang releases, fixes #1857 (#1871)
wohali Jan 23, 2019
f9fde69
run formatting check before time-consuming tests
rnewson Feb 6, 2019
5ffd8b7
drop Erlang 17 from travis
janl Feb 7, 2019
50bb9cc
Fix read repair in a mixed cluster environment
davisp Jan 14, 2019
18b59cb
Update config dependency to 2.1.5
nickva Jan 24, 2019
64d026a
Add `couch_db:get_design_doc/2`
davisp Dec 5, 2018
fc27f75
Avoid calls to `fabric:design_docs/1`
davisp Dec 5, 2018
8027f6a
update Fauxton to 1.1.20
janl Feb 12, 2019
bb99f30
Sync admin password hashes at cluster setup finish
jaydoane Feb 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.pyc
*.swp
*~
.venv
.DS_Store
.rebar/
.eunit/
Expand Down
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ os: linux
dist: trusty

otp_release:
- 21.1
- 20.3
- 21.2.3
- 20.3.8.5
- 19.3
- 18.3
- 17.5

addons:
apt:
sources:
- deadsnakes
packages:
- build-essential
- curl
- libcurl4-openssl-dev
- libicu-dev
- libmozjs185-dev
- pkg-config
- python3
- python3.6
- python3.6-venv
- python3-requests
- python3-sphinx
- python3.4-venv
# - sphinx-rtd-theme
- help2man
- shunit2
Expand All @@ -47,9 +48,12 @@ env:

# Then comment this section out
before_script:
- kerl list installations
- rm -rf /tmp/couchjslogs
- mkdir -p /tmp/couchjslogs
- ./configure -c --disable-docs --disable-fauxton
- python3.6 -m venv /tmp/.venv
- source /tmp/.venv/bin/activate

script:
- make check
Expand Down
29 changes: 26 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ fauxton: share/www
check: all
@$(MAKE) test-cluster-with-quorum
@$(MAKE) test-cluster-without-quorum
@$(MAKE) python-black
@$(MAKE) eunit
@$(MAKE) javascript
@$(MAKE) mango-test
Expand Down Expand Up @@ -171,6 +172,27 @@ soak-eunit: couch
@$(REBAR) setup_eunit 2> /dev/null
while [ $$? -eq 0 ] ; do $(REBAR) -r eunit $(EUNIT_OPTS) ; done

.venv/bin/black:
@python3 -m venv .venv
@.venv/bin/pip3 install black || touch .venv/bin/black

# Python code formatter - only runs if we're on Python 3.6 or greater
python-black: .venv/bin/black
@python3 -c "import sys; exit(1 if sys.version_info < (3,6) else 0)" || \
echo "Python formatter not supported on Python < 3.6; check results on a newer platform"
@python3 -c "import sys; exit(1 if sys.version_info >= (3,6) else 0)" || \
LC_ALL=C.UTF-8 LANG=C.UTF-8 .venv/bin/black --check \
--exclude="build/|buck-out/|dist/|_build/|\.git/|\.hg/|\.mypy_cache/|\.nox/|\.tox/|\.venv/|src/rebar/pr2relnotes.py|src/fauxton" \
. dev/run rel/overlay/bin/couchup test/javascript/run

python-black-update: .venv/bin/black
@python3 -c "import sys; exit(1 if sys.version_info < (3,6) else 0)" || \
echo "Python formatter not supported on Python < 3.6; check results on a newer platform"
@python3 -c "import sys; exit(1 if sys.version_info >= (3,6) else 0)" || \
LC_ALL=C.UTF-8 LANG=C.UTF-8 .venv/bin/black \
--exclude="build/|buck-out/|dist/|_build/|\.git/|\.hg/|\.mypy_cache/|\.nox/|\.tox/|\.venv/|src/rebar/pr2relnotes.py|src/fauxton" \
. dev/run rel/overlay/bin/couchup test/javascript/run

.PHONY: elixir
elixir: elixir-check-formatted
@rm -rf dev/lib
Expand Down Expand Up @@ -285,9 +307,9 @@ build-test:
# target: mango-test - Run Mango tests
mango-test: devclean all
@cd src/mango && \
python3 -m venv venv && \
venv/bin/pip3 install -r requirements.txt
@cd src/mango && ../../dev/run -n 1 --admin=testuser:testpass venv/bin/nosetests
python3 -m venv .venv && \
.venv/bin/pip3 install -r requirements.txt
@cd src/mango && ../../dev/run -n 1 --admin=testuser:testpass .venv/bin/nosetests

################################################################################
# Developing
Expand Down Expand Up @@ -400,6 +422,7 @@ clean:
@rm -rf src/couch/priv/{couchspawnkillable,couchjs}
@rm -rf share/server/main.js share/server/main-coffee.js
@rm -rf tmp dev/data dev/lib dev/logs
@rm -rf src/mango/.venv
@rm -f src/couch/priv/couchspawnkillable
@rm -f src/couch/priv/couch_js/config.h
@rm -f dev/boot_node.beam dev/pbkdf2.pyc log/crash.log
Expand Down
28 changes: 25 additions & 3 deletions Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ check: all
@$(MAKE) -f Makefile.win test-cluster-without-quorum
@$(MAKE) -f Makefile.win eunit
@$(MAKE) -f Makefile.win javascript
@$(MAKE) -f Makefile.win python-black
@$(MAKE) -f Makefile.win mango-test
# @$(MAKE) -f Makefile.win elixir

Expand All @@ -142,6 +143,26 @@ just-eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
just-eunit:
@$(REBAR) -r eunit $(EUNIT_OPTS)

.venv/bin/black:
@python.exe -m venv .venv
@.venv\Scripts\pip3.exe install black || copy /b .venv\Scripts\black.exe +,,

# Python code formatter - only runs if we're on Python 3.6 or greater
python-black: .venv/bin/black
@python.exe -c "import sys; exit(1 if sys.version_info < (3,6) else 0)" || \
echo "Python formatter not supported on Python < 3.6; check results on a newer platform"
@python.exe -c "import sys; exit(1 if sys.version_info >= (3,6) else 0)" || \
.venv\Scripts\black.exe --check \
--exclude="build/|buck-out/|dist/|_build/|\.git/|\.hg/|\.mypy_cache/|\.nox/|\.tox/|\.venv/|src/rebar/pr2relnotes.py|src/fauxton" \
. dev\run rel\overlay\bin\couchup test\javascript\run

python-black-update: .venv/bin/black
@python.exe -c "import sys; exit(1 if sys.version_info < (3,6) else 0)" || \
echo "Python formatter not supported on Python < 3.6; check results on a newer platform"
@python.exe -c "import sys; exit(1 if sys.version_info >= (3,6) else 0)" || \
.venv\Scripts\black.exe \
--exclude="build/|buck-out/|dist/|_build/|\.git/|\.hg/|\.mypy_cache/|\.nox/|\.tox/|\.venv/|src/rebar/pr2relnotes.py|src/fauxton" \
. dev\run rel\overlay\bin\couchup test\javascript\run

.PHONY: elixir
elixir: elixir-check-formatted
Expand Down Expand Up @@ -205,9 +226,9 @@ endif
.PHONY: mango-test
mango-test: devclean all
@cd src\mango && \
python.exe -m venv venv && \
venv\Scripts\pip.exe install -r requirements.txt
@cd src\mango && venv\Scripts\python.exe ..\..\dev\run -n 1 --admin=testuser:testpass venv\Scripts\nosetests
python.exe -m venv .venv && \
.venv\Scripts\pip.exe install -r requirements.txt
@cd src\mango && .venv\Scripts\python.exe ..\..\dev\run -n 1 --admin=testuser:testpass .venv\Scripts\nosetests


.PHONY: check-qs
Expand Down Expand Up @@ -330,6 +351,7 @@ clean:
-@rmdir /s/q dev\data
-@rmdir /s/q dev\lib
-@rmdir /s/q dev\logs
-@rmdir /s/q src\mango\.venv
-@del /f/q src\couch\priv\couch_js\config.h
-@del /f/q dev\boot_node.beam dev\pbkdf2.pyc log\crash.log

Expand Down
104 changes: 59 additions & 45 deletions build-aux/logfile-uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# the License.



import datetime
import glob
import json
Expand All @@ -26,96 +25,111 @@
COUCH_URL = "https://couchdb-vm2.apache.org/ci_errorlogs"
TARFILE = "couchlog.tar.gz"


def _tojson(req):
"""Support requests v0.x as well as 1.x+"""
if requests.__version__[0] == '0':
if requests.__version__[0] == "0":
return json.loads(req.content)
return req.json()


def collect_logfiles():
""" Find and tarball all logfiles """
tb = tarfile.open(name=TARFILE, mode='w:gz')
tb = tarfile.open(name=TARFILE, mode="w:gz")
# EUnit
for log in glob.glob('src/*/.eunit/couch.log'):
for log in glob.glob("src/*/.eunit/couch.log"):
tb.add(log)
# JS harness
for log in glob.glob('dev/logs/node1.log'):
for log in glob.glob("dev/logs/node1.log"):
tb.add(log)
# couchjs OS process IO logs
for log in glob.glob('/tmp/couchjslogs/*'):
for log in glob.glob("/tmp/couchjslogs/*"):
tb.add(log)
tb.close()


def build_ci_doc():
""" Build a metadata document with relevant detail from CI env """
doc = {}
if 'TRAVIS' in os.environ:
doc['builder'] = 'travis'
doc['build_id'] = os.environ['TRAVIS_JOB_ID']
doc['erlang'] = os.environ['TRAVIS_OTP_RELEASE']
doc['url'] = 'https://travis-ci.org/apache/couchdb/jobs/' + \
os.environ['TRAVIS_JOB_ID']
doc['branch'] = os.environ['TRAVIS_BRANCH']
doc['commit'] = os.environ['TRAVIS_COMMIT']
doc['repo'] = 'https://github.com/' + os.environ['TRAVIS_REPO_SLUG']
elif 'JENKINS_URL' in os.environ:
doc['builder'] = 'jenkins'
doc['build_id'] = os.environ['BUILD_NUMBER']
doc['url'] = os.environ['BUILD_URL']
doc['branch'] = os.environ['BRANCH_NAME']
doc['repo'] = 'https://github.com/apache/couchdb'
if "TRAVIS" in os.environ:
doc["builder"] = "travis"
doc["build_id"] = os.environ["TRAVIS_JOB_ID"]
doc["erlang"] = os.environ["TRAVIS_OTP_RELEASE"]
doc["url"] = (
"https://travis-ci.org/apache/couchdb/jobs/" + os.environ["TRAVIS_JOB_ID"]
)
doc["branch"] = os.environ["TRAVIS_BRANCH"]
doc["commit"] = os.environ["TRAVIS_COMMIT"]
doc["repo"] = "https://github.com/" + os.environ["TRAVIS_REPO_SLUG"]
elif "JENKINS_URL" in os.environ:
doc["builder"] = "jenkins"
doc["build_id"] = os.environ["BUILD_NUMBER"]
doc["url"] = os.environ["BUILD_URL"]
doc["branch"] = os.environ["BRANCH_NAME"]
doc["repo"] = "https://github.com/apache/couchdb"
else:
doc['builder'] = 'manual'
doc["builder"] = "manual"
# TODO: shell out to get correct repo, commit, branch info?
doc['repo'] = 'https://github.com/apache/couchdb'
doc['build_id'] = str(time.time())
doc["repo"] = "https://github.com/apache/couchdb"
doc["build_id"] = str(time.time())

# shorten doc id
repo = doc['repo'].split('/')[-1]
repo = repo.replace('.git', '')

doc['_id'] = doc['builder'] + '-' + repo + '-' + \
doc['build_id'] + \
'-' + datetime.datetime.utcnow().isoformat()
repo = doc["repo"].split("/")[-1]
repo = repo.replace(".git", "")

doc["_id"] = (
doc["builder"]
+ "-"
+ repo
+ "-"
+ doc["build_id"]
+ "-"
+ datetime.datetime.utcnow().isoformat()
)

return doc


def upload_logs():
try:
lp = os.environ['COUCHAUTH'].split(':')
lp = os.environ["COUCHAUTH"].split(":")
except KeyError as e:
print ("ERROR: COUCHAUTH credentials unavailable! "
"Unable to upload logfiles.")
print("ERROR: COUCHAUTH credentials unavailable! " "Unable to upload logfiles.")
exit(1)

creds = (lp[0], lp[1])
doc = build_ci_doc()
req = requests.post(COUCH_URL,
req = requests.post(
COUCH_URL,
data=json.dumps(doc),
auth=creds,
headers={'Content-type': 'application/json'})
headers={"Content-type": "application/json"},
)
req.raise_for_status()
req = _tojson(req)
with open(TARFILE, 'rb') as f:
with open(TARFILE, "rb") as f:
# ancient versions of requests break if data is iterable
fdata = f.read()
req2 = requests.put(COUCH_URL + '/' + doc['_id'] + '/' + TARFILE,
headers={'Content-type': 'application/x-gtar'},
req2 = requests.put(
COUCH_URL + "/" + doc["_id"] + "/" + TARFILE,
headers={"Content-type": "application/x-gtar"},
auth=creds,
params={'rev': req['rev']},
data=fdata)
params={"rev": req["rev"]},
data=fdata,
)
req2.raise_for_status()
return req2


def main():
""" Find latest logfile and upload to Couch logfile db. """
print ("Uploading logfiles...")
print("Uploading logfiles...")
collect_logfiles()
req = upload_logs()
print (req.url.split('?')[0])
print (req.content)
print ("Upload complete!")
print(req.url.split("?")[0])
print(req.content)
print("Upload complete!")


if __name__ == '__main__':
if __name__ == "__main__":
main()
Loading