Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 17 additions & 17 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,48 +121,48 @@ they be run in a production environment.
Set 2 environment variables and execute:

```bash
export TEST_ARCHIVIST="https://app.rkvst.io"
export TEST_AUTHTOKEN_FILENAME=credentials/authtoken
export RKVST_URL="https://app.rkvst.io"
export RKVST_AUTHTOKEN_FILENAME=credentials/authtoken
task functests
```

NOTE: For the access policy functional tests, two separate tenancy tokens are needed for successful test execution.
Therefore add a another env variable for the second tenancy's auth token:

```
export TEST_AUTHTOKEN_FILENAME_2=credentials/authtoken_tenant_2
export RKVST_AUTHTOKEN_FILENAME_2=credentials/authtoken_tenant_2
```

Alternatively one can use a direct environment variable for the authtoken:
```bash
export TEST_AUTHTOKEN_FILENAME=
export TEST_AUTHTOKEN="ey.....==="
export RKVST_AUTHTOKEN_FILENAME=
export RKVST_AUTHTOKEN="ey.....==="
task functests
```

Alternatively one can use a client id and secret obtained from the appregistrations endpoint:
```bash
export TEST_AUTHTOKEN_FILENAME=
export TEST_AUTHTOKEN=
export TEST_CLIENT_ID=c5db8230-6e1c-4b80-9481-d70e647c0429
export TEST_CLIENT_SECRET_FILENAME=credentials/client_secret
export RKVST_AUTHTOKEN_FILENAME=
export RKVST_AUTHTOKEN=
export RKVST_APPREG_CLIENT=c5db8230-6e1c-4b80-9481-d70e647c0429
export RKVST_APPREG_SECRET_FILENAME=credentials/client_secret
task functests
```

Additionally one set the appregistration directly in the environment:

```bash
export TEST_AUTHTOKEN_FILENAME=
export TEST_AUTHTOKEN=
export TEST_CLIENT_ID=c5db8230-6e1c-4b80-9481-d70e647c0429
export TEST_CLIENT_SECRET_FILENAME=
export TEST_CLIENT_SECRET="ey.....................ab=="
export RKVST_AUTHTOKEN_FILENAME=
export RKVST_AUTHTOKEN=
export RKVST_APPREG_CLIENT=c5db8230-6e1c-4b80-9481-d70e647c0429
export RKVST_APPREG_SECRET_FILENAME=
export RKVST_APPREG_SECRET="ey.....................ab=="
task functests
```
When running the runner tests one can specify a namespace to isolate instances of assets in differnt
runs:
```bash
export ARCHIVIST_NAMESPACE=${RANDOM}
export RKVST_NAMESPACE=${RANDOM}
FUNCTEST=execrunner task functests
```

Expand All @@ -171,14 +171,14 @@ Additional environment variables:
For testing sharing via an access policy requires a second auth token:

```bash
TEST_AUTHTOKEN_FILENAME_2=
RKVST_AUTHTOKEN_FILENAME_2=
```

Testing of the client token refresh logic can take 10 to 20 minutes to complete.
To enable this test set:

```bash
TEST_REFRESH_TOKEN=anything
RKVST_REFRESH_TOKEN=anything
```

#### Testing Other Python Versions
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ You can then use the examples code to create assets (see examples directory):
# client id is an environment variable. client_secret is stored in a file in a
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_filename environment variable.
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILENAME")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down Expand Up @@ -380,8 +380,8 @@ which should be called before anything else:
from archivist.archivist import Archivist

set_logger("DEBUG")
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILENAME")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down
2 changes: 1 addition & 1 deletion archivist/cmds/runner/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run(arch: archivist.Archivist, args):
# if namespace is specified on the commandline then override any environment
# setting...
if args.namespace:
environ["ARCHIVIST_NAMESPACE"] = args.namespace
environ["RKVST_NAMESPACE"] = args.namespace

