-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
48 lines (38 loc) · 1.77 KB
/
Copy pathJustfile
File metadata and controls
48 lines (38 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cortex_cli := 'cortex'
export CORTEX_API_KEY := env('CORTEX_API_KEY')
export CORTEX_BASE_URL := env('CORTEX_BASE_URL', "https://api.getcortexapp.com")
export CORTEX_EMAIL := env('CORTEX_EMAIL')
export GH_PAT := env('GH_PAT')
brew := require("brew")
cortex := require("cortex")
jq := require("jq")
yq := require("yq")
@help:
just -l
echo ""
echo "Details"
echo "The setup recipe requires the following environment variables to be set:"
echo "- CORTEX_API_KEY - must have edit entity permission at a minimum, typically will be an admin key"
echo "- CORTEX_BASE_URL - API endpoint, defaults to https://api.getcortexapp.com"
echo "- CORTEX_EMAIL - the user's cortex email address; will be used to assign as owner of the Learn Cortex entity"
echo "- GH_PAT - a GitHub personal token that allows read/write access to github.com/cortexapps"
# Add test entities and Scorecard to Cortex instance
setup: load-data _success
_success:
@echo "SUCCESS!"
@echo "Login to your tenant and navigate to your Learn Cortex entity to starting learning Cortex."
# Install a single Cortex Scorecard file
scorecard file:
{{cortex_cli}} scorecard create -f {{file}}
# Load data from 'data' directory into Cortex
load-data: _github
@echo "Adding data to tenant"
{{cortex_cli}} backup import -d data
@cat data/catalog/learn-cortex.yaml | yq -e ".info.x-cortex-owners = [{ \"email\": \"${CORTEX_EMAIL}\", \"type\": \"EMAIL\" }]" | cortex catalog create -f- > /dev/null 2>&1
# Add secrets needed for the Learn Cortex entity
_github:
#!/bin/bash
cortex integrations github list | jq -r ".configurations[].alias" | grep -e "cortex-prod\$" > /dev/null
if [[ $? -ne 0 ]]; then
cortex integrations github add-personal -a "cortex-prod" --access-token ${GH_PAT}
fi