Use Nomad namespace in CI

This commit is contained in:
sirkrypt0
2021-05-11 16:38:24 +02:00
committed by Tobias Kantusch
parent 6da9080bce
commit b141a6870e
2 changed files with 8 additions and 1 deletions

View File

@ -131,6 +131,8 @@ test_e2e:
artifacts: false
- test_e2e
script:
- export NOMAD_NAMESPACE="$NOMAD_SLUG"
- nomad namespace apply $NOMAD_NAMESPACE
# Only replace set env vars
- envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < ci/api.tpl.nomad > ci/api.nomad
# Make sure to set NOMAD_ADDR, NOMAD_SKIP_VERIFY and NOMAD_TOKEN env vars in CI settings appropriately
@ -167,7 +169,10 @@ stop_review:
variables:
GIT_STRATEGY: none
script:
- nomad stop $NOMAD_SLUG
- export NOMAD_NAMESPACE="$NOMAD_SLUG"
# Stop all jobs before deleting the namespace
- nomad job status | cut -d" " -f1 | tail -n +2 | xargs -n1 nomad stop
- nomad namespace delete $NOMAD_NAMESPACE
environment:
name: $CI_COMMIT_REF_SLUG
action: stop

View File

@ -1,5 +1,6 @@
job "${NOMAD_SLUG}" {
datacenters = ["dc1"]
namespace = "${NOMAD_NAMESPACE}"
group "api" {
count = 1
@ -63,6 +64,7 @@ job "${NOMAD_SLUG}" {
env {
POSEIDON_SERVER_ADDRESS = "${POSEIDON_LISTEN_ADDRESS}"
POSEIDON_NOMAD_ADDRESS = "${NOMAD_SERVER_HOST}"
POSEIDON_NOMAD_NAMESPACE = "${NOMAD_NAMESPACE}"
}
resources {