
* keep ./services for instances ./profiles is for config-only modules ./services are like profiles, but configure a single instance of a service. Those are fronted by Nginx as the load-balancer and have a DNS entry as well. * ci: build build03 as well * move hydra to services * move matterbridge to services * move marvin-mk2 to services * build01: share the remainder profiles * build02: use the nix-community-cache * fixup kexec * rename profiles to roles * README: sync with reality
45 lines
1.3 KiB
Bash
Executable file
45 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Usage example
|
|
# URL=http://localhost:3000 ./create-declarative-project.sh
|
|
|
|
set -euo pipefail
|
|
|
|
HYDRA_ADMIN_USERNAME=${HYDRA_ADMIN_USERNAME:-admin}
|
|
HYDRA_ADMIN_PASSWORD=${HYDRA_ADMIN_PASSWORD:-admin}
|
|
URL=${URL:-http://localhost:3000}
|
|
DECL_FILE=${DECL_FILE:-"spec.json"}
|
|
DECL_TYPE=${DECL_TYPE:-"git"}
|
|
DECL_VALUE=${DECL_VALUE:-"https://github.com/shlevy/declarative-hydra-example"}
|
|
DECL_PROJECT_NAME=${DECL_PROJECT_NAME:-"example"}
|
|
DECL_DISPLAY_NAME=${DECL_DISPLAY_NAME:-"An example project"}
|
|
DECL_DESCRIPTION=${DECL_DESCRIPTION:-""}
|
|
DECL_HOMEPAGE=${DECL_HOMEPAGE:-""}
|
|
|
|
mycurl() {
|
|
curl --fail --referer "${URL}" -H "Accept: application/json" -H "Content-Type: application/json" "$@"
|
|
}
|
|
|
|
echo "Logging to $URL with user $HYDRA_ADMIN_USERNAME"
|
|
cat >data.json <<EOF
|
|
{ "username": "$HYDRA_ADMIN_USERNAME", "password": "$HYDRA_ADMIN_PASSWORD" }
|
|
EOF
|
|
mycurl -X POST -d '@data.json' "$URL/login" -c hydra-cookie.txt
|
|
|
|
echo -e "\nCreating project:"
|
|
cat >data.json <<EOF
|
|
{
|
|
"displayname":"$DECL_DISPLAY_NAME",
|
|
"description":"$DECL_DESCRIPTION",
|
|
"homepage":"$DECL_HOMEPAGE",
|
|
"enabled":"1",
|
|
"visible":"1",
|
|
"declfile": "$DECL_FILE",
|
|
"decltype":"$DECL_TYPE",
|
|
"declvalue":"$DECL_VALUE"
|
|
}
|
|
EOF
|
|
cat data.json
|
|
mycurl --silent -X PUT "$URL/project/$DECL_PROJECT_NAME" -d @data.json -b hydra-cookie.txt
|
|
|
|
rm -f data.json hydra-cookie.txt
|