Skip to content

Commit

Permalink
Merge 7e4ff68 into 4408587
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidalgarcia committed Sep 4, 2020
2 parents 4408587 + 7e4ff68 commit eb3511f
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ install:
- export PATH=$PWD/bin:$PATH

script:
- make test
- ./run-tests.sh

after_success:
- coveralls
9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,4 @@ teardown: # Destroy local host virtual environment and Minikube. All traces go.
rm -rf ${HOME}/.virtualenvs/${INSTANCE_NAME}
@echo "You may also consider to run rm -rf ~/.minikube"

test: # Run unit tests on the REANA package.
pydocstyle reana
black --check .
check-manifest
sphinx-build -qnNW docs docs/_build/html
python setup.py test
sphinx-build -qnNW -b doctest docs docs/_build/doctest
helm lint helm/reana

# end of file
3 changes: 2 additions & 1 deletion reana/reana_dev/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ def reana_dev(): # noqa: D301
$ # example (a): fast, CLI mode only, fast example
$ reana-dev cluster-delete
$ reana-dev run-ci -m /var/reana:/var/reana -c r-d-helloworld --exclude-components=r-ui,r-a-vomsproxy
--admin-email john.doe@example.org --admin-password mysecretpassword
$ # example (b): slow, CLI and Web modes, all examples
$ reana-dev cluster-delete
$ reana-dev run-ci
$ reana-dev run-ci --admin-email john.doe@example.org --admin-password mysecretpassword
How to create REANA cluster:
Expand Down
23 changes: 20 additions & 3 deletions reana/reana_dev/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,23 @@ def run_commands():
default=["DEMO"],
help="Which examples to run? [default=DEMO]",
)
@click.option(
"--admin-email", required=True, help="Admin user email address",
)
@click.option(
"--admin-password", required=True, help="Admin user password",
)
@run_commands.command(name="run-ci")
def run_ci(
build_arg, mode, exclude_components, mounts, job_mounts, no_cache, component,
build_arg,
mode,
exclude_components,
mounts,
job_mounts,
no_cache,
component,
admin_email,
admin_password,
): # noqa: D301
"""Run CI build.
Expand All @@ -162,12 +176,15 @@ def run_ci(
\b
Example:
$ reana-dev run-cli -m /var/reana:/var/reana
$ reana-dev run-ci -m /var/reana:/var/reana
-m /usr/share/local/mydata:/mydata
-j /mydata:/mydata
-c r-d-helloworld
--exclude-components=r-ui,r-a-vomsproxy
--mode debug
--admin-email john.doe@example.org
--admin-password mysecretpassword
"""
# parse arguments
components = select_components(component)
Expand Down Expand Up @@ -204,7 +221,7 @@ def run_ci(
# deploy cluster
cmd = (
f"reana-dev cluster-deploy --mode {mode}"
" --admin-email john.doe@example.org --admin-password 123456"
f" --admin-email {admin_email} --admin-password {admin_password}"
)
for job_mount in job_mounts:
cmd += " -j {}".format(job_mount)
Expand Down
27 changes: 27 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
#
# This file is part of REANA.
# Copyright (C) 2020 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

# Quit on errors
set -o errexit

# Quit on unbound symbols
set -o nounset

check_black() {
echo '==> [INFO] Checking Black compliance...'
black --check .
}

pydocstyle reana
check_black
check-manifest
sphinx-build -qnNW docs docs/_build/html
python setup.py test
sphinx-build -qnNW -b doctest docs docs/_build/doctest
helm lint helm/reana
echo '==> [INFO] All tests passed! ✅'
10 changes: 5 additions & 5 deletions scripts/create-admin-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ REANA_SERVER=$(kubectl get pod -l "app=$instance_name-server" | grep Running | a

# Wait for DB to be ready
REANA_DB=$(kubectl get pod -l "app=$instance_name-db" | grep Running | awk '{print $1}')
echo $REANA_DB
echo "$REANA_DB"
while [ "0" -ne "$(kubectl exec "$REANA_DB" -- pg_isready -U reana -h 127.0.0.1 -p 5432 &> /dev/null && echo $? || echo 1)" ]
do
echo "Waiting for REANA-DB to be ready."
Expand All @@ -34,11 +34,11 @@ echo "REANA-DB ready"
kubectl exec "$REANA_SERVER" -- ./scripts/setup

# Create admin user
admin_access_token=$(kubectl exec "$REANA_SERVER" -- \
flask reana-admin create-admin-user --email $email_address --password $password)
if [ $? -ne 0 ]; then
if ! admin_access_token=$(kubectl exec "$REANA_SERVER" -- \
flask reana-admin create-admin-user --email "$email_address" --password "$password")
then
# Failure output
echo $admin_access_token
echo "$admin_access_token"
exit 1
fi

Expand Down

0 comments on commit eb3511f

Please sign in to comment.