Skip to content

Commit

Permalink
wip: update new connector condition
Browse files Browse the repository at this point in the history
  • Loading branch information
pranshi06 committed Sep 25, 2024
1 parent 3bbb478 commit d94c5fb
Show file tree
Hide file tree
Showing 4 changed files with 3,017 additions and 38 deletions.
9 changes: 9 additions & 0 deletions registry-automation/changed_files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"added_files": [
"registry/hasura/newtestconnector/releases/v0.1.0/connector-packaging.json"
],
"modified_files": [
"registry/hasura/newtestconnector/metadata.json"
],
"deleted_files": []
}
16 changes: 9 additions & 7 deletions registry-automation/cmd/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ func runCI(cmd *cobra.Command, args []string) {
}

if len(newlyAddedConnectorVersions) > 0 {
newConnectorVersionsToBeAdded = processNewlyAddedConnectorVersions(ctx, newlyAddedConnectorVersions)
var isNewConnector bool = len(newlyAddedConnectors) > 0
newConnectorVersionsToBeAdded = processNewlyAddedConnectorVersions(ctx, newlyAddedConnectorVersions, isNewConnector)
}

if len(modifiedReadmes) > 0 {
Expand Down Expand Up @@ -461,7 +462,7 @@ func processModifiedReadmes(modifiedReadmes ModifiedReadmes) ([]ConnectorOvervie

}

func processNewlyAddedConnectorVersions(ciCtx Context, newlyAddedConnectorVersions NewConnectorVersions) []ConnectorVersion {
func processNewlyAddedConnectorVersions(ciCtx Context, newlyAddedConnectorVersions NewConnectorVersions, isNewConnector bool) []ConnectorVersion {
// Iterate over the added or modified connectors and upload the connector versions
var connectorVersions []ConnectorVersion
var uploadConnectorVersionErr error
Expand All @@ -470,7 +471,7 @@ func processNewlyAddedConnectorVersions(ciCtx Context, newlyAddedConnectorVersio
for connectorName, versions := range newlyAddedConnectorVersions {
for version, connectorVersionPath := range versions {
var connectorVersion ConnectorVersion
connectorVersion, uploadConnectorVersionErr = uploadConnectorVersionPackage(ciCtx, connectorName, version, connectorVersionPath)
connectorVersion, uploadConnectorVersionErr = uploadConnectorVersionPackage(ciCtx, connectorName, version, connectorVersionPath, isNewConnector)

if uploadConnectorVersionErr != nil {
fmt.Printf("Error while processing version and connector: %s - %s, Error: %v", version, connectorName, uploadConnectorVersionErr)
Expand Down Expand Up @@ -513,7 +514,7 @@ func cleanupUploadedConnectorVersions(client *storage.Client, connectorVersions
}

// uploadConnectorVersionPackage uploads the connector version package to the registry
func uploadConnectorVersionPackage(ciCtx Context, connector Connector, version string, changedConnectorVersionPath string) (ConnectorVersion, error) {
func uploadConnectorVersionPackage(ciCtx Context, connector Connector, version string, changedConnectorVersionPath string, isNewConnector bool) (ConnectorVersion, error) {

var connectorVersion ConnectorVersion

Expand Down Expand Up @@ -544,7 +545,7 @@ func uploadConnectorVersionPackage(ciCtx Context, connector Connector, version s
}

// Build payload for registry upsert
return buildRegistryPayload(ciCtx, connector.Namespace, connector.Name, version, connectorVersionMetadata, uploadedTgzUrl)
return buildRegistryPayload(ciCtx, connector.Namespace, connector.Name, version, connectorVersionMetadata, uploadedTgzUrl, isNewConnector)
}

func uploadConnectorVersionDefinition(ciCtx Context, connectorNamespace, connectorName string, connectorVersion string, connectorMetadataTgzPath string) (string, error) {
Expand Down Expand Up @@ -603,6 +604,7 @@ func buildRegistryPayload(
version string,
connectorVersionMetadata map[string]interface{},
uploadedConnectorDefinitionTgzUrl string,
isNewConnector bool,
) (ConnectorVersion, error) {
var connectorVersion ConnectorVersion
var connectorVersionDockerImage string = ""
Expand All @@ -629,8 +631,8 @@ func buildRegistryPayload(
}

// Check if the connector exists in the registry first
if len(connectorInfo.HubRegistryConnector) == 0 {
return connectorVersion, fmt.Errorf("Inserting a new connector is not supported yet")
if len(connectorInfo.HubRegistryConnector) == 0 && !isNewConnector {
return connectorVersion, fmt.Errorf("Inserting a new connector is not supported yet")
}

var connectorVersionType string
Expand Down
32 changes: 1 addition & 31 deletions registry-automation/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,20 @@ require (
github.com/spf13/cobra v1.8.0
)

require (
github.com/creasty/defaults v1.7.0 // indirect
github.com/gorilla/schema v1.4.1 // indirect
github.com/matryer/is v1.4.1 // indirect
)
require github.com/matryer/is v1.4.1 // indirect

require (
cloud.google.com/go v0.115.0 // indirect
cloud.google.com/go/auth v0.7.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect
cloud.google.com/go/compute/metadata v0.5.0 // indirect
cloud.google.com/go/iam v1.1.11 // indirect
cloud.google.com/go/storage v1.43.0
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/machinebox/graphql v0.2.2
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.188.0
google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v2 v2.4.0
)
Loading

0 comments on commit d94c5fb

Please sign in to comment.