with open(args.yamlfile, "r", encoding="utf-8") as yml:
arch.runner(parse_config(data=yml))
Expand Down
2 changes: 1 addition & 1 deletion archivist/cmds/template/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def run(arch: "type_helper.Archivist", args):
# if namespace is specified on the commandline then override any environment
# setting...
if args.namespace:
environ["ARCHIVIST_NAMESPACE"] = args.namespace
environ["RKVST_NAMESPACE"] = args.namespace

# environment is injected into the template
with open(args.values, "r", encoding="utf-8") as fd:
Expand Down
6 changes: 3 additions & 3 deletions archivist/notebooks/Create Asset and Events.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
"# URL = represents the url to the RKVST application\n",
"# CLIENT = represents the client ID from an Application Registration\n",
"# SECRET = represents the client secret from an Application Registration\n",
"RKVST_URL = getenv(\"URL\")\n",
"APPREG_CLIENT = getenv(\"CLIENT\")\n",
"APPREG_SECRET = getenv(\"SECRET\")"
"RKVST_URL = getenv(\"RKVST_URL\")\n",
"APPREG_CLIENT = getenv(\"RKVST_APPREG_CLIENT\")\n",
"APPREG_SECRET = getenv(\"RKVST_APPREG_SECRET\")"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions archivist/notebooks/Find Asset and Create Attachment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
"# URL = represents the url to the RKVST application\n",
"# CLIENT = represents the client ID from an Application Registration\n",
"# SECRET = represents the client secret from an Application Registration\n",
"RKVST_URL = getenv(\"URL\")\n",
"APPREG_CLIENT = getenv(\"CLIENT\")\n",
"APPREG_SECRET = getenv(\"SECRET\")"
"RKVST_URL = getenv(\"RKVST_URL\")\n",
"APPREG_CLIENT = getenv(\"RKVST_APPREG_CLIENT\")\n",
"APPREG_SECRET = getenv(\"RKVST_APPREG_SECRET\")"
]
},
{
Expand Down
14 changes: 7 additions & 7 deletions archivist/notebooks/Manage_Credentials.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"source": [
"# Retrieve the URL\n",
"\n",
"URL = getenv(\"TEST_ARCHIVIST\")\n",
"URL = getenv(\"RKVST_URL\")\n",
"print(\"URL\", URL)"
]
},
Expand Down Expand Up @@ -79,7 +79,7 @@
"source": [
"# extract JWT from environment\n",
"\n",
"auth_token = getenv(\"TEST_AUTHTOKEN\")\n",
"auth_token = getenv(\"RKVST_AUTHTOKEN\")\n",
"print(\"auth_token\", auth_token)"
]
},
Expand Down Expand Up @@ -126,10 +126,10 @@
"# AppRegistrations POST /archivist/iam/v1/application. Click on 'Try It Out', fill in the request body with a\n",
"# required display name. Custom claims can be deleted from the example in most cases.\n",
"\n",
"client_id = getenv(\"TEST_CLIENT_ID\")\n",
"client_id = getenv(\"RKVST_APPREG_CLIENT\")\n",
"print(\"client_id\", client_id)\n",
"\n",
"client_secret = getenv(\"TEST_CLIENT_SECRET\")\n",
"client_secret = getenv(\"RKVST_APPREG_SECRET\")\n",
"print(\"client_secret\", client_secret)"
]
},
Expand Down Expand Up @@ -173,9 +173,9 @@
"from archivist.utils import get_auth\n",
"\n",
"auth = get_auth(\n",
" auth_token=getenv(\"TEST_AUTHTOKEN\"),\n",
" client_id=getenv(\"TEST_CLIENT_ID\"),\n",
" client_secret=getenv(\"TEST_CLIENT_SECRET\"),\n",
" auth_token=getenv(\"RKVST_AUTHTOKEN\"),\n",
" client_id=getenv(\"RKVST_APPREG_CLIENT\"),\n",
" client_secret=getenv(\"RKVST_APPREG_SECRET\"),\n",
")\n",
"with Archivist(URL, auth) as arch:\n",
" print(arch)"
Expand Down
4 changes: 2 additions & 2 deletions docs/logger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ The first (optional) call from the archivist package is to set the logger.
from archivist.archivist import Archivist

