Create demo job when deploying for review
This commit is contained in:

committed by
Tobias Kantusch

parent
b141a6870e
commit
24b7f1a2fa
@@ -115,7 +115,7 @@ test_e2e:
|
|||||||
- nomad agent -dev -log-level=WARN &
|
- nomad agent -dev -log-level=WARN &
|
||||||
- sleep 5
|
- sleep 5
|
||||||
# Setup Nomad job and wait for it
|
# Setup Nomad job and wait for it
|
||||||
- nomad run ci/python.nomad
|
- nomad run ci/e2e-test.nomad
|
||||||
- sleep 5
|
- sleep 5
|
||||||
# Start Poseidon and wait for it
|
# Start Poseidon and wait for it
|
||||||
- ./poseidon &
|
- ./poseidon &
|
||||||
@@ -130,9 +130,10 @@ test_e2e:
|
|||||||
- job: dockerimage
|
- job: dockerimage
|
||||||
artifacts: false
|
artifacts: false
|
||||||
- test_e2e
|
- test_e2e
|
||||||
script:
|
before_script:
|
||||||
- export NOMAD_NAMESPACE="$NOMAD_SLUG"
|
- export NOMAD_NAMESPACE="$NOMAD_SLUG"
|
||||||
- nomad namespace apply $NOMAD_NAMESPACE
|
- nomad namespace apply $NOMAD_NAMESPACE
|
||||||
|
script:
|
||||||
# Only replace set env vars
|
# Only replace set env vars
|
||||||
- envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < ci/api.tpl.nomad > ci/api.nomad
|
- 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
|
# Make sure to set NOMAD_ADDR, NOMAD_SKIP_VERIFY and NOMAD_TOKEN env vars in CI settings appropriately
|
||||||
@@ -154,6 +155,13 @@ deploy_review:
|
|||||||
name: $CI_COMMIT_REF_SLUG
|
name: $CI_COMMIT_REF_SLUG
|
||||||
url: http://$CI_ENVIRONMENT_SLUG.$BASE_DOMAIN
|
url: http://$CI_ENVIRONMENT_SLUG.$BASE_DOMAIN
|
||||||
on_stop: stop_review
|
on_stop: stop_review
|
||||||
|
before_script:
|
||||||
|
- export NOMAD_NAMESPACE="$NOMAD_SLUG"
|
||||||
|
- nomad namespace apply $NOMAD_NAMESPACE
|
||||||
|
- envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < ci/deploy-review.tpl.nomad > ci/deploy-review.nomad
|
||||||
|
- nomad validate ci/deploy-review.nomad
|
||||||
|
- nomad plan ci/deploy-review.nomad || [ $? == 1 ]
|
||||||
|
- nomad run ci/deploy-review.nomad
|
||||||
only:
|
only:
|
||||||
- branches
|
- branches
|
||||||
- tags
|
- tags
|
||||||
|
52
ci/deploy-review.tpl.nomad
Normal file
52
ci/deploy-review.tpl.nomad
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
// This job is used by our deploy CI stage to create a seed job.
|
||||||
|
|
||||||
|
job "python" {
|
||||||
|
datacenters = ["dc1"]
|
||||||
|
type = "batch"
|
||||||
|
namespace = "${NOMAD_NAMESPACE}"
|
||||||
|
|
||||||
|
group "python" {
|
||||||
|
ephemeral_disk {
|
||||||
|
migrate = false
|
||||||
|
size = 10
|
||||||
|
sticky = false
|
||||||
|
}
|
||||||
|
count = 5
|
||||||
|
scaling {
|
||||||
|
enabled = true
|
||||||
|
max = 300
|
||||||
|
}
|
||||||
|
spread {
|
||||||
|
// see https://www.nomadproject.io/docs/job-specification/spread#even-spread-across-data-center
|
||||||
|
// This spreads the load evenly amongst our nodes
|
||||||
|
attribute = "${node.unique.name}"
|
||||||
|
weight = 100
|
||||||
|
}
|
||||||
|
|
||||||
|
task "python" {
|
||||||
|
driver = "docker"
|
||||||
|
kill_timeout = "0s"
|
||||||
|
kill_signal = "SIGKILL"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "openhpi/co_execenv_python:3.8"
|
||||||
|
command = "sleep"
|
||||||
|
args = ["infinity"]
|
||||||
|
}
|
||||||
|
|
||||||
|
logs {
|
||||||
|
max_files = 1
|
||||||
|
max_file_size = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 40
|
||||||
|
memory = 40
|
||||||
|
}
|
||||||
|
|
||||||
|
restart {
|
||||||
|
delay = "0s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
// ToDo: Delete when creating job on test startup #26.
|
// This job is used by the e2e tests as a demo job.
|
||||||
|
|
||||||
job "python" {
|
job "python" {
|
||||||
datacenters = ["dc1"]
|
datacenters = ["dc1"]
|
||||||
type = "batch"
|
type = "batch"
|
Reference in New Issue
Block a user