Skip to content

Commit 84f2ec6

Browse files
authored
feat(events): Send events for workflow contract changes (#1663)
Signed-off-by: Javier Rodriguez <[email protected]>
1 parent 94319a8 commit 84f2ec6

20 files changed

+725
-25
lines changed

app/controlplane/cmd/wire_gen.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// Copyright 2024 The Chainloop Authors.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
package events_test
17+
18+
import (
19+
"flag"
20+
"os"
21+
"testing"
22+
)
23+
24+
var updateGolden bool
25+
26+
const testEmail = "[email protected]"
27+
28+
func TestMain(m *testing.M) {
29+
flag.BoolVar(&updateGolden, "update-golden", false, "update the expected golden files")
30+
// Parse the flags
31+
flag.Parse()
32+
os.Exit(m.Run())
33+
}

app/controlplane/pkg/auditor/events/testdata/user_logs_in.json renamed to app/controlplane/pkg/auditor/events/testdata/users/user_logs_in.json

File renamed without changes.

app/controlplane/pkg/auditor/events/testdata/user_signs_up.json renamed to app/controlplane/pkg/auditor/events/testdata/users/user_signs_up.json

File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"ActionType": "WorkflowContractContractAttached",
3+
"TargetType": "WorkflowContract",
4+
"TargetID": "1089bb36-e27b-428b-8009-d015c8737c54",
5+
"ActorType": "API_TOKEN",
6+
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
7+
"ActorEmail": "[email protected]",
8+
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
9+
"Description": "[email protected] has attached the workflow test-workflow to the workflow contract test-contract",
10+
"Info": {
11+
"workflow_contract_id": "1089bb36-e27b-428b-8009-d015c8737c54",
12+
"workflow_contract_name": "test-contract",
13+
"workflow_id": "1089bb36-e27b-428b-8009-d015c8737c54",
14+
"workflow_name": "test-workflow"
15+
},
16+
"Digest": "sha256:1107737635a6c56e4fe4143d678783ab06c0321192f62f56ae1a2d76dea57321"
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"ActionType": "WorkflowContractContractAttached",
3+
"TargetType": "WorkflowContract",
4+
"TargetID": "1089bb36-e27b-428b-8009-d015c8737c54",
5+
"ActorType": "API_TOKEN",
6+
"ActorID": "2089bb36-e27b-428b-8009-d015c8737c55",
7+
"ActorEmail": "",
8+
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
9+
"Description": "API Token 2089bb36-e27b-428b-8009-d015c8737c55 has attached the workflow test-workflow to the workflow contract test-contract",
10+
"Info": {
11+
"workflow_contract_id": "1089bb36-e27b-428b-8009-d015c8737c54",
12+
"workflow_contract_name": "test-contract",
13+
"workflow_id": "1089bb36-e27b-428b-8009-d015c8737c54",
14+
"workflow_name": "test-workflow"
15+
},
16+
"Digest": "sha256:e3fe1a29d29f1427121c5023b5d643eb4f457aa7eacfc212b4cacce49c813512"
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ActionType": "WorkflowContractCreated",
3+
"TargetType": "WorkflowContract",
4+
"TargetID": "1089bb36-e27b-428b-8009-d015c8737c54",
5+
"ActorType": "API_TOKEN",
6+
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
7+
"ActorEmail": "[email protected]",
8+
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
9+
"Description": "[email protected] has created the workflow contract test-contract",
10+
"Info": {
11+
"workflow_contract_id": "1089bb36-e27b-428b-8009-d015c8737c54",
12+
"workflow_contract_name": "test-contract"
13+
},
14+
"Digest": "sha256:94f1ad7880f9d5bfcbe6f3a5f3d63cfa714123cd8549f9dba2ac3cc62dd5273f"
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ActionType": "WorkflowContractCreated",
3+
"TargetType": "WorkflowContract",
4+
"TargetID": "1089bb36-e27b-428b-8009-d015c8737c54",
5+
"ActorType": "API_TOKEN",
6+
"ActorID": "2089bb36-e27b-428b-8009-d015c8737c55",
7+
"ActorEmail": "",
8+
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
9+
"Description": "API Token 2089bb36-e27b-428b-8009-d015c8737c55 has created the workflow contract test-contract",
10+
"Info": {
11+
"workflow_contract_id": "1089bb36-e27b-428b-8009-d015c8737c54",
12+
"workflow_contract_name": "test-contract"
13+
},
14+
"Digest": "sha256:5036a6f579dbad881aeb656e4e6a402cff272e154ff5b9e7aa1631004458c07a"
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ActionType": "WorkflowContractDeleted",
3+
"TargetType": "WorkflowContract",
4+
"TargetID": "1089bb36-e27b-428b-8009-d015c8737c54",
5+
"ActorType": "API_TOKEN",
6+
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
7+
"ActorEmail": "[email protected]",
8+
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
9+
"Description": "[email protected] has deleted the workflow contract test-contract",
10+
"Info": {
11+
"workflow_contract_id": "1089bb36-e27b-428b-8009-d015c8737c54",
12+
"workflow_contract_name": "test-contract"
13+
},
14+
"Digest": "sha256:6ecfc282f25617197cb98e5ee9a3695fd9f12de8a1b54fc01e90ed40cf024421"
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ActionType": "WorkflowContractDeleted",
3+
"TargetType": "WorkflowContract",
4+
"TargetID": "1089bb36-e27b-428b-8009-d015c8737c54",
5+
"ActorType": "API_TOKEN",
6+
"ActorID": "2089bb36-e27b-428b-8009-d015c8737c55",
7+
"ActorEmail": "",
8+
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
9+
"Description": "API Token 2089bb36-e27b-428b-8009-d015c8737c55 has deleted the workflow contract test-contract",
10+
"Info": {
11+
"workflow_contract_id": "1089bb36-e27b-428b-8009-d015c8737c54",
12+
"workflow_contract_name": "test-contract"
13+
},
14+
"Digest": "sha256:84d36161f79c03eea04a85262661a87f149f2ae2812000d46f5c9a994726ef7f"
15+
}

0 commit comments

Comments
 (0)