Skip to content

Commit

Permalink
Merge pull request #209 from jfrog/migrate-ignore-rule-to-framework
Browse files Browse the repository at this point in the history
Migrate xray_ignore_rule to Plugin Framework
  • Loading branch information
alexhung authored Jun 20, 2024
2 parents e3c6a8c + 720fd8d commit a92f1fb
Show file tree
Hide file tree
Showing 5 changed files with 742 additions and 496 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.8.2 (June 19, 2024). Tested on Artifactory 7.84.15 and Xray 3.96.1 with Terraform 1.8.5 and OpenTofu 1.7.2

* resource/xray_custom_issue: Migrate from SDKv2 to Plugin Framework. PR: [#207](https://github.com/jfrog/terraform-provider-xray/pull/207)
* resource/xray_ignore_rule: Migrate from SDKv2 to Plugin Framework. PR: [#209](https://github.com/jfrog/terraform-provider-xray/pull/209)

## 2.8.1 (June 14, 2024). Tested on Artifactory 7.84.14 and Xray 3.96.1 with Terraform 1.8.5 and OpenTofu 1.7.2

Expand Down
5 changes: 3 additions & 2 deletions pkg/xray/provider/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ func (p *XrayProvider) Configure(ctx context.Context, req provider.ConfigureRequ

version, err := util.GetXrayVersion(restyClient)
if err != nil {
resp.Diagnostics.AddWarning(
resp.Diagnostics.AddError(
"Error getting Xray version",
fmt.Sprintf("The provider functionality might be affected by the absence of Xray version in the context. %v", err),
err.Error(),
)
return
}
Expand All @@ -187,6 +187,7 @@ func (p *XrayProvider) Resources(ctx context.Context) []func() resource.Resource
xray_resource.NewBinaryManagerReposResource,
xray_resource.NewBinaryManagerBuildsResource,
xray_resource.NewCustomIssueResource,
xray_resource.NewIgnoreRuleResource,
xray_resource.NewSettingsResource,
xray_resource.NewWebhookResource,
xray_resource.NewWorkersCountResource,
Expand Down
11 changes: 2 additions & 9 deletions pkg/xray/provider/sdkv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func SdkV2() *schema.Provider {
"xray_license_policy": xray.ResourceXrayLicensePolicyV2(),
"xray_operational_risk_policy": xray.ResourceXrayOperationalRiskPolicy(),
"xray_watch": xray.ResourceXrayWatch(),
"xray_ignore_rule": xray.ResourceXrayIgnoreRule(),
"xray_repository_config": xray.ResourceXrayRepositoryConfig(),
"xray_vulnerabilities_report": xray.ResourceXrayVulnerabilitiesReport(),
"xray_licenses_report": xray.ResourceXrayLicensesReport(),
Expand Down Expand Up @@ -122,11 +121,6 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer
}
}

artifactoryVersion, err := util.GetArtifactoryVersion(restyClient)
if err != nil {
return nil, diag.FromErr(err)
}

xrayVersion, err := util.GetXrayVersion(restyClient)
if err != nil {
return nil, diag.FromErr(err)
Expand All @@ -136,9 +130,8 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer
go util.SendUsage(ctx, restyClient.R(), productId, featureUsage)

return util.ProviderMetadata{
Client: restyClient,
ArtifactoryVersion: artifactoryVersion,
XrayVersion: xrayVersion,
Client: restyClient,
XrayVersion: xrayVersion,
}, nil

}
Loading

0 comments on commit a92f1fb

Please sign in to comment.