feat: Fly.io base integration#2830
Conversation
Signed-off-by: Aleksandar Radosevic <aradosevicarchon@gmail.com>
Signed-off-by: Aleksandar Radosevic <aradosevicarchon@gmail.com>
pkg/integrations/flyio/flyio_test.go
Outdated
| "github.com/superplanehq/superplane/pkg/core" | ||
| ) | ||
|
|
||
| func Test__FlyIO__Name(t *testing.T) { |
There was a problem hiding this comment.
Static methods do not require unit tests
| @@ -0,0 +1,83 @@ | |||
| package flyio | |||
There was a problem hiding this comment.
Tests for Sync() are required though
|
@aleksandar94ns code looks good, left just a few comments regarding unit tests. One issue though: base integrations require 1 component + 1 trigger to be added as part of it. Usually, the trickiest part about building the base integration is to figure out how the events from the integration will be received in SuperPlane, so it's good to do that as part of the base integration. |
Signed-off-by: Aleksandar Radosevic <aradosevicarchon@gmail.com>
| for _, app := range metadata.Apps { | ||
| machines, err := client.ListMachines(app.Name) | ||
| if err != nil { | ||
| continue |
There was a problem hiding this comment.
Silently ignoring machine listing errors hides failures
Medium Severity
In ListResources for the machine resource type, errors from client.ListMachines(app.Name) are silently swallowed with continue. When an API call fails (due to network issues, rate limiting, permissions, or other errors), the user receives a partial result with no indication that some apps' machines couldn't be fetched. This could lead to users making decisions based on incomplete data, believing they have a complete inventory when machines are actually missing.
|
|
||
| // If already set up for this org, skip | ||
| if metadata.OrgSlug == orgSlug && metadata.AppStates != nil { | ||
| return nil |
There was a problem hiding this comment.
Trigger setup skips scheduling poll on restart
High Severity
When Setup is called and metadata already exists for the same org (e.g., after a system restart), the function returns early at line 135 without scheduling the next poll action. The ScheduleActionCall at lines 170-174 is bypassed, causing the polling mechanism to never resume. This effectively breaks the trigger after any restart or re-setup scenario since no new poll will be scheduled.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
|
||
| // ListApps retrieves all apps for an organization | ||
| func (c *Client) ListApps(orgSlug string) ([]App, error) { | ||
| url := fmt.Sprintf("%s/v1/apps?org_slug=%s", c.BaseURL, orgSlug) |
There was a problem hiding this comment.
URL parameters not escaped in API client
Medium Severity
URL path segments and query parameters are constructed using fmt.Sprintf without URL encoding. Values like orgSlug, appName, machineID, and state are directly interpolated into URLs. If any of these contain special characters (spaces, /, ?, &, #, %), the resulting URL will be malformed or incorrectly parsed. Other integrations in this codebase (e.g., AWS Lambda) correctly use url.PathEscape() and url.Values for this purpose.
Additional Locations (2)
| "github.com/superplanehq/superplane/pkg/core" | ||
| ) | ||
|
|
||
| type ListApps struct{} |
There was a problem hiding this comment.
We have been discussing List operations in this thread. I'm not so sure I see a concrete real use case for this
|
We should consider making SuperPlane a fly.io extension. Fly.io extensions can receive webhooks, so we could create a fly.io extension, which acts like an agent, receives the webhooks, and sends to SuperPlane. cc @shiroyasha |
|
@aleksandar94ns go for it. Let us know what is the complexity of building such an extension. |


Fly.io Base Integration
Description
Adds the base integration scaffolding for Fly.io, an application platform that runs full VMs (Machines) and apps globally.
Relates to: #2785
What's Included
flyio)personal)Sync()implementation to validate token and populate app metadataListResources()for apps and machineshttps://api.machines.devConnection Method
API Token (Bearer) authentication:
Tokens can be created via:
fly tokens deployorfly tokens createFiles Changed
pkg/integrations/flyio/flyio.gopkg/integrations/flyio/flyio_test.gopkg/integrations/flyio/client.goChecklist
Reference
See Integration & component checklist