Skip to content

Commit

Permalink
Merge pull request #1068 from jfrog/update-cleanup-policy-doc
Browse files Browse the repository at this point in the history
Add warning message to artifactory_package_cleanup_policy doc
  • Loading branch information
alexhung authored Sep 9, 2024
2 parents b013101 + 832cef3 commit 7d4747f
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 38 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 11.9.1 (September 9, 2024). Tested on Artifactory 7.90.9 with Terraform 1.9.5 and OpenTofu 1.8.2

IMPROVEMENTS:

* resource/artifactory_package_cleanup_policy: Add beta warning message to documentation. PR: [#1068](https://github.com/jfrog/terraform-provider-artifactory/pull/1068)

## 11.9.0 (September 6, 2024). Tested on Artifactory 7.90.9 with Terraform 1.9.5 and OpenTofu 1.8.2

IMPROVEMENTS:
Expand Down
3 changes: 3 additions & 0 deletions docs/resources/package_cleanup_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ subcategory: "Configuration"
description: |-
Provides an Artifactory Package Cleanup Policy resource. This resource enable system administrators to define and customize policies based on specific criteria for removing unused binaries from across their JFrog platform. See Rentation Policies https://jfrog.com/help/r/jfrog-platform-administration-documentation/retention-policies for more details.
->Only available for Artifactory 7.90.1 or later.
~>Currently in beta and not yet globally available. A full rollout is scheduled for early October 2024.
---

# artifactory_package_cleanup_policy (Resource)
Expand All @@ -13,6 +14,8 @@ Provides an Artifactory Package Cleanup Policy resource. This resource enable sy

->Only available for Artifactory 7.90.1 or later.

~>Currently in beta and not yet globally available. A full rollout is scheduled for early October 2024.

## Example Usage

```terraform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ func (r *PackageCleanupPolicyResource) Schema(ctx context.Context, req resource.
Version: 1,
Description: "Provides an Artifactory Package Cleanup Policy resource. This resource enable system administrators to define and customize policies based on specific criteria for removing unused binaries from across their JFrog platform. " +
"See [Rentation Policies](https://jfrog.com/help/r/jfrog-platform-administration-documentation/retention-policies) for more details.\n\n" +
"->Only available for Artifactory 7.90.1 or later.",
"->Only available for Artifactory 7.90.1 or later.\n\n" +
"~>Currently in beta and not yet globally available. A full rollout is scheduled for early October 2024.",
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestAccWebhook_ArtifactLifecycle(t *testing.T) {
"restore",
]
handler {
url = "https://tempurl.org"
url = "https://google.com"
secret = "fake-secret"
use_secret_for_signing = {{ .useSecretForSigning }}
custom_http_headers = {
Expand All @@ -50,7 +50,7 @@ func TestAccWebhook_ArtifactLifecycle(t *testing.T) {
resource.TestCheckResourceAttr(fqrn, "key", name),
resource.TestCheckResourceAttr(fqrn, "event_types.#", "2"),
resource.TestCheckResourceAttr(fqrn, "handler.#", "1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secret", "fake-secret"),
resource.TestCheckResourceAttr(fqrn, "handler.0.use_secret_for_signing", fmt.Sprintf("%t", params["useSecretForSigning"])),
resource.TestCheckResourceAttr(fqrn, "handler.0.custom_http_headers.%", "2"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func customWebhookTestCase(webhookType string, t *testing.T) (*testing.T, resour
exclude_patterns = ["bar/**"]
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
secrets = {
secret1 = "value1"
secret2 = "value2"
Expand All @@ -71,7 +71,7 @@ func customWebhookTestCase(webhookType string, t *testing.T) (*testing.T, resour
payload = "{ \"ref\": \"main\" , \"inputs\": { \"artifact_path\": \"test-repo/repo-path\" } }"
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
secrets = {
secret3 = "value3"
secret4 = "value4"
Expand All @@ -83,7 +83,7 @@ func customWebhookTestCase(webhookType string, t *testing.T) (*testing.T, resour
payload = "{ \"ref\": \"main\" , \"inputs\": { \"artifact_path\": \"test-repo/repo-path\" } }"
}
handler {
url = "https://tempurl.com"
url = "https://google.com"
payload = "{ \"ref\": \"main\" , \"inputs\": { \"artifact_path\": \"test-repo/repo-path\" } }"
}
Expand All @@ -104,23 +104,23 @@ func customWebhookTestCase(webhookType string, t *testing.T) (*testing.T, resour
resource.TestCheckResourceAttr(fqrn, "criteria.0.exclude_patterns.#", "1"),
resource.TestCheckResourceAttr(fqrn, "criteria.0.exclude_patterns.0", "bar/**"),
resource.TestCheckResourceAttr(fqrn, "handler.#", "3"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.%", "2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.secret1", "value1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.secret2", "value2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.http_headers.%", "2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.http_headers.header-1", "value-1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.http_headers.header-2", "value-2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.payload", "{ \"ref\": \"main\" , \"inputs\": { \"artifact_path\": \"test-repo/repo-path\" } }"),
resource.TestCheckResourceAttr(fqrn, "handler.1.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.1.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.1.secrets.%", "2"),
resource.TestCheckResourceAttr(fqrn, "handler.1.secrets.secret3", "value3"),
resource.TestCheckResourceAttr(fqrn, "handler.1.secrets.secret4", "value4"),
resource.TestCheckResourceAttr(fqrn, "handler.1.http_headers.%", "2"),
resource.TestCheckResourceAttr(fqrn, "handler.1.http_headers.header-3", "value-3"),
resource.TestCheckResourceAttr(fqrn, "handler.1.http_headers.header-4", "value-4"),
resource.TestCheckResourceAttr(fqrn, "handler.1.payload", "{ \"ref\": \"main\" , \"inputs\": { \"artifact_path\": \"test-repo/repo-path\" } }"),
resource.TestCheckResourceAttr(fqrn, "handler.2.url", "https://tempurl.com"),
resource.TestCheckResourceAttr(fqrn, "handler.2.url", "https://google.com"),
resource.TestCheckNoResourceAttr(fqrn, "handler.2.secrets"),
resource.TestCheckNoResourceAttr(fqrn, "handler.2.http_headers"),
resource.TestCheckResourceAttr(fqrn, "handler.2.payload", "{ \"ref\": \"main\" , \"inputs\": { \"artifact_path\": \"test-repo/repo-path\" } }"),
Expand Down Expand Up @@ -171,7 +171,7 @@ func TestAccCustomWebhook_BuildWithIncludePatterns(t *testing.T) {
include_patterns = ["foo"]
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
payload = "{ \"ref\": \"main\" , \"inputs\": { \"artifact_path\": \"test-repo/repo-path\" } }"
}
}
Expand Down Expand Up @@ -206,7 +206,7 @@ func TestAccCustomWebhook_User(t *testing.T) {
description = "test description"
event_types = ["locked"]
handler {
url = "https://tempurl.org"
url = "https://google.com"
secrets = {
secret1 = "value1"
secret2 = "value2"
Expand All @@ -231,7 +231,7 @@ func TestAccCustomWebhook_User(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(fqrn, "event_types.#", "1"),
resource.TestCheckResourceAttr(fqrn, "handler.#", "1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.secret1", "value1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.secret2", "value2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.http_headers.%", "2"),
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestAccCustomWebhook_ArtifactLifecycle(t *testing.T) {
description = "test description"
event_types = ["archive", "restore"]
handler {
url = "https://tempurl.org"
url = "https://google.com"
secrets = {
secret1 = "value1"
secret2 = "value2"
Expand All @@ -288,7 +288,7 @@ func TestAccCustomWebhook_ArtifactLifecycle(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(fqrn, "event_types.#", "2"),
resource.TestCheckResourceAttr(fqrn, "handler.#", "1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.secret1", "value1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.secret2", "value2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.http_headers.%", "2"),
Expand Down Expand Up @@ -330,7 +330,7 @@ func TestAccCustomWebhook_ReleaseBundleV2Promotion(t *testing.T) {
]
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
secrets = {
secret1 = "value1"
secret2 = "value2"
Expand Down Expand Up @@ -359,7 +359,7 @@ func TestAccCustomWebhook_ReleaseBundleV2Promotion(t *testing.T) {
resource.TestCheckTypeSetElemAttr(fqrn, "criteria.0.selected_environments.*", "PROD"),
resource.TestCheckTypeSetElemAttr(fqrn, "criteria.0.selected_environments.*", "DEV"),
resource.TestCheckResourceAttr(fqrn, "handler.#", "1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.secret1", "value1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secrets.secret2", "value2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.http_headers.%", "2"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestAccWebhook_ReleaseBundleV2Promotion(t *testing.T) {
]
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
secret = "fake-secret"
use_secret_for_signing = {{ .useSecretForSigning }}
custom_http_headers = {
Expand All @@ -61,7 +61,7 @@ func TestAccWebhook_ReleaseBundleV2Promotion(t *testing.T) {
resource.TestCheckTypeSetElemAttr(fqrn, "criteria.0.selected_environments.*", "PROD"),
resource.TestCheckTypeSetElemAttr(fqrn, "criteria.0.selected_environments.*", "DEV"),
resource.TestCheckResourceAttr(fqrn, "handler.#", "1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secret", "fake-secret"),
resource.TestCheckResourceAttr(fqrn, "handler.0.use_secret_for_signing", fmt.Sprintf("%t", params["useSecretForSigning"])),
resource.TestCheckResourceAttr(fqrn, "handler.0.custom_http_headers.%", "2"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var repoTemplate = `
repo_keys = []
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
}
}
`
Expand All @@ -61,7 +61,7 @@ var buildTemplate = `
selected_builds = []
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
}
}
`
Expand All @@ -76,7 +76,7 @@ var releaseBundleTemplate = `
registered_release_bundle_names = []
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
}
}
`
Expand All @@ -91,7 +91,7 @@ var releaseBundleV2Template = `
selected_release_bundles = []
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
}
}
`
Expand Down Expand Up @@ -167,7 +167,7 @@ func TestAccWebhook_EventTypesValidation(t *testing.T) {
repo_keys = []
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
}
}
`, params)
Expand Down Expand Up @@ -206,7 +206,7 @@ func TestAccWebhook_HandlerValidation_EmptyProxy(t *testing.T) {
repo_keys = []
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
proxy = ""
}
}
Expand Down Expand Up @@ -246,8 +246,8 @@ func TestAccWebhook_HandlerValidation_ProxyWithURL(t *testing.T) {
repo_keys = []
}
handler {
url = "https://tempurl.org"
proxy = "https://tempurl.org"
url = "https://google.com"
proxy = "https://google.com"
}
}
`, params)
Expand All @@ -260,7 +260,7 @@ func TestAccWebhook_HandlerValidation_ProxyWithURL(t *testing.T) {
Steps: []resource.TestStep{
{
Config: webhookConfig,
ExpectError: regexp.MustCompile(`expected "proxy" not to be a valid url, got https://tempurl.org`),
ExpectError: regexp.MustCompile(`expected "proxy" not to be a valid url, got https://google.com`),
},
},
})
Expand All @@ -285,7 +285,7 @@ func TestAccWebhook_BuildWithIncludePatterns(t *testing.T) {
include_patterns = ["foo"]
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
}
}
`, params)
Expand Down Expand Up @@ -355,7 +355,7 @@ func webhookTestCase(webhookType string, t *testing.T) (*testing.T, resource.Tes
exclude_patterns = ["bar/**"]
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
secret = "fake-secret"
use_secret_for_signing = {{ .useSecretForSigning }}
custom_http_headers = {
Expand Down Expand Up @@ -385,7 +385,7 @@ func webhookTestCase(webhookType string, t *testing.T) (*testing.T, resource.Tes
repo_keys = [artifactory_local_{{ .repoType }}_repository.{{ .repoName }}.key]
}
handler {
url = "https://tempurl.org"
url = "https://google.com"
secret = "fake-secret"
use_secret_for_signing = {{ .useSecretForSigning }}
custom_http_headers = {
Expand All @@ -412,7 +412,7 @@ func webhookTestCase(webhookType string, t *testing.T) (*testing.T, resource.Tes
resource.TestCheckResourceAttr(fqrn, "criteria.0.exclude_patterns.#", "1"),
resource.TestCheckResourceAttr(fqrn, "criteria.0.exclude_patterns.0", "bar/**"),
resource.TestCheckResourceAttr(fqrn, "handler.#", "2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secret", "fake-secret"),
resource.TestCheckResourceAttr(fqrn, "handler.0.use_secret_for_signing", fmt.Sprintf("%t", params["useSecretForSigning"])),
resource.TestCheckResourceAttr(fqrn, "handler.0.custom_http_headers.%", "2"),
Expand All @@ -434,7 +434,7 @@ func webhookTestCase(webhookType string, t *testing.T) (*testing.T, resource.Tes
resource.TestCheckResourceAttr(fqrn, "criteria.0.include_patterns.#", "0"),
resource.TestCheckResourceAttr(fqrn, "criteria.0.exclude_patterns.#", "0"),
resource.TestCheckResourceAttr(fqrn, "handler.#", "2"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secret", "fake-secret"),
resource.TestCheckResourceAttr(fqrn, "handler.0.use_secret_for_signing", fmt.Sprintf("%t", params["useSecretForSigning"])),
resource.TestCheckResourceAttr(fqrn, "handler.0.custom_http_headers.%", "2"),
Expand Down Expand Up @@ -566,7 +566,7 @@ func TestAccWebhook_GH476WebHookChangeBearerSet0(t *testing.T) {
// Unit tests for state migration func
func TestWebhook_ResourceStateUpgradeV1(t *testing.T) {
v1Data := map[string]interface{}{
"url": "https://tempurl.org",
"url": "https://google.com",
"secret": "fake-secret",
"proxy": "fake-proxy-key",
"custom_http_headers": map[string]interface{}{
Expand All @@ -577,7 +577,7 @@ func TestWebhook_ResourceStateUpgradeV1(t *testing.T) {
v2Data := map[string]interface{}{
"handler": []map[string]interface{}{
{
"url": "https://tempurl.org",
"url": "https://google.com",
"secret": "fake-secret",
"proxy": "fake-proxy-key",
"custom_http_headers": map[string]interface{}{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestAccWebhook_User(t *testing.T) {
description = "test description"
event_types = ["locked"]
handler {
url = "https://tempurl.org"
url = "https://google.com"
secret = "fake-secret"
use_secret_for_signing = {{ .useSecretForSigning }}
custom_http_headers = {
Expand All @@ -45,7 +45,7 @@ func TestAccWebhook_User(t *testing.T) {
Config: webhookConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(fqrn, "handler.#", "1"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://tempurl.org"),
resource.TestCheckResourceAttr(fqrn, "handler.0.url", "https://google.com"),
resource.TestCheckResourceAttr(fqrn, "handler.0.secret", "fake-secret"),
resource.TestCheckResourceAttr(fqrn, "handler.0.use_secret_for_signing", fmt.Sprintf("%t", params["useSecretForSigning"])),
resource.TestCheckResourceAttr(fqrn, "handler.0.custom_http_headers.%", "2"),
Expand Down
3 changes: 1 addition & 2 deletions scripts/run-artifactory-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ echo "ARTIFACTORY_VERSION=${ARTIFACTORY_VERSION}" > /dev/stderr

set -euf

sudo rm -rf ${SCRIPT_DIR}/artifactory/
rm -rf ${SCRIPT_DIR}/artifactory/

mkdir -p ${SCRIPT_DIR}/artifactory/extra_conf
mkdir -p ${SCRIPT_DIR}/artifactory/var/etc/access

mkdir -p ${SCRIPT_DIR}/artifactory/var/etc/access
sudo chown -R 1030:1030 ${SCRIPT_DIR}/artifactory/var

cp ${SCRIPT_DIR}/artifactory.lic ${SCRIPT_DIR}/artifactory/extra_conf
cp ${SCRIPT_DIR}/system.yaml ${SCRIPT_DIR}/artifactory/var/etc/
Expand Down

0 comments on commit 7d4747f

Please sign in to comment.