Skip to content

Commit

Permalink
Merge pull request #797 from cncf/set-k8sdata-gate
Browse files Browse the repository at this point in the history
only load data if env var LOAD_K8S_DATA is set
  • Loading branch information
zachmandeville authored Sep 12, 2023
2 parents 6061491 + 3a0f032 commit 6d8162d
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 2 deletions.
9 changes: 9 additions & 0 deletions apps/snoopdb/postgres/initdb/500_load_all_open_api.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
\set load_k8s_data null
\getenv load_k8s_data LOAD_K8S_DATA
select :load_k8s_data is not null as proceed;
\gset

\if :proceed
begin;
select f.*
from
(select release from grab_past_releases() as release) r
, lateral load_open_api(r.release::text) f("build log");
select * from load_open_api() f("build log");
commit;
\else
select 'skipping as envvar LOAD_K8S_DATA is not set' as "build log";
\endif
9 changes: 9 additions & 0 deletions apps/snoopdb/postgres/initdb/501_load_all_tests.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
\set load_k8s_data null
\getenv load_k8s_data LOAD_K8S_DATA
select :load_k8s_data is not null as proceed;
\gset

\if :proceed
begin;
select * from load_tests() f("build log");
commit;
\else
select 'skipping as envvar LOAD_K8S_DATA is not set' as "build log";
\endif
9 changes: 9 additions & 0 deletions apps/snoopdb/postgres/initdb/502_load_all_audit_events.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
\set load_k8s_data null
\getenv load_k8s_data LOAD_K8S_DATA
select :load_k8s_data is not null as proceed;
\gset

\if :proceed
begin;
select * from load_audit_events('ci-kubernetes-e2e-gci-gce') f("build log");
select * from load_audit_events('ci-kubernetes-gce-conformance-latest') f("build log");
select * from load_audit_events('ci-audit-kind-conformance') f("build log");
call update_pod_binding_events();
commit;
\else
select 'skipping as envvar LOAD_K8S_DATA is not set' as "build log";
\endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
\set load_k8s_data null
\getenv load_k8s_data LOAD_K8S_DATA
select :load_k8s_data is not null as proceed;
\gset

\if :proceed
begin;
select * from load_ineligible_endpoints() f("build log");
commit;
\else
select 'skipping as envvar LOAD_K8S_DATA is not set' as "build log";
\endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
\set load_k8s_data null
\getenv load_k8s_data LOAD_K8S_DATA
select :load_k8s_data is not null as proceed;
\gset

\if :proceed
begin;
refresh materialized view conformance.eligible_endpoint_coverage;
select 'conformance.eligible_endpoint_coverage re-materialized' as "build log";
commit;
\else
select 'skipping as envvar LOAD_K8S_DATA is not set' as "build log";
\endif
11 changes: 9 additions & 2 deletions apps/snoopdb/postgres/initdb/505_output_untested_endpoints.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
begin;

\set load_k8s_data null
\getenv load_k8s_data LOAD_K8S_DATA
select :load_k8s_data is not null as proceed;
\gset

\if :proceed
begin;
\t
\a
\o '/tmp/untested-endpoints.txt'
Expand All @@ -24,3 +28,6 @@ select 'untested endpoints for '||release||' written to /tmp/untested-endpoints.
order by release::semver desc
limit 1;
commit;
\else
select 'skipping as envvar LOAD_K8S_DATA is not set' as "build log";
\endif
9 changes: 9 additions & 0 deletions apps/snoopdb/postgres/initdb/506_output_coverage_jsons.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
\set load_k8s_data null
\getenv load_k8s_data LOAD_K8S_DATA
select :load_k8s_data is not null as proceed;
\gset

\if :proceed
begin;
-- move this to its own block if it works
CREATE FUNCTION array_distinct(anyarray) RETURNS anyarray AS $f$
Expand Down Expand Up @@ -68,3 +74,6 @@ $f$ LANGUAGE SQL IMMUTABLE;
\a
\t
commit;
\else
select 'skipping as envvar LOAD_K8S_DATA is not set' as "build log";
\endif

0 comments on commit 6d8162d

Please sign in to comment.