Skip to content

Commit 59a0d16

Browse files
authored
Merge branch 'main' into zainq11/bitbucket-data-center
2 parents 61fa4cc + 5095c61 commit 59a0d16

File tree

7 files changed

+94
-70
lines changed

7 files changed

+94
-70
lines changed
Lines changed: 67 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: MPL-2.0
33

4-
name: Test
4+
name: TESTS ARE TEMPOARILY DISABLED
55
description: Tests terraform-provider-tfe within a matrix
66
inputs:
77
admin_configuration_token:
@@ -51,72 +51,76 @@ inputs:
5151
runs:
5252
using: composite
5353
steps:
54-
- name: Set up Go
55-
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
56-
with:
57-
go-version-file: go.mod
58-
cache: true
59-
60-
- name: Sync dependencies
54+
- name: NO-OP
6155
shell: bash
6256
run: |
63-
go mod download
64-
go mod tidy
57+
echo "Tests are skipped. Please test manually."
58+
# - name: Set up Go
59+
# uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
60+
# with:
61+
# go-version-file: go.mod
62+
# cache: true
6563

66-
- name: Install gotestsum
67-
shell: bash
68-
run: go install gotest.tools/gotestsum@latest
64+
# - name: Sync dependencies
65+
# shell: bash
66+
# run: |
67+
# go mod download
68+
# go mod tidy
6969

70-
- name: Download artifact
71-
id: download-artifact
72-
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
73-
with:
74-
workflow_conclusion: success
75-
name: junit-test-summary
76-
if_no_artifact_found: warn
77-
branch: main
70+
# - name: Install gotestsum
71+
# shell: bash
72+
# run: go install gotest.tools/gotestsum@latest
7873

79-
- name: Split acceptance tests
80-
id: test_split
81-
uses: hashicorp-forge/go-test-split-action@796beedbdb3d1bea14cad2d3057bab5c5cf15fe5 # v1.0.2
82-
with:
83-
index: ${{ inputs.matrix_index }}
84-
total: ${{ inputs.matrix_total }}
85-
junit-summary: ./ci-summary-provider.xml
86-
# When tests are split and run concurrently, lists_tests arg in ci.yml will skip the TestAccTFESAMLSettings_omnibus test suite
87-
list: ${{ inputs.list_tests }}
74+
# - name: Download artifact
75+
# id: download-artifact
76+
# uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
77+
# with:
78+
# workflow_conclusion: success
79+
# name: junit-test-summary
80+
# if_no_artifact_found: warn
81+
# branch: main
8882

