diff --git a/docker-compose.seed.yml b/docker-compose.seed.yml index e1fb0e1ab2..c7b024dee7 100644 --- a/docker-compose.seed.yml +++ b/docker-compose.seed.yml @@ -9,7 +9,7 @@ services: volumes: - ./docker/wait-for-it.sh:/usr/src/app/wait-for-it.sh - ./docker/seed.sh:/usr/src/app/seed.sh - - ./docker/metadata.json:/usr/src/app/metadata.json + - ./docker/metadata.template.json:/usr/src/app/metadata.template.json links: - "db:postgres" depends_on: diff --git a/docker/metadata.json b/docker/metadata.template.json similarity index 98% rename from docker/metadata.json rename to docker/metadata.template.json index 4bebf89faf..3babdf0002 100644 --- a/docker/metadata.json +++ b/docker/metadata.template.json @@ -1,7 +1,7 @@ [ { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "4d3b8069-69b6-4708-ade0-3275112c9f04", "facets": { @@ -82,7 +82,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:45:52.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_8_MINUTES}}", "run": { "runId": "4d3b8069-69b6-4708-ade0-3275112c9f04" }, @@ -94,7 +94,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "6f0c13a5-f29b-46a5-90c1-0ffbebbbd1aa", "facets": { @@ -171,7 +171,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:44:52.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_9_MINUTES}}", "run": { "runId": "6f0c13a5-f29b-46a5-90c1-0ffbebbbd1aa" }, @@ -183,7 +183,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "e05901b1-3a06-4b98-8d9c-aaf188c9a28c", "facets": { @@ -265,7 +265,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:44:54.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_8_MINUTES}}", "run": { "runId": "e05901b1-3a06-4b98-8d9c-aaf188c9a28c" }, @@ -277,7 +277,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "a43a8523-349f-4296-807f-3354ac491990", "facets": { @@ -364,7 +364,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:44:52.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_5_MINUTES}}", "run": { "runId": "a43a8523-349f-4296-807f-3354ac491990" }, @@ -376,7 +376,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "ffba2c14-4170-48da-bec3-ab5fd4ec9a3f", "facets": { @@ -570,7 +570,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:44:02.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_7_MINUTES}}", "run": { "runId": "ffba2c14-4170-48da-bec3-ab5fd4ec9a3f" }, @@ -582,7 +582,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "182a9eaf-881a-4d49-860c-f7e260b8bf60", "facets": { @@ -679,7 +679,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:44:55.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_10_MINUTES}}", "run": { "runId": "182a9eaf-881a-4d49-860c-f7e260b8bf60" }, @@ -691,7 +691,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "b7098939-87f0-4207-878f-dfd8e8804d8a", "facets": { @@ -788,7 +788,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:44:52.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_7_MINUTES}}", "run": { "runId": "b7098939-87f0-4207-878f-dfd8e8804d8a" }, @@ -800,7 +800,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "9f3db1c5-5e9a-4280-8184-18aca4592c77", "facets": { @@ -923,7 +923,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:44:52.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_5_MINUTES}}", "run": { "runId": "9f3db1c5-5e9a-4280-8184-18aca4592c77" }, @@ -935,7 +935,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "8ddfb1d9-415f-4850-bcd6-01d02f011abe", "facets": { @@ -1052,7 +1052,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:44:56.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_10_MINUTES}}", "run": { "runId": "8ddfb1d9-415f-4850-bcd6-01d02f011abe" }, @@ -1064,7 +1064,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "d5a2a4c4-fc78-428d-ae85-08c942ed8371", "facets": { @@ -1382,7 +1382,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:48:12.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_6_MINUTES}}", "run": { "runId": "d5a2a4c4-fc78-428d-ae85-08c942ed8371" }, @@ -1394,7 +1394,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "bd41a42a-bf18-4b74-9bb7-cd62637823d8", "facets": { @@ -1655,7 +1655,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:58:02.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_6_MINUTES}}", "run": { "runId": "bd41a42a-bf18-4b74-9bb7-cd62637823d8" }, @@ -1667,7 +1667,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "adc8507c-595e-4d76-9dac-be2bf0ffe1ee", "facets": { @@ -1776,7 +1776,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:46:12.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_5_MINUTES}}", "run": { "runId": "adc8507c-595e-4d76-9dac-be2bf0ffe1ee" }, @@ -1788,7 +1788,7 @@ }, { "eventType": "START", - "eventTime": "2020-02-22T22:42:42.000Z", + "eventTime": "{{RUN_START_TIME}}", "run": { "runId": "3ab25429-cf9c-4d1d-9166-1e1946f9d3c3", "facets": { @@ -1830,7 +1830,7 @@ }, { "eventType": "COMPLETE", - "eventTime": "2020-02-22T22:56:01.000Z", + "eventTime": "{{RUN_END_TIME_AFTER_6_MINUTES}}", "run": { "runId": "3ab25429-cf9c-4d1d-9166-1e1946f9d3c3" }, diff --git a/docker/seed.sh b/docker/seed.sh index bcdbe377af..6cba57085f 100755 --- a/docker/seed.sh +++ b/docker/seed.sh @@ -7,4 +7,24 @@ set -e +# As ISO-8601 format +NOW=$(date -u +"%Y-%m-%dT%H:%M:%S.000Z") + +RUN_END_TIME_AFTER_5_MINUTES=$(date -u -d "5 minutes" +"%Y-%m-%dT%H:%M:%S.000Z") +RUN_END_TIME_AFTER_6_MINUTES=$(date -u -d "6 minutes" +"%Y-%m-%dT%H:%M:%S.000Z") +RUN_END_TIME_AFTER_7_MINUTES=$(date -u -d "7 minutes" +"%Y-%m-%dT%H:%M:%S.000Z") +RUN_END_TIME_AFTER_8_MINUTES=$(date -u -d "8 minutes" +"%Y-%m-%dT%H:%M:%S.000Z") +RUN_END_TIME_AFTER_9_MINUTES=$(date -u -d "9 minutes" +"%Y-%m-%dT%H:%M:%S.000Z") +RUN_END_TIME_AFTER_10_MINUTES=$(date -u -d "10 minutes" +"%Y-%m-%dT%H:%M:%S.000Z") + +# Replace '{{RUN_START_TIME}}' and '{{RUN_END_TIME_AFTER_*_MINUTES}}'. +sed -e "s/{{RUN_START_TIME}}/$NOW/" \ + -e "s/{{RUN_END_TIME_AFTER_5_MINUTES}}/$RUN_END_TIME_AFTER_5_MINUTES/" \ + -e "s/{{RUN_END_TIME_AFTER_6_MINUTES}}/$RUN_END_TIME_AFTER_6_MINUTES/" \ + -e "s/{{RUN_END_TIME_AFTER_7_MINUTES}}/$RUN_END_TIME_AFTER_7_MINUTES/" \ + -e "s/{{RUN_END_TIME_AFTER_8_MINUTES}}/$RUN_END_TIME_AFTER_8_MINUTES/" \ + -e "s/{{RUN_END_TIME_AFTER_9_MINUTES}}/$RUN_END_TIME_AFTER_9_MINUTES/" \ + -e "s/{{RUN_END_TIME_AFTER_10_MINUTES}}/$RUN_END_TIME_AFTER_10_MINUTES/" \ + metadata.template.json > metadata.json + java -jar marquez-api-*.jar seed --url "${MARQUEZ_URL:-http://localhost:5000}" --metadata metadata.json