From 42353e8c034e1bff15f3d60be77ceb9a1b581730 Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Wed, 30 Oct 2024 13:34:48 -0700 Subject: [PATCH 1/3] Fix time parsing for 'expiration_date' from API payload --- pkg/xray/resource/resource_xray_ignore_rule.go | 2 +- pkg/xray/resource/resource_xray_ignore_rule_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/xray/resource/resource_xray_ignore_rule.go b/pkg/xray/resource/resource_xray_ignore_rule.go index b556cbd8..a7227958 100644 --- a/pkg/xray/resource/resource_xray_ignore_rule.go +++ b/pkg/xray/resource/resource_xray_ignore_rule.go @@ -348,7 +348,7 @@ func (m *IgnoreRuleResourceModel) fromAPIModel(ctx context.Context, apiModel Ign expiresAt := types.StringNull() if apiModel.ExpiresAt != nil { - expiresAt = types.StringValue(apiModel.ExpiresAt.Format("2006-01-02")) + expiresAt = types.StringValue(apiModel.ExpiresAt.Local().Format("2006-01-02")) } m.ExpiredAt = expiresAt diff --git a/pkg/xray/resource/resource_xray_ignore_rule_test.go b/pkg/xray/resource/resource_xray_ignore_rule_test.go index 7fff64ca..c1e9aaf1 100644 --- a/pkg/xray/resource/resource_xray_ignore_rule_test.go +++ b/pkg/xray/resource/resource_xray_ignore_rule_test.go @@ -607,7 +607,7 @@ func sourceTestCase(source string, t *testing.T) (*testing.T, resource.TestCase) func TestAccIgnoreRule_artifact(t *testing.T) { _, fqrn, name := testutil.MkNames("ignore-rule-", "xray_ignore_rule") - expirationDate := time.Now().Add(time.Hour * 48) + expirationDate := time.Now().UTC().Add(time.Hour * 48) config := util.ExecuteTemplate("TestAccIgnoreRule", ` resource "xray_ignore_rule" "{{ .name }}" { @@ -624,7 +624,7 @@ func TestAccIgnoreRule_artifact(t *testing.T) { } `, map[string]interface{}{ "name": name, - "expirationDate": expirationDate.Format("2006-01-02"), + "expirationDate": expirationDate.Local().Format("2006-01-02"), }) resource.Test(t, resource.TestCase{ @@ -636,7 +636,7 @@ func TestAccIgnoreRule_artifact(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(fqrn, "id"), resource.TestCheckResourceAttr(fqrn, "notes", "fake notes"), - resource.TestCheckResourceAttr(fqrn, "expiration_date", expirationDate.Format("2006-01-02")), + resource.TestCheckResourceAttr(fqrn, "expiration_date", expirationDate.Local().Format("2006-01-02")), resource.TestCheckResourceAttr(fqrn, "is_expired", "false"), resource.TestCheckResourceAttr(fqrn, "artifact.#", "1"), resource.TestCheckResourceAttr(fqrn, "artifact.0.name", "fake-name"), From b8121cda4fa6fd35d789428fd02bfaa8265e4fb1 Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Wed, 30 Oct 2024 13:35:44 -0700 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1fa593b..6d5c392e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.13.1 (October 31, 2024) + +BUG FIXES: + +* resource/xray_ignore_rule: Fix another date parsing issue with timezone for `expiration_date` attribute. Issue: [#259](https://github.com/jfrog/terraform-provider-xray/issues/259) PR: [#260](https://github.com/jfrog/terraform-provider-xray/issues/260) + ## 2.13.0 (October 17, 2024). Tested on Artifactory 7.90.14 and Xray 3.104.18 with Terraform 1.9.8 and OpenTofu 1.8.3 IMPROVEMENTS: From 19d1a2683edb5df4043699e430071fad7c45e59c Mon Sep 17 00:00:00 2001 From: JFrog CI Date: Wed, 30 Oct 2024 21:10:47 +0000 Subject: [PATCH 3/3] JFrog Pipelines - Add Artifactory version to CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d5c392e..e638a76e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.13.1 (October 31, 2024) +## 2.13.1 (October 31, 2024). Tested on Artifactory 7.98.7 and Xray 3.104.18 with Terraform 1.9.8 and OpenTofu 1.8.4 BUG FIXES: