Skip to content

Commit df5dc17

Browse files
committed
fixes + docs regarding scripts/
1 parent e687006 commit df5dc17

5 files changed

Lines changed: 44 additions & 11 deletions

File tree

scripts/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
11
# ckan-cloud-operator scripts
22

33
misc. scripts which are typically executed from an automation app like Jenkins.
4+
5+
## Running scripts from automation tools
6+
7+
Set the required operator version:
8+
9+
```
10+
CKAN_CLOUD_OPERATOR_VERSION="v0.2.2"
11+
```
12+
13+
Set the script name and extension:
14+
15+
```
16+
SCRIPT_NAME="configuration and secrets management"
17+
SCRIPT_EXT="sh"
18+
```
19+
20+
Check the script file for required env vars, for example:
21+
22+
```
23+
export ACTION=get
24+
export ARGS="--namespace ckan-cloud"
25+
```
26+
27+
Run the script:
28+
29+
```
30+
curl -L "https://raw.githubusercontent.com/ViderumGlobal/ckan-cloud-operator/${CKAN_CLOUD_OPERATOR_VERSION}/scripts/$(echo "$SCRIPT_NAME" | sed 's/ /%20/g').${SCRIPT_EXT}" \
31+
| tee /dev/stderr \
32+
| if [ "${SCRIPT_EXT}" == "py" ]; then python3; else bash; fi
33+
```

scripts/cluster resources datapackage.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#!/usr/bin/env bash
22

3-
export DATAPACKAGE_PREFIX="${1}"
4-
export NON_CKAN_INSTANCES="${2}"
5-
export SKIP_CKAN_IMAGES="${3}"
3+
echo DATAPACKAGE_PREFIX="${DATAPACKAGE_PREFIX}"
4+
echo NON_CKAN_INSTANCES="${NON_CKAN_INSTANCES}"
5+
echo SKIP_CKAN_IMAGES="${SKIP_CKAN_IMAGES}"
6+
67
[ -z "${DATAPACKAGE_PREFIX}" ] && echo invalid args && exit 1
7-
echo DATAPACKAGE_PREFIX=$DATAPACKAGE_PREFIX
8-
echo NON_CKAN_INSTANCES=$NON_CKAN_INSTANCES
98

109
rm -rf .checkpoints &&\
11-
rm -rf data/$DATAPACKAGE_PREFIX &&\
10+
rm -rf "data/${DATAPACKAGE_PREFIX}" &&\
1211
python3 /home/jenkins/ckan-cloud-operator/ckan_cloud_operator/dataflows/resources.py
1312
[ "$?" != "0" ] && exit 1
1413
! python3 -c "
@@ -29,3 +28,5 @@ Flow(
2928
).process()
3029
" > dockerfiles.html && exit 1
3130
fi
31+
32+
exit 0

scripts/configuration and secrets management.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env bash
22

3-
export ACTION="${1}"
4-
export ARGS="${2}"
3+
echo ACTION="${ACTION}"
4+
echo ARGS="${ARGS}"
5+
56
! python3 -c "exit(0 if '${ACTION}' in [
67
'get', 'set', 'list-configs', 'kubectl get secret'
78
] else 1)" && echo invalid ACTION && exit 1

scripts/create route.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env bash
22

3-
export CREATE_CMD="${1}"
4-
export EXTRA_ARGS="${2}"
3+
echo CREATE_CMD="${CREATE_CMD}"
4+
echo EXTRA_ARGS="${EXTRA_ARGS}"
5+
56
! python3 -c "exit(0 if '${CREATE_CMD}' in [
67
'create-deis-instance-subdomain-route', 'create-backend-url-subdomain-route'
78
] else 1)" && echo invalid CREATE_CMD && exit 1

scripts/update route.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
22

3-
export ARGS="${1}"
3+
echo ARGS="${ARGS}"
44

55
ckan-cloud-operator routers update ${ARGS}

0 commit comments

Comments
 (0)