Răsfoiți Sursa

add status and number to revision response (#3433)

ianedwards 2 ani în urmă
părinte
comite
746df83476
3 a modificat fișierele cu 11 adăugiri și 4 ștergeri
  1. 8 1
      api/server/handlers/porter_app/current_app_revision.go
  2. 1 1
      go.mod
  3. 2 2
      go.sum

+ 8 - 1
api/server/handlers/porter_app/current_app_revision.go

@@ -46,7 +46,12 @@ type LatestAppRevisionRequest struct {
 
 // LatestAppRevisionResponse is the response object for the /apps/{porter_app_name}/latest endpoint
 type LatestAppRevisionResponse struct {
+	// B64AppProto is the base64 encoded app proto definition
 	B64AppProto string `json:"b64_app_proto"`
+	// Status is the status of the revision
+	Status string `json:"status"`
+	// RevisionNumber is the revision number with respect to the app and deployment target
+	RevisionNumber uint64 `json:"revision_number"`
 }
 
 // ServeHTTP translates the request into a CurrentAppRevision grpc request, forwards to the cluster control plane, and returns the response.
@@ -145,7 +150,9 @@ func (c *LatestAppRevisionHandler) ServeHTTP(w http.ResponseWriter, r *http.Requ
 	b64 := base64.StdEncoding.EncodeToString(encoded)
 
 	response := &LatestAppRevisionResponse{
-		B64AppProto: b64,
+		B64AppProto:    b64,
+		Status:         currentAppRevisionResp.Msg.Status,
+		RevisionNumber: currentAppRevisionResp.Msg.RevisionNumber,
 	}
 
 	c.WriteResult(w, r, response)

+ 1 - 1
go.mod

@@ -79,7 +79,7 @@ require (
 	github.com/matryer/is v1.4.0
 	github.com/nats-io/nats.go v1.24.0
 	github.com/open-policy-agent/opa v0.44.0
-	github.com/porter-dev/api-contracts v0.0.87
+	github.com/porter-dev/api-contracts v0.0.90
 	github.com/riandyrn/otelchi v0.5.1
 	github.com/santhosh-tekuri/jsonschema/v5 v5.0.1
 	github.com/stefanmcshane/helm v0.0.0-20221213002717-88a4a2c6e77d

+ 2 - 2
go.sum

@@ -1489,8 +1489,8 @@ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw=
-github.com/porter-dev/api-contracts v0.0.87 h1:ilKR3hSiNMPDLFVUBB/40HK1eXjOndvgahEblD1nsd4=
-github.com/porter-dev/api-contracts v0.0.87/go.mod h1:fX6JmP5QuzxDLvqP3evFOTXjI4dHxsG0+VKNTjImZU8=
+github.com/porter-dev/api-contracts v0.0.90 h1:qInnOFj95CXwOSUKw9nde8dHqkOLa2f6GcNY1Pmxbhs=
+github.com/porter-dev/api-contracts v0.0.90/go.mod h1:fX6JmP5QuzxDLvqP3evFOTXjI4dHxsG0+VKNTjImZU8=
 github.com/porter-dev/switchboard v0.0.3 h1:dBuYkiVLa5Ce7059d6qTe9a1C2XEORFEanhbtV92R+M=
 github.com/porter-dev/switchboard v0.0.3/go.mod h1:xSPzqSFMQ6OSbp42fhCi4AbGbQbsm6nRvOkrblFeXU4=
 github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=