foundry_msg_sign_new() {
local context="$1"
local key="$2"
- local artifacts=("${@:3}")
+ local repository="$3"
+ local branch="$4"
+ local ref="$5"
+ local artifacts=("${@:6}")
local artifacts_json
local json
return 1
fi
- if ! json=$(json_object "context" "$context" \
- "key" "$key" \
- "artifacts" "$artifacts_json"); then
+ if ! json=$(json_object "context" "$context" \
+ "key" "$key" \
+ "repository" "$repository" \
+ "branch" "$branch" \
+ "ref" "$ref" \
+ "artifacts" "$artifacts_json"); then
return 1
fi
return 0
}
+foundry_msg_sign_get_repository() {
+ local msg="$1"
+
+ local repository
+
+ if ! repository=$(foundry_msg_get_data_field "$msg" "repository"); then
+ return 1
+ fi
+
+ echo "$repository"
+ return 0
+}
+
+foundry_msg_sign_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_sign_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_sign_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": "The files that have been signed",
"type": "array",
"required": [
"context",
+ "repository",
+ "branch",
+ "ref",
"artifacts",
"key"
],