89-
- name: Run Tests
90-
shell: bash
91-
env:
92-
TFE_HOSTNAME: "${{ inputs.hostname }}"
93-
TFE_TOKEN: "${{ inputs.token }}"
94-
TFE_ADMIN_CONFIGURATION_TOKEN: ${{ inputs.admin_configuration_token }}
95-
TFE_ADMIN_PROVISION_LICENSES_TOKEN: ${{ inputs.admin_provision_licenses_token }}
96-
TFE_ADMIN_SECURITY_MAINTENANCE_TOKEN: ${{ inputs.admin_security_maintenance_token }}
97-
TFE_ADMIN_SITE_ADMIN_TOKEN: ${{ inputs.admin_site_admin_token }}
98-
TFE_ADMIN_SUBSCRIPTION_TOKEN: ${{ inputs.admin_subscription_token }}
99-
TFE_ADMIN_SUPPORT_TOKEN: ${{ inputs.admin_support_token }}
100-
TFE_ADMIN_VERSION_MAINTENANCE_TOKEN: ${{ inputs.admin_version_maintenance_token }}
101-
TFE_USER1: tfe-provider-user1
102-
TFE_USER2: tfe-provider-user2
103-
TF_ACC: "1"
104-
ENABLE_TFE: "${{ inputs.enterprise }}"
105-
RUN_TASKS_URL: "http://testing-mocks.tfe:22180/runtasks/pass"
106-
GITHUB_POLICY_SET_IDENTIFIER: "hashicorp/test-policy-set"
107-
GITHUB_REGISTRY_MODULE_IDENTIFIER: "hashicorp/terraform-random-module"
108-
GITHUB_WORKSPACE_IDENTIFIER: "hashicorp/terraform-random-module"
109-
GITHUB_WORKSPACE_BRANCH: "main"
110-
GITHUB_TOKEN: "${{ inputs.testing-github-token }}"
111-
MOD_PROVIDER: github.com/hashicorp/terraform-provider-tfe
112-
MOD_TFE: github.com/hashicorp/terraform-provider-tfe/internal/provider
113-
MOD_VERSION: github.com/hashicorp/terraform-provider-tfe/version
114-
run: |
115-
gotestsum --junitfile summary.xml --format short-verbose -- $MOD_PROVIDER $MOD_TFE $MOD_VERSION -v -timeout=30m -run "${{ steps.test_split.outputs.run }}"
83+
# - name: Split acceptance tests
84+
# id: test_split
85+
# uses: hashicorp-forge/go-test-split-action@796beedbdb3d1bea14cad2d3057bab5c5cf15fe5 # v1.0.2
86+
# with:
87+
# index: ${{ inputs.matrix_index }}
88+
# total: ${{ inputs.matrix_total }}
89+
# junit-summary: ./ci-summary-provider.xml
90+
# # When tests are split and run concurrently, lists_tests arg in ci.yml will skip the TestAccTFESAMLSettings_omnibus test suite
91+
# list: ${{ inputs.list_tests }}
92+
93+
# - name: Run Tests
94+
# shell: bash
95+
# env:
96+
# TFE_HOSTNAME: "${{ inputs.hostname }}"
97+
# TFE_TOKEN: "${{ inputs.token }}"
98+
# TFE_ADMIN_CONFIGURATION_TOKEN: ${{ inputs.admin_configuration_token }}
99+
# TFE_ADMIN_PROVISION_LICENSES_TOKEN: ${{ inputs.admin_provision_licenses_token }}
100+
# TFE_ADMIN_SECURITY_MAINTENANCE_TOKEN: ${{ inputs.admin_security_maintenance_token }}
101+
# TFE_ADMIN_SITE_ADMIN_TOKEN: ${{ inputs.admin_site_admin_token }}
102+
# TFE_ADMIN_SUBSCRIPTION_TOKEN: ${{ inputs.admin_subscription_token }}
103+
# TFE_ADMIN_SUPPORT_TOKEN: ${{ inputs.admin_support_token }}
104+
# TFE_ADMIN_VERSION_MAINTENANCE_TOKEN: ${{ inputs.admin_version_maintenance_token }}
105+
# TFE_USER1: tfe-provider-user1
106+
# TFE_USER2: tfe-provider-user2
107+
# TF_ACC: "1"
108+
# ENABLE_TFE: "${{ inputs.enterprise }}"
109+
# RUN_TASKS_URL: "http://testing-mocks.tfe:22180/runtasks/pass"
110+
# GITHUB_POLICY_SET_IDENTIFIER: "hashicorp/test-policy-set"
111+
# GITHUB_REGISTRY_MODULE_IDENTIFIER: "hashicorp/terraform-random-module"
112+
# GITHUB_WORKSPACE_IDENTIFIER: "hashicorp/terraform-random-module"
113+
# GITHUB_WORKSPACE_BRANCH: "main"
114+
# GITHUB_TOKEN: "${{ inputs.testing-github-token }}"
115+
# MOD_PROVIDER: github.com/hashicorp/terraform-provider-tfe
116+
# MOD_TFE: github.com/hashicorp/terraform-provider-tfe/internal/provider
117+
# MOD_VERSION: github.com/hashicorp/terraform-provider-tfe/version
118+
# run: |
119+
# gotestsum --junitfile summary.xml --format short-verbose -- $MOD_PROVIDER $MOD_TFE $MOD_VERSION -v -timeout=30m -run "${{ steps.test_split.outputs.run }}"
116120

117-
- name: Upload test artifacts
118-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
119-
with:
120-
name: junit-test-summary-${{ matrix.index }}
121-
path: summary.xml
122-
retention-days: 1
121+
# - name: Upload test artifacts
122+
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
123+
# with:
124+
# name: junit-test-summary-${{ matrix.index }}
125+
# path: summary.xml
126+
# retention-days: 1

.github/workflows/ci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12+
notice:
13+
name: TESTS ARE TEMPORARILY DISABLED- RUN CHANGED RESOURCE TESTS LOCALLY
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: NO-OP
17+
run: |
18+
echo "Tests are skipped. Please test manually."
1219
lint:
1320
name: lint
1421
runs-on: ubuntu-latest
@@ -24,8 +31,8 @@ jobs:
2431
fail-fast: false
2532
matrix:
2633
# If you adjust these parameters, also adjust the jrm input files on the "Merge reports" step below
27-
total: [ 5 ]
28-
index: [ 0, 1, 2, 3, 4 ]
34+
total: [ 1 ]
35+
index: [ 0 ]
2936
steps:
3037
- name: Fetch Outputs
3138
id: tflocal
@@ -73,7 +80,7 @@ jobs:
7380
run: npm install -g junit-report-merger
7481

7582
- name: Merge reports
76-
run: jrm ./ci-summary-provider.xml "junit-test-summary-0/*.xml" "junit-test-summary-1/*.xml" "junit-test-summary-2/*.xml" "junit-test-summary-3/*.xml" "junit-test-summary-4/*.xml"
83+
run: jrm ./ci-summary-provider.xml "junit-test-summary-0/*.xml"
7784

7885
- name: Upload test artifacts
7986
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3

.github/workflows/nightly-tfe-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
total: [ 5 ]
29-
index: [ 0, 1, 2, 3, 4 ]
28+
total: [ 1 ]
29+
index: [ 0 ]
3030
steps:
3131
- name: Fetch Outputs
3232
id: tflocal

internal/provider/resource_tfe_policy.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func createOPAPolicyOptions(options *tfe.PolicyCreateOptions, d *schema.Resource
194194
enforceOpts.Mode = tfe.EnforcementMode(tfe.EnforcementLevel(v.(string)))
195195
}
196196

