Skip to content

Commit

Permalink
don't cache projects since they are likely to change
Browse files Browse the repository at this point in the history
  • Loading branch information
wr0ngway committed Apr 28, 2021
1 parent 7bfebf1 commit 4f91947
Show file tree
Hide file tree
Showing 5 changed files with 927 additions and 41 deletions.
18 changes: 8 additions & 10 deletions lib/kubetruth/ctapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,15 @@ def environments
end

def projects
@projects ||= begin
variables = {}
if @organization
org_id = self.organizations[@organization] || raise("Unknown organization: #{@organization}")
variables[:organizationId] = org_id
end

result = client.query(self.queries[:ProjectsQuery], variables: variables)
logger.debug{"Projects query result: #{result.inspect}"}
Hash[result&.data&.viewer&.organization&.projects&.nodes&.collect {|e| [e.name, e.id] }]
variables = {}
if @organization
org_id = self.organizations[@organization] || raise("Unknown organization: #{@organization}")
variables[:organizationId] = org_id
end

result = client.query(self.queries[:ProjectsQuery], variables: variables)
logger.debug{"Projects query result: #{result.inspect}"}
Hash[result&.data&.viewer&.organization&.projects&.nodes&.collect {|e| [e.name, e.id] }]
end

def organization_names
Expand Down
Loading

0 comments on commit 4f91947

Please sign in to comment.