CI: Replace enterprise check (#62359)

* Add steps in the pipeline for cloning enterprise when running PR tests.
* Removed enterprise-check from the github action workflows, and removed it from the codeowners file.
This commit is contained in:
Kevin Minehart
2023-02-01 16:55:49 +00:00
committed by GitHub
parent 9d07b77532
commit 3cbaa58b1b
12 changed files with 294 additions and 87 deletions
+2 -1
View File
@@ -39,7 +39,7 @@ load(
# @unused
def build_e2e(trigger, ver_mode):
"""Perform e2e building, testing, and publishing."
"""Perform e2e building, testing, and publishing.
Args:
trigger: controls which events can trigger the pipeline execution.
@@ -48,6 +48,7 @@ def build_e2e(trigger, ver_mode):
Returns:
Drone pipeline.
"""
edition = "oss"
environment = {"EDITION": edition}
init_steps = [
+20 -4
View File
@@ -6,6 +6,7 @@ load(
"scripts/drone/steps/lib.star",
"compile_build_cmd",
"download_grabpl_step",
"enterprise_setup_step",
"identify_runner_step",
"mysql_integration_tests_step",
"postgres_integration_tests_step",
@@ -23,12 +24,13 @@ load(
"pipeline",
)
def integration_tests(trigger, prefix):
def integration_tests(trigger, prefix, ver_mode = "pr"):
"""Generate a pipeline for integration tests.
Args:
trigger: controls which events can trigger the pipeline execution.
prefix: used in the naming of the pipeline.
ver_mode: defines the event / origin of this build. In this function, if it is set to pr, then it will attempt to clone grafana-enterprise. Otherwise it has no effect.
Returns:
Drone pipeline.
@@ -38,12 +40,26 @@ def integration_tests(trigger, prefix):
services = integration_test_services(edition = "oss")
volumes = integration_test_services_volumes()
init_steps = [
init_steps = []
verify_step = verify_gen_cue_step()
verify_jsonnet_step = verify_gen_jsonnet_step()
if ver_mode == "pr":
# In pull requests, attempt to clone grafana enterprise.
init_steps.append(enterprise_setup_step())
# Ensure that verif_gen_cue happens after we clone enterprise
# At the time of writing this, very_gen_cue is depended on by the wire step which is what everything else depends on.
verify_step["depends_on"].append("clone-enterprise")
verify_jsonnet_step["depends_on"].append("clone-enterprise")
init_steps += [
download_grabpl_step(),
compile_build_cmd(),
identify_runner_step(),
verify_gen_cue_step(),
verify_gen_jsonnet_step(),
verify_step,
verify_jsonnet_step,
wire_install_step(),
]
+8 -1
View File
@@ -5,6 +5,7 @@ This module returns the pipeline used for linting backend code.
load(
"scripts/drone/steps/lib.star",
"compile_build_cmd",
"enterprise_setup_step",
"identify_runner_step",
"lint_backend_step",
"lint_drone_step",
@@ -33,9 +34,15 @@ def lint_backend_pipeline(trigger, ver_mode):
init_steps = [
identify_runner_step(),
compile_build_cmd(),
wire_step,
]
if ver_mode == "pr":
# In pull requests, attempt to clone grafana enterprise.
init_steps.append(enterprise_setup_step())
wire_step["depends_on"].append("clone-enterprise")
init_steps.append(wire_step)
test_steps = [
lint_backend_step(),
]
+13 -3
View File
@@ -4,6 +4,7 @@ This module returns the pipeline used for linting frontend code.
load(
"scripts/drone/steps/lib.star",
"enterprise_setup_step",
"identify_runner_step",
"lint_frontend_step",
"yarn_install_step",
@@ -25,13 +26,22 @@ def lint_frontend_pipeline(trigger, ver_mode):
"""
environment = {"EDITION": "oss"}
init_steps = [
init_steps = []
lint_step = lint_frontend_step()
if ver_mode == "pr":
# In pull requests, attempt to clone grafana enterprise.
init_steps = [enterprise_setup_step()]
# Ensure the lint step happens after the clone-enterprise step
lint_step["depends_on"].append("clone-enterprise")
init_steps += [
identify_runner_step(),
yarn_install_step(),
]
test_steps = [
lint_frontend_step(),
lint_step,
]
return pipeline(
+26 -11
View File
@@ -2,16 +2,12 @@
This module returns the pipeline used for testing backend code.
"""
load(
"scripts/drone/utils/utils.star",
"pipeline",
"with_deps",
)
load(
"scripts/drone/steps/lib.star",
"clone_enterprise_step",
"compile_build_cmd",
"download_grabpl_step",
"enterprise_setup_step",
"identify_runner_step",
"init_enterprise_step",
"test_backend_integration_step",
@@ -20,6 +16,11 @@ load(
"verify_gen_jsonnet_step",
"wire_install_step",
)
load(
"scripts/drone/utils/utils.star",
"pipeline",
"with_deps",
)
def test_backend(trigger, ver_mode):
"""Generates the pipeline used for testing OSS backend code.
@@ -33,11 +34,25 @@ def test_backend(trigger, ver_mode):
"""
environment = {"EDITION": "oss"}
steps = [
steps = []
verify_step = verify_gen_cue_step()
verify_jsonnet_step = verify_gen_jsonnet_step()
if ver_mode == "pr":
# In pull requests, attempt to clone grafana enterprise.
steps.append(enterprise_setup_step())
# Ensure that verif_gen_cue happens after we clone enterprise
# At the time of writing this, very_gen_cue is depended on by the wire step which is what everything else depends on.
verify_step["depends_on"].append("clone-enterprise")
verify_jsonnet_step["depends_on"].append("clone-enterprise")
steps += [
identify_runner_step(),
compile_build_cmd(edition = "oss"),
verify_gen_cue_step(),
verify_gen_jsonnet_step(),
verify_step,
verify_jsonnet_step,
wire_install_step(),
test_backend_step(),
test_backend_integration_step(),
@@ -55,13 +70,13 @@ def test_backend(trigger, ver_mode):
environment = environment,
)
def test_backend_enterprise(trigger, ver_mode, committish, edition = "enterprise"):
def test_backend_enterprise(trigger, ver_mode, source, edition = "enterprise"):
"""Generates the pipeline used for testing backend enterprise code.
Args:
trigger: a Drone trigger for the pipeline.
ver_mode: affects the pipeline name.
committish: controls what revision of enterprise code to test with.
source: controls what revision of enterprise code to test with. The source of the PR, usually.
edition: affects the clone step in the pipeline and also affects the pipeline name.
Returns:
@@ -71,7 +86,7 @@ def test_backend_enterprise(trigger, ver_mode, committish, edition = "enterprise
steps = (
[
clone_enterprise_step(committish),
clone_enterprise_step(source),
download_grabpl_step(),
init_enterprise_step(ver_mode),
identify_runner_step(),
+23 -11
View File
@@ -2,21 +2,22 @@
This module returns the pipeline used for testing backend code.
"""
load(
"scripts/drone/utils/utils.star",
"pipeline",
"with_deps",
)
load(
"scripts/drone/steps/lib.star",
"betterer_frontend_step",
"clone_enterprise_step",
"download_grabpl_step",
"enterprise_setup_step",
"identify_runner_step",
"init_enterprise_step",
"test_frontend_step",
"yarn_install_step",
)
load(
"scripts/drone/utils/utils.star",
"pipeline",
"with_deps",
)
def test_frontend(trigger, ver_mode):
"""Generates the pipeline used for testing frontend code.
@@ -35,12 +36,24 @@ def test_frontend(trigger, ver_mode):
download_grabpl_step(),
yarn_install_step(),
betterer_frontend_step(edition = "oss"),
test_frontend_step(edition = "oss"),
]
pipeline_name = "{}-test-frontend".format(ver_mode)
test_step = test_frontend_step(edition = "oss")
if ver_mode == "pr":
# In pull requests, attempt to clone grafana enterprise.
steps.append(enterprise_setup_step())
# Also, make the test step depend on 'clone-enterprise
test_step["depends_on"].append("clone-enterprise")
steps.append(test_step)
pipeline_name = "{}-test-frontend".format(ver_mode)
if ver_mode in ("release-branch", "release"):
pipeline_name = "{}-{}-test-frontend".format(ver_mode, "oss")
pipeline_name = "{}-oss-test-frontend".format(ver_mode)
return pipeline(
name = pipeline_name,
@@ -50,23 +63,22 @@ def test_frontend(trigger, ver_mode):
environment = environment,
)
def test_frontend_enterprise(trigger, ver_mode, committish, edition = "enterprise"):
def test_frontend_enterprise(trigger, ver_mode, source, edition = "enterprise"):
"""Generates the pipeline used for testing frontend enterprise code.
Args:
trigger: a Drone trigger for the pipeline.
ver_mode: affects the pipeline name.
committish: controls what revision of enterprise code to test with.
source: controls what revision of Grafana code to test with.
edition: affects the clone step in the pipeline and also affects the pipeline name.
Returns:
Drone pipeline.
"""
environment = {"EDITION": edition}
steps = (
[
clone_enterprise_step(committish),
clone_enterprise_step(source),
init_enterprise_step(ver_mode),
identify_runner_step(),
download_grabpl_step(),