197-
options.Enforce = []*tfe.EnforcementOptions{enforceOpts}
197+
options.Enforce = []*tfe.EnforcementOptions{enforceOpts} //nolint:staticcheck // this is still used by TFE versions older than 202306-1
198198

199199
vQuery, ok := d.GetOk("query")
200200
if !ok {
@@ -218,7 +218,7 @@ func createSentinelPolicyOptions(options *tfe.PolicyCreateOptions, d *schema.Res
218218
enforceOpts.Mode = tfe.EnforcementMode(tfe.EnforcementLevel(v.(string)))
219219
}
220220

221-
options.Enforce = []*tfe.EnforcementOptions{enforceOpts}
221+
options.Enforce = []*tfe.EnforcementOptions{enforceOpts} //nolint:staticcheck // this is still used by TFE versions older than 202306-1
222222
return options
223223
}
224224

@@ -254,6 +254,7 @@ func resourceTFEPolicyRead(d *schema.ResourceData, meta interface{}) error {
254254
d.Set("description", policy.Description)
255255
d.Set("kind", policy.Kind)
256256

257+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
257258
if len(policy.Enforce) == 1 {
258259
d.Set("enforce_mode", string(policy.Enforce[0].Mode))
259260
}
@@ -287,6 +288,7 @@ func resourceTFEPolicyUpdate(d *schema.ResourceData, meta interface{}) error {
287288
}
288289
}
289290
if d.HasChange("enforce_mode") {
291+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
290292
options.Enforce = []*tfe.EnforcementOptions{
291293
{
292294
Path: tfe.String(path),

internal/provider/resource_tfe_policy_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ func testAccCheckTFEPolicyAttributes(
404404
return fmt.Errorf("Bad name: %s", policy.Name)
405405
}
406406

407+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
407408
if policy.Enforce[0].Mode != "hard-mandatory" {
408409
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
409410
}
@@ -419,6 +420,7 @@ func testAccCheckTFEOPAPolicyAttributes(
419420
return fmt.Errorf("Bad name: %s", policy.Name)
420421
}
421422

423+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
422424
if policy.Enforce[0].Mode != "mandatory" {
423425
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
424426
}
@@ -438,10 +440,12 @@ func testAccCheckTFEDefaultPolicyAttributes(policy *tfe.Policy) resource.TestChe
438440
}
439441

440442
switch policy.Kind {
443+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
441444
case tfe.Sentinel:
442445
if policy.Enforce[0].Mode != "soft-mandatory" {
443446
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
444447
}
448+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
445449
case tfe.OPA:
446450
if policy.Enforce[0].Mode != "advisory" {
447451
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
@@ -458,6 +462,7 @@ func testAccCheckTFEPolicyAttributesUpdated(
458462
return fmt.Errorf("Bad name: %s", policy.Name)
459463
}
460464

465+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
461466
if policy.Enforce[0].Mode != "soft-mandatory" {
462467
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
463468
}
@@ -473,6 +478,7 @@ func testAccCheckTFEOPAPolicyAttributesUpdatedQuery(
473478
return fmt.Errorf("Bad name: %s", policy.Name)
474479
}
475480

481+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
476482
if policy.Enforce[0].Mode != "mandatory" {
477483
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
478484
}
@@ -492,6 +498,7 @@ func testAccCheckTFEOPAPolicyAttributesUpdatedAll(
492498
return fmt.Errorf("Bad name: %s", policy.Name)
493499
}
494500

501+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
495502
if policy.Enforce[0].Mode != "advisory" {
496503
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
497504
}

internal/provider/resource_tfe_sentinel_policy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ func resourceTFESentinelPolicyRead(d *schema.ResourceData, meta interface{}) err
136136
d.Set("name", policy.Name)
137137
d.Set("description", policy.Description)
138138

139+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
139140
if len(policy.Enforce) == 1 {
140141
d.Set("enforce_mode", string(policy.Enforce[0].Mode))
141142
}
@@ -161,6 +162,7 @@ func resourceTFESentinelPolicyUpdate(d *schema.ResourceData, meta interface{}) e
161162
}
162163

163164
if d.HasChange("enforce_mode") {
165+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
164166
options.Enforce = []*tfe.EnforcementOptions{
165167
{
166168
Path: tfe.String(d.Get("name").(string) + ".sentinel"),

internal/provider/resource_tfe_sentinel_policy_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ func testAccCheckTFESentinelPolicyAttributes(
147147
return fmt.Errorf("Bad name: %s", policy.Name)
148148
}
149149

150+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
150151
if policy.Enforce[0].Mode != "hard-mandatory" {
151152
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
152153
}
@@ -162,6 +163,7 @@ func testAccCheckTFESentinelPolicyAttributesUpdated(
162163
return fmt.Errorf("Bad name: %s", policy.Name)
163164
}
164165

166+
//nolint:staticcheck // this is still used by TFE versions older than 202306-1
165167
if policy.Enforce[0].Mode != "soft-mandatory" {
166168
return fmt.Errorf("Bad enforce mode: %s", policy.Enforce[0].Mode)
167169
}

0 commit comments

Comments
 (0)