Skip to content

Commit

Permalink
feat: check version compatibility (#5315)
Browse files Browse the repository at this point in the history
* feat: check version compatibility

Add checkVersionCompatibility endpoint.
Generate new clients.

Fixes DAG-1801

Signed-off-by: Tom Chauveau <[email protected]>

* feat: call check version on Go and Ts SDK

Signed-off-by: Tom Chauveau <[email protected]>

* chore: rebase

Signed-off-by: Vasek - Tom C <[email protected]>

* fix: send warning on version incompatibility

Signed-off-by: Vasek - Tom C <[email protected]>

* chore: update comments to specify warning instead of error

Signed-off-by: Vasek - Tom C <[email protected]>

* chore: update api Gen

Signed-off-by: Vasek - Tom C <[email protected]>

* chore: fix linter

Signed-off-by: Vasek - Tom C <[email protected]>

* fix: display error instead of raising it

Signed-off-by: Vasek - Tom C <[email protected]>

* chore: add release note

Signed-off-by: Vasek - Tom C <[email protected]>

* Apply suggestions from code review

Co-authored-by: Alex Suraci <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>

* Update sdk/go/client.go

Co-authored-by: Alex Suraci <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>

* fix: return error if it cannot parse versions

Signed-off-by: Vasek - Tom C <[email protected]>

* Update sdk/nodejs/connect.ts

Co-authored-by: Helder Correia <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>

* Update core/schema/query.graphqls

Co-authored-by: Helder Correia <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>

* Update core/schema/query.graphqls

Co-authored-by: Helder Correia <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>

* Update core/schema/query.go

Co-authored-by: Helder Correia <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>

* Update core/schema/query.go

Co-authored-by: Helder Correia <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>

* chore: regenerate client

Signed-off-by: Vasek - Tom C <[email protected]>

* Add check in Python

Signed-off-by: Helder Correia <[email protected]>

* Fix linter

Signed-off-by: Helder Correia <[email protected]>

* Regenerate

Signed-off-by: Helder Correia <[email protected]>

---------

Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
Co-authored-by: Vasek - Tom C <[email protected]>
Co-authored-by: Alex Suraci <[email protected]>
Co-authored-by: Helder Correia <[email protected]>
  • Loading branch information
4 people authored Aug 2, 2023
1 parent 53270d7 commit c6a90f3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Added-20230721-172809.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Added
body: Show warning on version mismatch between engine and SDK
time: 2023-07-21T17:28:09.10494+02:00
custom:
Author: TomChv
PR: "5315"
11 changes: 11 additions & 0 deletions api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package dagger

import (
"context"
"fmt"
"io"
"os"

"github.com/Khan/genqlient/graphql"
"github.com/vektah/gqlparser/v2/gqlerror"
Expand Down Expand Up @@ -72,11 +74,19 @@ func Connect(ctx context.Context, opts ...ClientOpt) (_ *Client, rerr error) {
}
gql := errorWrappedClient{graphql.NewClient("http://"+conn.Host()+"/query", conn)}

return &Client{
c := &Client{
c: gql,
conn: conn,
q: querybuilder.Query(),
}, nil
}

// Call version compatibility.
// If versions are not compatible, a warning will be displayed.
if _, err = c.CheckVersionCompatibility(ctx, engineconn.CLIVersion); err != nil {
fmt.Fprintln(os.Stderr, "failed to check version compatibility:", err)
}

return c, nil
}

// Close the engine connection
Expand Down

0 comments on commit c6a90f3

Please sign in to comment.