set_logger("DEBUG")
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILENAME")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down
2 changes: 1 addition & 1 deletion docs/runner/components/assets_create.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The :code:`arc_namespace` (for the asset) and the :code:`namespace` (for the loc
to distinguish between assets and locations created between runs of the story.

Usually these field values are derived from an environment variable
:code:`ARCHIVIST_NAMESPACE` (default value is :code:`namespace`).
:code:`RKVST_NAMESPACE` (default value is :code:`namespace`).

The optional :code:`confirm: true` entry means that the step will wait for the asset to be completely created before moving on to the next step.

Expand Down
2 changes: 1 addition & 1 deletion docs/runner/components/assets_create_if_not_exists.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The :code:`arc_namespace` (for the asset) and the :code:`namespace` (for the loc
to distinguish between assets and locations created between runs of the story.

Usually these field values are derived from an environment variable
:code:`ARCHIVIST_NAMESPACE` (default value is :code:`namespace`).
:code:`RKVST_NAMESPACE` (default value is :code:`namespace`).

:code:`confirm: true` means that the step will wait for the asset to be completely created before moving on to the next step.

Expand Down
10 changes: 5 additions & 5 deletions examples/access_policies_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def main():
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_file environment variable.
auth = get_auth(
auth_token=getenv("ARCHIVIST_AUTHTOKEN"),
auth_token_filename=getenv("ARCHIVIST_AUTHTOKEN_FILENAME"),
client_id=getenv("ARCHIVIST_CLIENT_ID"),
client_secret=getenv("ARCHIVIST_CLIENT_SECRET"),
client_secret_filename=getenv("ARCHIVIST_CLIENT_SECRET_FILENAME"),
auth_token=getenv("RKVST_AUTHTOKEN"),
auth_token_filename=getenv("RKVST_AUTHTOKEN_FILENAME"),
client_id=getenv("RKVST_APPREG_CLIENT"),
client_secret=getenv("RKVST_APPREG_SECRET"),
client_secret_filename=getenv("RKVST_APPREG_SECRET_FILENAME"),
)

# Initialize connection to Archivist
Expand Down
4 changes: 2 additions & 2 deletions examples/access_policy_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def main():
# client id is an environment variable. client_secret is stored in a file in a
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_file environment variable.
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILE")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down
10 changes: 5 additions & 5 deletions examples/compliance_policies_since.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def get_archivist():
# the client_secret_file environment variable.
#
auth = get_auth(
auth_token=getenv("ARCHIVIST_AUTHTOKEN"),
auth_token_filename=getenv("ARCHIVIST_AUTHTOKEN_FILENAME"),
client_id=getenv("ARCHIVIST_CLIENT_ID"),
client_secret=getenv("ARCHIVIST_CLIENT_SECRET"),
client_secret_filename=getenv("ARCHIVIST_CLIENT_SECRET_FILENAME"),
auth_token=getenv("RKVST_AUTHTOKEN"),
auth_token_filename=getenv("RKVST_AUTHTOKEN_FILENAME"),
client_id=getenv("RKVST_APPREG_CLIENT"),
client_secret=getenv("RKVST_APPREG_SECRET"),
client_secret_filename=getenv("RKVST_APPREG_SECRET_FILENAME"),
)

# Initialize connection to Archivist
Expand Down
10 changes: 5 additions & 5 deletions examples/create_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ def main():
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_file environment variable.
auth = get_auth(
auth_token=getenv("ARCHIVIST_AUTHTOKEN"),
auth_token_filename=getenv("ARCHIVIST_AUTHTOKEN_FILENAME"),
client_id=getenv("ARCHIVIST_CLIENT_ID"),
client_secret=getenv("ARCHIVIST_CLIENT_SECRET"),
client_secret_filename=getenv("ARCHIVIST_CLIENT_SECRET_FILENAME"),
auth_token=getenv("RKVST_AUTHTOKEN"),
auth_token_filename=getenv("RKVST_AUTHTOKEN_FILENAME"),
client_id=getenv("RKVST_APPREG_CLIENT"),
client_secret=getenv("RKVST_APPREG_SECRET"),
client_secret_filename=getenv("RKVST_APPREG_SECRET_FILENAME"),
)

# Initialize connection to Archivist. max_time is the time to wait for confirmation
Expand Down
4 changes: 2 additions & 2 deletions examples/create_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def main():
# client id is an environment variable. client_secret is stored in a file in a
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_file environment variable.
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILE")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down
4 changes: 2 additions & 2 deletions examples/filter_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def main():
# client id is an environment variable. client_secret is stored in a file in a
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_file environment variable.
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILE")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down
4 changes: 2 additions & 2 deletions examples/filter_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def main():
# client id is an environment variable. client_secret is stored in a file in a
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_file environment variable.
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILE")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down
4 changes: 2 additions & 2 deletions examples/get_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def main():
# client id is an environment variable. client_secret is stored in a file in a
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_file environment variable.
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILE")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down
2 changes: 1 addition & 1 deletion examples/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run(arch: Archivist, args):
# if namespace is specified on the commandline then override any environment
# setting...
if args.namespace:
environ["ARCHIVIST_NAMESPACE"] = args.namespace
environ["RKVST_NAMESPACE"] = args.namespace

with open(args.yamlfile, "r", encoding="utf-8") as y:
arch.runner(parse_config(data=y))
Expand Down
10 changes: 5 additions & 5 deletions examples/sbom_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ def main():
rkvst_url = getenv("RKVST_URL")

auth = get_auth(
auth_token=getenv("AUTHTOKEN"),
auth_token_filename=getenv("AUTHTOKEN_FILENAME"),
client_id=getenv("CLIENT_ID"),
client_secret=getenv("CLIENT_SECRET"),
client_secret_filename=getenv("CLIENT_SECRET_FILENAME"),
auth_token=getenv("RKVST_AUTHTOKEN"),
auth_token_filename=getenv("RKVST_AUTHTOKEN_FILENAME"),
client_id=getenv("RKVST_APPREG_CLIENT"),
client_secret=getenv("RKVST_APPREG_SECRET"),
client_secret_filename=getenv("RKVST_APPREG_SECRET_FILENAME"),
)

with Archivist(rkvst_url, auth, verify=False, max_time=300) as arch:
Expand Down
12 changes: 6 additions & 6 deletions examples/scan_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ def main():
main entry point
"""
auth = get_auth(
auth_token=getenv("TEST_AUTHTOKEN"),
auth_token_filename=getenv("TEST_AUTHTOKEN_FILENAME"),
client_id=getenv("TEST_CLIENT_ID"),
client_secret=getenv("TEST_CLIENT_SECRET"),
client_secret_filename=getenv("TEST_CLIENT_SECRET_FILENAME"),
auth_token=getenv("RKVST_AUTHTOKEN"),
auth_token_filename=getenv("RKVST_AUTHTOKEN_FILENAME"),
client_id=getenv("RKVST_APPREG_CLIENT"),
client_secret=getenv("RKVST_APPREG_SECRET"),
client_secret_filename=getenv("RKVST_APPREG_SECRET_FILENAME"),
)

with Archivist(getenv("TEST_ARCHIVIST"), auth, verify=False, max_time=300) as arch:
with Archivist(getenv("RKVST_URL"), auth, verify=False, max_time=300) as arch:

print("##[group]Today")
today = date.today()
Expand Down
2 changes: 1 addition & 1 deletion examples/sharing_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def create_archivist(label):
# could indicate different users in the same organization or membership of different
# organiastions.
auth = get_auth(
auth_token=getenv(f"ARCHIVIST_AUTHTOKEN_{label}"),
auth_token=getenv(f"RKVST_AUTHTOKEN_{label}"),
)
# Initialize connection to Archivist. max_time is the time to wait for confirmation
# of an asset or event creation - the default is 1200 seconds but one can optionally
Expand Down
4 changes: 2 additions & 2 deletions examples/subject_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def main():
# client id is an environment variable. client_secret is stored in a file in a
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_file environment variable.
client_id = getenv("ARCHIVIST_CLIENT_ID")
client_secret_file = getenv("ARCHIVIST_CLIENT_SECRET_FILE")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand Down
Loading