forked from green-coding-solutions/eco-ci-energy-estimation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheco-ci-gitlab.yml
38 lines (34 loc) · 1.66 KB
/
eco-ci-gitlab.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
variables:
ECO_CI_SEND_DATA: "true"
ECO_CI_DISPLAY_BADGE: "true"
ECO_CI_DISPLAY_TABLE: "true"
ECO_CI_SHOW_CARBON: "true"
ECO_CI_COMPANY_UUID: ""
ECO_CI_PROJECT_UUID: ""
ECO_CI_MACHINE_UUID: ""
ECO_CI_JSON_OUTPUT: "false"
ECO_CI_CALCULATE_CO2: "true"
ECO_CI_CLONE_BRANCH: "main"
ECO_CI_MACHINE_POWER_DATA: "gitlab_EPYC_7B12_saas-linux-small-amd64.sh"
.start_measurement:
script:
- |
echo 'running eco-ci start script'
if [[ -d /tmp/eco-ci ]]; then
rm -rf /tmp/eco-ci
fi
git clone --depth 1 --single-branch --branch "${ECO_CI_CLONE_BRANCH}" https://github.com/green-coding-solutions/eco-ci-energy-estimation /tmp/eco-ci-repo
/tmp/eco-ci-repo/scripts/setup.sh start_measurement "${ECO_CI_MACHINE_POWER_DATA}" "${CI_PIPELINE_ID}" "${CI_COMMIT_REF_NAME}" "${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}" "${CI_PROJECT_ID}" "gitlab-ci.yml" "${CI_COMMIT_SHA}" "gitlab" "${ECO_CI_SEND_DATA}" "${ECO_CI_COMPANY_UUID}" "${ECO_CI_PROJECT_UUID}" "${ECO_CI_MACHINE_UUID}" "${ECO_CI_CALCULATE_CO2}" "${ECO_CI_JSON_OUTPUT}"
.get_measurement:
script:
- echo 'running eco-ci measure script'
- |
/tmp/eco-ci-repo/scripts/make_measurement.sh make_measurement "${ECO_CI_LABEL}"
.display_results:
script:
- |
echo 'running eco-ci display script'
FORMAT_CLR="\e[44m" && TXT_CLEAR="\e[0m"
/tmp/eco-ci-repo/scripts/display_results.sh display_results "${ECO_CI_DISPLAY_TABLE}" "${ECO_CI_DISPLAY_BADGE}"
echo -e "$FORMAT_CLR$(cat /tmp/eco-ci/output.txt)$TXT_CLEAR"
cp /tmp/eco-ci/output.txt ./eco-ci-output.txt