diff --git a/HadesScheduler/docker/docker.go b/HadesScheduler/docker/docker.go index 43b7f2b..148f48a 100644 --- a/HadesScheduler/docker/docker.go +++ b/HadesScheduler/docker/docker.go @@ -196,6 +196,10 @@ func (s DockerStep) execute(ctx context.Context) error { } job_id := ctx.Value(jobIDContextKey("job_id")).(string) + + // Add the job_id to the container envs + envs = append(envs, fmt.Sprintf("UUID=%s", job_id)) + container_config := container.Config{ Image: s.Image, Env: envs, diff --git a/HadesScheduler/k8s/job.go b/HadesScheduler/k8s/job.go index 77ced1a..bb22f4f 100644 --- a/HadesScheduler/k8s/job.go +++ b/HadesScheduler/k8s/job.go @@ -137,7 +137,11 @@ func (k K8sJob) volumeSpec(cm corev1.ConfigMap) []corev1.Volume { func (k K8sJob) containerSpec() []corev1.Container { containerSpec := []corev1.Container{} + // Add the uuid to the job metadata + k.Metadata["UUID"] = k.ID.String() + for _, step := range k.Steps { + k8sStep := K8sStep{ step: step, sharedVolumeName: k.sharedVolumeName, diff --git a/docs/api/Create Build Job (long-running-debug).bru b/docs/api/Create Build Job (long-running-debug).bru new file mode 100644 index 0000000..ba88001 --- /dev/null +++ b/docs/api/Create Build Job (long-running-debug).bru @@ -0,0 +1,55 @@ +meta { + name: Create Build Job (long-running-debug) + type: http + seq: 3 +} + +post { + url: http://{{hostname}}/build + body: json + auth: none +} + +body:json { + { + "name": "Example Job", + "metadata": { + "GLOBAL": "test" + }, + "timestamp": "2021-01-01T00:00:00.000Z", + "priority": 3, // optional, default 3 + "steps": [ + { + "id": 1, // mandatory to declare the order of execution + "name": "Clone", + "image": "ghcr.io/ls1intum/hades/hades-clone-container:latest", // mandatory + "metadata": { + "REPOSITORY_DIR": "/shared", + "HADES_TEST_USERNAME": "{{user}}", + "HADES_TEST_PASSWORD": "{{password}}", + "HADES_TEST_URL": "{{test_repo}}", + "HADES_TEST_PATH": "./example", + "HADES_TEST_ORDER": "1", + "HADES_ASSIGNMENT_USERNAME": "{{user}}", + "HADES_ASSIGNMENT_PASSWORD": "{{password}}", + "HADES_ASSIGNMENT_URL": "{{assignment_repo}}", + "HADES_ASSIGNMENT_PATH": "./example/assignment", + "HADES_ASSIGNMENT_ORDER": "2" + } + }, + { + "id": 2, // mandatory to declare the order of execution + "name": "Execute", + "image": "ls1tum/artemis-maven-template:java17-18", // mandatory + "script": "sleep 3.600" + } + ] + } +} + +vars:pre-request { + user: "" + password: "" + test_repo: "https://github.com/Mtze/Artemis-Java-Test.git" + assignment_repo: "https://github.com/Mtze/Artemis-Java-Solution.git" +} diff --git a/go.work.sum b/go.work.sum index d11cebc..abea5c5 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1176,6 +1176,7 @@ github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=