Build messages don't carry a field that identifies the version of the
built software at the source-code level.
This commit adds the "ref" field to the build message specification and
implementation.
local context="$1"
local repository="$2"
local branch="$3"
- local result="$4"
- local -n __foundry_msg_build_new_artifacts="$5"
+ local ref="$4"
+ local result="$5"
+ local -n __foundry_msg_build_new_artifacts="$6"
local artifact_array
local json
if ! json=$(json_object "context" "$context" \
"repository" "$repository" \
"branch" "$branch" \
+ "ref" "$ref" \
"result" "$result" \
"artifacts" "$artifact_array"); then
return 1
return 0
}
+foundry_msg_build_get_ref() {
+ local msg="$1"
+
+ local ref
+
+ if ! ref=$(foundry_msg_get_data_field "$msg" "ref"); then
+ return 1
+ fi
+
+ echo "$ref"
+ return 0
+}
+
foundry_msg_build_get_result() {
local msg="$1"
"type": "string"
},
+ "ref": {
+ "description": "Identifier of the source code version",
+ "type": "string",
+ "pattern": "^[0-9a-fA-F]+$"
+ },
+
"artifacts": {
"description": "The files resulting from the build",
"type": "array",
"context",
"repository",
"branch",
+ "ref",
"artifacts"
],