This repository has been archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add feature flag support to go builds
- Loading branch information
1 parent
2f8cd42
commit ab7e318
Showing
10 changed files
with
133 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright © 2023 Cisco Systems, Inc. and its affiliates. | ||
// All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:build !providerv2 | ||
|
||
package orchestrator | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
apitypes "github.com/openclarity/vmclarity/api/types" | ||
"github.com/openclarity/vmclarity/provider" | ||
"github.com/openclarity/vmclarity/provider/aws" | ||
"github.com/openclarity/vmclarity/provider/azure" | ||
"github.com/openclarity/vmclarity/provider/docker" | ||
"github.com/openclarity/vmclarity/provider/external" | ||
"github.com/openclarity/vmclarity/provider/gcp" | ||
"github.com/openclarity/vmclarity/provider/kubernetes" | ||
) | ||
|
||
// nolint:wrapcheck | ||
// NewProvider returns an initialized provider.Provider based on the kind apitypes.CloudProvider. | ||
func NewProvider(ctx context.Context, kind apitypes.CloudProvider) (provider.Provider, error) { | ||
switch kind { | ||
case apitypes.Azure: | ||
return azure.New(ctx) | ||
case apitypes.Docker: | ||
return docker.New(ctx) | ||
case apitypes.AWS: | ||
return aws.New(ctx) | ||
case apitypes.GCP: | ||
return gcp.New(ctx) | ||
case apitypes.External: | ||
return external.New(ctx) | ||
case apitypes.Kubernetes: | ||
return kubernetes.New(ctx) | ||
default: | ||
return nil, fmt.Errorf("unsupported provider: %s", kind) | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright © 2023 Cisco Systems, Inc. and its affiliates. | ||
// All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:build providerv2 | ||
|
||
package orchestrator | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
apitypes "github.com/openclarity/vmclarity/api/types" | ||
provider2 "github.com/openclarity/vmclarity/provider" | ||
"github.com/openclarity/vmclarity/provider/docker" | ||
"github.com/openclarity/vmclarity/provider/external" | ||
"github.com/openclarity/vmclarity/provider/kubernetes" | ||
"github.com/openclarity/vmclarity/provider/v2/aws" | ||
"github.com/openclarity/vmclarity/provider/v2/azure" | ||
"github.com/openclarity/vmclarity/provider/v2/gcp" | ||
) | ||
|
||
// nolint:wrapcheck | ||
// NewProvider returns an initialized provider.Provider based on the kind apitypes.CloudProvider. | ||
func NewProvider(ctx context.Context, kind apitypes.CloudProvider) (provider2.Provider, error) { | ||
switch kind { | ||
case apitypes.Azure: | ||
return azure.New(ctx) | ||
case apitypes.Docker: | ||
return docker.New(ctx) | ||
case apitypes.AWS: | ||
return aws.New(ctx) | ||
case apitypes.GCP: | ||
return gcp.New(ctx) | ||
case apitypes.External: | ||
return external.New(ctx) | ||
case apitypes.Kubernetes: | ||
return kubernetes.New(ctx) | ||
default: | ||
return nil, fmt.Errorf("unsupported provider: %s", kind) | ||
} | ||
} |