From 3651f49dbda9d1569682ef516fdc244cdcb6b210 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Wed, 28 Jul 2021 00:04:29 -0400 Subject: [PATCH 1/2] deps: conftest 0.26.0 Signed-off-by: Rui Chen --- Dockerfile | 2 +- Dockerfile.dev | 2 +- server/controllers/events/events_controller_e2e_test.go | 6 +++--- server/core/runtime/policy/conftest_client_test.go | 4 ++-- testing/Dockerfile | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 35fe3cf006..6b691356f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN AVAILABLE_TERRAFORM_VERSIONS="0.8.8 0.9.11 0.10.8 0.11.15 0.12.31 0.13.7 0.1 done && \ ln -s /usr/local/bin/tf/versions/${DEFAULT_TERRAFORM_VERSION}/terraform /usr/local/bin/terraform -ENV DEFAULT_CONFTEST_VERSION=0.25.0 +ENV DEFAULT_CONFTEST_VERSION=0.26.0 RUN AVAILABLE_CONFTEST_VERSIONS="${DEFAULT_CONFTEST_VERSION}" && \ for VERSION in ${AVAILABLE_CONFTEST_VERSIONS}; do \ diff --git a/Dockerfile.dev b/Dockerfile.dev index fb19d0ba40..2f2d814c73 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,6 +1,6 @@ FROM runatlantis/atlantis:latest COPY atlantis /usr/local/bin/atlantis # TODO: remove this once we get this in the base image -ENV DEFAULT_CONFTEST_VERSION=0.25.0 +ENV DEFAULT_CONFTEST_VERSION=0.26.0 WORKDIR /atlantis/src diff --git a/server/controllers/events/events_controller_e2e_test.go b/server/controllers/events/events_controller_e2e_test.go index fd0c6adfe1..5f0bebae1a 100644 --- a/server/controllers/events/events_controller_e2e_test.go +++ b/server/controllers/events/events_controller_e2e_test.go @@ -38,7 +38,7 @@ import ( . "github.com/runatlantis/atlantis/testing" ) -const ConftestVersion = "0.25.0" +const ConftestVersion = "0.26.0" var applyLocker locking.ApplyLocker var userConfig server.UserConfig @@ -805,7 +805,7 @@ func setupE2E(t *testing.T, repoDir string) (events_controllers.VCSEventsControl if userConfig.EnablePolicyChecksFlag { // need this to be set or we'll fail the policy check step - os.Setenv(policy.DefaultConftestVersionEnvKey, "0.25.0") + os.Setenv(policy.DefaultConftestVersionEnvKey, "0.26.0") } // Mocks. @@ -1261,7 +1261,7 @@ func mkSubDirs(t *testing.T) (string, string, string, func()) { return tmp, binDir, cachedir, cleanup } -// Will fail test if conftest isn't in path and isn't version >= 0.25.0 +// Will fail test if conftest isn't in path and isn't version >= 0.26.0 func ensureRunningConftest(t *testing.T) { localPath, err := exec.LookPath(fmt.Sprintf("conftest%s", ConftestVersion)) if err != nil { diff --git a/server/core/runtime/policy/conftest_client_test.go b/server/core/runtime/policy/conftest_client_test.go index 85ad66755f..abbdcb9f26 100644 --- a/server/core/runtime/policy/conftest_client_test.go +++ b/server/core/runtime/policy/conftest_client_test.go @@ -22,10 +22,10 @@ import ( func TestConfTestVersionDownloader(t *testing.T) { - version, _ := version.NewVersion("0.25.0") + version, _ := version.NewVersion("0.26.0") destPath := "some/path" - fullURL := fmt.Sprintf("https://github.com/open-policy-agent/conftest/releases/download/v0.25.0/conftest_0.25.0_%s_x86_64.tar.gz?checksum=file:https://github.com/open-policy-agent/conftest/releases/download/v0.25.0/checksums.txt", strings.Title(runtime.GOOS)) + fullURL := fmt.Sprintf("https://github.com/open-policy-agent/conftest/releases/download/v0.26.0/conftest_0.26.0_%s_x86_64.tar.gz?checksum=file:https://github.com/open-policy-agent/conftest/releases/download/v0.26.0/checksums.txt", strings.Title(runtime.GOOS)) RegisterMockTestingT(t) diff --git a/testing/Dockerfile b/testing/Dockerfile index aacf341032..3407de578a 100644 --- a/testing/Dockerfile +++ b/testing/Dockerfile @@ -13,7 +13,7 @@ RUN curl -LOks https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/ter rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip # Install conftest -ENV DEFAULT_CONFTEST_VERSION=0.25.0 +ENV DEFAULT_CONFTEST_VERSION=0.26.0 RUN AVAILABLE_CONFTEST_VERSIONS="${DEFAULT_CONFTEST_VERSION}" && \ for VERSION in ${AVAILABLE_CONFTEST_VERSIONS}; do \ From a1860003cb8df83831571766ee289caedd6f729f Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Sat, 21 Aug 2021 17:26:06 -0400 Subject: [PATCH 2/2] update conftest path lookup --- .../events/events_controller_e2e_test.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/server/controllers/events/events_controller_e2e_test.go b/server/controllers/events/events_controller_e2e_test.go index 5f0bebae1a..89a487419e 100644 --- a/server/controllers/events/events_controller_e2e_test.go +++ b/server/controllers/events/events_controller_e2e_test.go @@ -55,13 +55,6 @@ func (m *NoopTFDownloader) GetAny(dst, src string, opts ...getter.ClientOption) return nil } -type LocalConftestCache struct { -} - -func (m *LocalConftestCache) Get(key *version.Version) (string, error) { - return exec.LookPath(fmt.Sprintf("conftest%s", ConftestVersion)) -} - func TestGitHubWorkflow(t *testing.T) { if testing.Short() { @@ -900,10 +893,6 @@ func setupE2E(t *testing.T, repoDir string) (events_controllers.VCSEventsControl conftextExec := policy.NewConfTestExecutorWorkflow(logger, binDir, &NoopTFDownloader{}) - // swapping out version cache to something that always returns local contest - // binary - conftextExec.VersionCache = &LocalConftestCache{} - policyCheckRunner, err := runtime.NewPolicyCheckStepRunner( conftestVersion, conftextExec, @@ -1263,7 +1252,7 @@ func mkSubDirs(t *testing.T) (string, string, string, func()) { // Will fail test if conftest isn't in path and isn't version >= 0.26.0 func ensureRunningConftest(t *testing.T) { - localPath, err := exec.LookPath(fmt.Sprintf("conftest%s", ConftestVersion)) + localPath, err := exec.LookPath("conftest") if err != nil { t.Logf("conftest >= %s must be installed to run this test", ConftestVersion) t.FailNow()