-
Notifications
You must be signed in to change notification settings - Fork 26
adding channel inspect for ship and kots, release update for ship #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eb51ae6
channel inspect for ship, update release for ship
smithers1221 9252c18
release label vs release sequence
smithers1221 fd6eeaa
channel inspect for kots, do we care that query doesnt return release…
smithers1221 fedb599
edit
smithers1221 1d232f7
remove no value O for release sequence
smithers1221 e8e959f
error msg for archiving channels on kots and ship
smithers1221 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package shipclient | ||
|
||
import ( | ||
channels "github.com/replicatedhq/replicated/gen/go/v1" | ||
"github.com/replicatedhq/replicated/pkg/graphql" | ||
"github.com/replicatedhq/replicated/pkg/types" | ||
) | ||
|
@@ -10,6 +11,15 @@ type GraphQLResponseListChannels struct { | |
Errors []graphql.GQLError `json:"errors,omitempty"` | ||
} | ||
|
||
type GraphQLResponseGetChannel struct { | ||
Data *ShipGetChannelData `json:"data,omitempty"` | ||
Errors []graphql.GQLError `json:"errors,omitempty"` | ||
} | ||
|
||
type ShipGetChannelData struct { | ||
ShipChannel *ShipChannel `json:"getChannel"` | ||
} | ||
|
||
type ShipChannelData struct { | ||
ShipChannels []*ShipChannel `json:"getAppChannels"` | ||
} | ||
|
@@ -121,6 +131,82 @@ func ArchiveChannel(appID string, channelID string) error { | |
return nil | ||
} | ||
|
||
func GetChannel(appID string, channelID string) (interface{}, []interface{}, error) { | ||
return nil, nil, nil | ||
var getShipChannel = ` | ||
query getChannel($channelId: ID!) { | ||
getChannel(channelId: $channelId) { | ||
id | ||
appId | ||
name | ||
description | ||
channelIcon | ||
currentVersion | ||
currentReleaseDate | ||
installInstructions | ||
currentSpec | ||
numReleases | ||
adoptionRate { | ||
releaseId | ||
semver | ||
count | ||
percent | ||
totalOnChannel | ||
} | ||
customers { | ||
id | ||
name | ||
avatar | ||
actions { | ||
shipApplyDocker | ||
} | ||
installationId | ||
shipInstallStatus { | ||
status | ||
updatedAt | ||
} | ||
} | ||
githubRef { | ||
owner | ||
repoFullName | ||
branch | ||
path | ||
} | ||
extraLintRules | ||
created | ||
updated | ||
isDefault | ||
isArchived | ||
releases { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, do for fetching channels, do we need to get every release that was published to the channel? |
||
id | ||
semver | ||
spec | ||
releaseNotes | ||
created | ||
updated | ||
sequence | ||
} | ||
} | ||
} | ||
` | ||
|
||
func (c *GraphQLClient) GetChannel(appID string, channelID string) (*channels.AppChannel, []channels.ChannelRelease, error) { | ||
response := GraphQLResponseGetChannel{} | ||
|
||
request := graphql.Request{ | ||
Query: getShipChannel, | ||
Variables: map[string]interface{}{ | ||
"appID": appID, | ||
"channelId": channelID, | ||
}, | ||
} | ||
if err := c.ExecuteRequest(request, &response); err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
channelDetail := channels.AppChannel{ | ||
Id: response.Data.ShipChannel.ID, | ||
Name: response.Data.ShipChannel.Name, | ||
Description: response.Data.ShipChannel.Description, | ||
ReleaseLabel: response.Data.ShipChannel.CurrentVersion, | ||
} | ||
return &channelDetail, nil, nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to fetch every release on the channel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dex - see your point, but can we table that for another PR. Currently pulling from what's on Vendorweb.