foundry_msg_dist_new() {
local context="$1"
local repository="$2"
- local artifacts=("${@:3}")
+ local branch="$3"
+ local ref="$4"
+ local distribution="$5"
+ local artifacts=("${@:6}")
local artifacts_json
local json
return 1
fi
- if ! json=$(json_object "context" "$context" \
- "repository" "$repository" \
- "artifacts" "$artifacts_json"); then
+ if ! json=$(json_object "context" "$context" \
+ "repository" "$repository" \
+ "branch" "$branch" \
+ "ref" "$ref" \
+ "distribution" "$distribution" \
+ "artifacts" "$artifacts_json"); then
return 1
fi
return 0
}
+foundry_msg_dist_get_branch() {
+ local msg="$1"
+
+ local branch
+
+ if ! branch=$(foundry_msg_get_data_field "$msg" "branch"); then
+ return 1
+ fi
+
+ echo "$branch"
+ return 0
+}
+
+foundry_msg_dist_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_dist_get_distribution() {
+ local msg="$1"
+
+ local distribution
+
+ if ! distribution=$(foundry_msg_get_data_field "$msg" "distribution"); then
+ return 1
+ fi
+
+ echo "$distribution"
+ return 0
+}
+
foundry_msg_dist_get_artifacts() {
local msg="$1"
"type": "string"
},
+ "repository": {
+ "description": "The URL of the repository that the artifacts were built from",
+ "type": "string",
+ "pattern": "^(https|file)://.*$"
+ },
+
+ "branch": {
+ "description": "The name of the branch the artifacts were built from",
+ "type": "string"
+ },
+
+ "ref": {
+ "description": "Identifier of the source code version",
+ "type": "string",
+ "pattern": "^[0-9a-fA-F]+$"
+ },
+
"artifacts": {
"description": "Artifacts that were published",
"type": "array",
"minItems": 1
},
- "repository": {
+ "distribution": {
"description": "The repository where the artifacts were published",
"type": "string"
}
"required": [
"context",
+ "repository",
+ "branch",
+ "ref",
"artifacts",
- "repository"
+ "distribution"
],
"$defs": {