We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 143eb24 commit 411b686Copy full SHA for 411b686
cmd/reporter/controlDeployment.go
@@ -1,6 +1,7 @@
1
package main
2
3
import (
4
+ "encoding/json"
5
"fmt"
6
"io"
7
"net/http"
@@ -45,9 +46,19 @@ func newControlDeploymentCmd(out io.Writer) *cobra.Command {
45
46
if err != nil {
47
return err
48
}
- fmt.Println(response.Body)
49
50
- return nil
+ var approvals []map[string]interface{}
51
+ err = json.Unmarshal([]byte(response.Body), &approvals)
52
+ if err != nil {
53
+ return err
54
+ }
55
+
56
+ state, ok := approvals[len(approvals)-1]["state"].(string)
57
+ if ok && state == "APPROVED" {
58
+ log.Infof("artifact with sha256 %s is approved in approval no. [%d]", o.sha256, len(approvals))
59
+ return nil
60
61
+ return fmt.Errorf("artifact with sha256 %s is not approved", o.sha256)
62
},
63
64
0 commit comments