forked from olhtbr/metadata-resource
-
Notifications
You must be signed in to change notification settings - Fork 1
/
in
executable file
·44 lines (41 loc) · 1.32 KB
/
in
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
39
40
41
42
43
44
#!/bin/sh
cd $1
echo $BUILD_ID > build_id
echo $BUILD_NAME > build_name
echo $BUILD_JOB_NAME > build_job_name
echo $BUILD_PIPELINE_NAME > build_pipeline_name
echo $BUILD_TEAM_NAME > build_team_name
echo $ATC_EXTERNAL_URL > atc_external_url
set > metadata
build_created_by=$(cat metadata | grep 'BUILD_CREATED_BY')
if [ ! -z "$build_created_by" ]; then
echo $BUILD_CREATED_BY > build_created_by
cat <<EOF
{
"version": { "build_id": "$BUILD_ID" },
"metadata": [
{ "name": "BUILD_ID", "value": "$BUILD_ID"},
{ "name": "BUILD_NAME", "value": "$BUILD_NAME"},
{ "name": "BUILD_JOB_NAME", "value": "$BUILD_JOB_NAME"},
{ "name": "BUILD_PIPELINE_NAME", "value": "$BUILD_PIPELINE_NAME"},
{ "name": "BUILD_TEAM_NAME", "value": "$BUILD_TEAM_NAME"},
{ "name": "ATC_EXTERNAL_URL", "value": "$ATC_EXTERNAL_URL"}
{ "name": "BUILD_CREATED_BY", "value": "$BUILD_CREATED_BY"}
]
}
EOF
else
cat <<EOF
{
"version": { "build_id": "$BUILD_ID" },
"metadata": [
{ "name": "BUILD_ID", "value": "$BUILD_ID"},
{ "name": "BUILD_NAME", "value": "$BUILD_NAME"},
{ "name": "BUILD_JOB_NAME", "value": "$BUILD_JOB_NAME"},
{ "name": "BUILD_PIPELINE_NAME", "value": "$BUILD_PIPELINE_NAME"},
{ "name": "BUILD_TEAM_NAME", "value": "$BUILD_TEAM_NAME"},
{ "name": "ATC_EXTERNAL_URL", "value": "$ATC_EXTERNAL_URL"}
]
}
EOF
fi