@@ -19,6 +19,15 @@ pub enum TrustpubData {
1919 /// SHA of the commit
2020 sha : String ,
2121 } ,
22+ #[ serde( rename = "gitlab" ) ]
23+ GitLab {
24+ /// Project path (e.g. "rust-lang/cargo")
25+ project_path : String ,
26+ /// Job ID
27+ job_id : String ,
28+ /// SHA of the commit
29+ sha : String ,
30+ } ,
2231}
2332
2433impl ToSql < Jsonb , Pg > for TrustpubData {
@@ -41,7 +50,7 @@ mod tests {
4150 use insta:: assert_json_snapshot;
4251
4352 #[ test]
44- fn test_serialization ( ) {
53+ fn test_github_serialization ( ) {
4554 let data = TrustpubData :: GitHub {
4655 repository : "octo-org/octo-repo" . to_string ( ) ,
4756 run_id : "example-run-id" . to_string ( ) ,
@@ -57,4 +66,22 @@ mod tests {
5766 }
5867 "# ) ;
5968 }
69+
70+ #[ test]
71+ fn test_gitlab_serialization ( ) {
72+ let data = TrustpubData :: GitLab {
73+ project_path : "rust-lang/cargo" . to_string ( ) ,
74+ job_id : "example-job-id" . to_string ( ) ,
75+ sha : "example-sha" . to_string ( ) ,
76+ } ;
77+
78+ assert_json_snapshot ! ( data, @r#"
79+ {
80+ "provider": "gitlab",
81+ "project_path": "rust-lang/cargo",
82+ "job_id": "example-job-id",
83+ "sha": "example-sha"
84+ }
85+ "# ) ;
86+ }
6087}
0 commit comments