[WIP] CI: Removes enterprise specific pipelines and steps (#70815)

* Removes enterprise specific pipelines and steps (#123)

* Comment out enterprise related pipelines and steps

* Suppress unused variable warning

* Removes all edition arguments

* Remove leftover comments

* Remove redundant oss on pipelines and steps names

* Remove leftover unused variable

* Remove leftovers

* Remove pipeline dependencies

* Rename pipelines

* Fix starlark

---------

Co-authored-by: dsotirakis <dimitrios.sotirakis@grafana.com>
(cherry picked from commit 642a81ba75e79138246797302aba5c35575f030d)

# Conflicts:
#	.drone.yml
#	scripts/drone/steps/lib.star

# Conflicts:
#	.drone.yml

* Add editions for static assets

# Conflicts:
#	.drone.yml

# Conflicts:
#	.drone.yml
This commit is contained in:
Dimitris Sotirakis
2023-07-14 14:18:09 +03:00
committed by GitHub
parent 6fe0963340
commit b13939b9af
27 changed files with 178 additions and 3649 deletions

View File

@ -1,45 +0,0 @@
"""
This module contains steps and pipelines publishing to AWS Marketplace.
"""
load(
"scripts/drone/steps/lib.star",
"compile_build_cmd",
)
load("scripts/drone/vault.star", "from_secret")
load(
"scripts/drone/utils/utils.star",
"pipeline",
)
load(
"scripts/drone/utils/images.star",
"images",
)
def publish_aws_marketplace_step():
return {
"name": "publish-aws-marketplace",
"image": images["publish_image"],
"commands": ["./bin/build publish aws --image grafana/grafana-enterprise --repo grafana-labs/grafanaenterprise --product 422b46fb-bea6-4f27-8bcc-832117bd627e"],
"depends_on": ["compile-build-cmd"],
"environment": {
"AWS_REGION": from_secret("aws_region"),
"AWS_ACCESS_KEY_ID": from_secret("aws_access_key_id"),
"AWS_SECRET_ACCESS_KEY": from_secret("aws_secret_access_key"),
},
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
}
def publish_aws_marketplace_pipeline(mode):
trigger = {
"event": ["promote"],
"target": [mode],
}
return [pipeline(
name = "publish-aws-marketplace-{}".format(mode),
trigger = trigger,
steps = [compile_build_cmd(), publish_aws_marketplace_step()],
edition = "",
depends_on = ["publish-docker-enterprise-public"],
environment = {"EDITION": "enterprise2"},
)]

View File

@ -71,7 +71,6 @@ def integration_benchmarks(prefix):
return pipeline(
name = "{}-integration-benchmarks".format(prefix),
edition = "oss",
trigger = {
"event": ["promote"],
"target": ["gobenchmarks"],

View File

@ -49,8 +49,7 @@ def build_e2e(trigger, ver_mode):
Drone pipeline.
"""
edition = "oss"
environment = {"EDITION": edition}
environment = {"EDITION": "oss"}
init_steps = [
identify_runner_step(),
download_grabpl_step(),
@ -73,12 +72,12 @@ def build_e2e(trigger, ver_mode):
build_steps.extend(
[
build_backend_step(edition = edition, ver_mode = ver_mode),
build_frontend_step(edition = edition, ver_mode = ver_mode),
build_frontend_package_step(edition = edition, ver_mode = ver_mode),
build_plugins_step(edition = edition, ver_mode = ver_mode),
package_step(edition = edition, ver_mode = ver_mode),
grafana_server_step(edition = edition),
build_backend_step(ver_mode = ver_mode),
build_frontend_step(ver_mode = ver_mode),
build_frontend_package_step(ver_mode = ver_mode),
build_plugins_step(ver_mode = ver_mode),
package_step(ver_mode = ver_mode),
grafana_server_step(),
e2e_tests_step("dashboards-suite"),
e2e_tests_step("smoke-tests-suite"),
e2e_tests_step("panels-suite"),
@ -101,34 +100,28 @@ def build_e2e(trigger, ver_mode):
store_storybook_step(trigger = trigger_oss, ver_mode = ver_mode),
frontend_metrics_step(trigger = trigger_oss),
build_docker_images_step(
edition = edition,
publish = False,
),
build_docker_images_step(
edition = edition,
publish = False,
ubuntu = True,
),
publish_images_step(
docker_repo = "grafana",
edition = edition,
trigger = trigger_oss,
ver_mode = ver_mode,
),
publish_images_step(
docker_repo = "grafana-oss",
edition = edition,
trigger = trigger_oss,
ver_mode = ver_mode,
),
release_canary_npm_packages_step(trigger = trigger_oss),
upload_packages_step(
edition = edition,
trigger = trigger_oss,
ver_mode = ver_mode,
),
upload_cdn_step(
edition = edition,
trigger = trigger_oss,
ver_mode = ver_mode,
),
@ -141,18 +134,15 @@ def build_e2e(trigger, ver_mode):
archs = [
"amd64",
],
edition = edition,
),
build_docker_images_step(
archs = [
"amd64",
],
edition = edition,
ubuntu = True,
),
publish_images_step(
docker_repo = "grafana",
edition = edition,
trigger = trigger_oss,
ver_mode = ver_mode,
),
@ -165,7 +155,6 @@ def build_e2e(trigger, ver_mode):
return pipeline(
name = "{}-build-e2e{}".format(ver_mode, publish_suffix),
edition = "oss",
environment = environment,
services = [],
steps = init_steps + build_steps,

View File

@ -28,7 +28,6 @@ def publish_ci_windows_test_image_pipeline():
pl = pipeline(
name = "publish-ci-windows-test-image",
trigger = trigger,
edition = "",
platform = "windows",
steps = [
{
@ -79,7 +78,6 @@ def publish_ci_build_container_image_pipeline():
pl = pipeline(
name = "publish-ci-build-container-image",
trigger = trigger,
edition = "",
steps = [
{
"name": "validate-version",

View File

@ -39,7 +39,6 @@ def docs_pipelines(ver_mode, trigger):
return pipeline(
name = "{}-docs".format(ver_mode),
edition = "oss",
trigger = trigger,
services = [],
steps = steps,

View File

@ -1,43 +0,0 @@
"""
This module contains steps and pipelines relating to GitHub.
"""
load(
"scripts/drone/steps/lib.star",
"compile_build_cmd",
"fetch_images_step",
)
load("scripts/drone/vault.star", "from_secret")
load(
"scripts/drone/utils/utils.star",
"pipeline",
)
load(
"scripts/drone/utils/images.star",
"images",
)
def publish_github_step():
return {
"name": "publish-github",
"image": images["publish_image"],
"commands": ["./bin/build publish github --repo $${GH_REGISTRY} --create"],
"depends_on": ["fetch-images-enterprise2"],
"environment": {
"GH_TOKEN": from_secret("github_token"),
"GH_REGISTRY": from_secret("gh_registry"),
},
}
def publish_github_pipeline(mode):
trigger = {
"event": ["promote"],
"target": [mode],
}
return [pipeline(
name = "publish-github-{}".format(mode),
trigger = trigger,
steps = [compile_build_cmd(), fetch_images_step("enterprise2"), publish_github_step()],
edition = "",
environment = {"EDITION": "enterprise2"},
)]

View File

@ -51,11 +51,6 @@ def integration_tests(trigger, prefix, 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(),
@ -75,7 +70,6 @@ def integration_tests(trigger, prefix, ver_mode = "pr"):
return pipeline(
name = "{}-integration-tests".format(prefix),
edition = "oss",
trigger = trigger,
environment = environment,
services = services,

View File

@ -40,7 +40,6 @@ def lint_backend_pipeline(trigger, ver_mode):
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)
@ -54,7 +53,6 @@ def lint_backend_pipeline(trigger, ver_mode):
return pipeline(
name = "{}-lint-backend".format(ver_mode),
edition = "oss",
trigger = trigger,
services = [],
steps = init_steps + test_steps,

View File

@ -34,9 +34,6 @@ def lint_frontend_pipeline(trigger, ver_mode):
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(),
@ -49,7 +46,6 @@ def lint_frontend_pipeline(trigger, ver_mode):
return pipeline(
name = "{}-lint-frontend".format(ver_mode),
edition = "oss",
trigger = trigger,
services = [],
steps = init_steps + test_steps,

View File

@ -15,13 +15,10 @@ load(
"pipeline",
)
def publish_image_steps(edition, docker_repo):
def publish_image_steps(docker_repo):
"""Generates the steps used for publising Docker images using grabpl.
Args:
edition: controls which version of an image is fetched in the case of a release.
It also controls which publishing implementation is used.
If edition == 'oss', it additionally publishes the grafana/grafana-oss repository.
docker_repo: the Docker image name.
It is combined with the 'grafana/' library prefix.
@ -32,15 +29,11 @@ def publish_image_steps(edition, docker_repo):
identify_runner_step(),
download_grabpl_step(),
compile_build_cmd(),
fetch_images_step(edition),
publish_images_step(edition, "release", docker_repo),
fetch_images_step(),
publish_images_step("release", docker_repo),
publish_images_step("release", "grafana-oss"),
]
if edition == "oss":
steps.append(
publish_images_step(edition, "release", "grafana-oss"),
)
return steps
def publish_image_pipelines_public():
@ -56,20 +49,9 @@ def publish_image_pipelines_public():
}
return [
pipeline(
name = "publish-docker-oss-{}".format(mode),
name = "publish-docker-{}".format(mode),
trigger = trigger,
steps = publish_image_steps(edition = "oss", docker_repo = "grafana"),
edition = "",
steps = publish_image_steps(docker_repo = "grafana"),
environment = {"EDITION": "oss"},
),
pipeline(
name = "publish-docker-enterprise-{}".format(mode),
trigger = trigger,
steps = publish_image_steps(
edition = "enterprise",
docker_repo = "grafana-enterprise",
),
edition = "",
environment = {"EDITION": "enterprise"},
),
]

View File

@ -46,7 +46,6 @@ def shellcheck_pipeline():
]
return pipeline(
name = "pr-shellcheck",
edition = "oss",
trigger = trigger,
services = [],
steps = steps,

View File

@ -4,12 +4,9 @@ This module returns the pipeline used for testing backend code.
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",
"test_backend_step",
"verify_gen_cue_step",
@ -19,7 +16,6 @@ load(
load(
"scripts/drone/utils/utils.star",
"pipeline",
"with_deps",
)
def test_backend(trigger, ver_mode):
@ -43,14 +39,9 @@ def test_backend(trigger, ver_mode):
# 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"),
compile_build_cmd(),
verify_step,
verify_jsonnet_step,
wire_install_step(),
@ -58,63 +49,8 @@ def test_backend(trigger, ver_mode):
test_backend_integration_step(),
]
pipeline_name = "{}-test-backend".format(ver_mode)
if ver_mode in ("release-branch", "release"):
pipeline_name = "{}-{}-test-backend".format(ver_mode, "oss")
return pipeline(
name = pipeline_name,
edition = "oss",
trigger = trigger,
steps = steps,
environment = environment,
)
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.
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:
Drone pipeline.
"""
environment = {"EDITION": edition}
steps = (
[
clone_enterprise_step(source),
download_grabpl_step(),
init_enterprise_step(ver_mode),
identify_runner_step(),
compile_build_cmd(edition),
] +
with_deps(
[
verify_gen_cue_step(),
verify_gen_jsonnet_step(),
],
[
"init-enterprise",
],
) +
[
wire_install_step(),
test_backend_step(),
test_backend_integration_step(),
]
)
pipeline_name = "{}-test-backend".format(ver_mode)
if ver_mode in ("release-branch", "release"):
pipeline_name = "{}-{}-test-backend".format(ver_mode, edition)
return pipeline(
name = pipeline_name,
edition = edition,
name = "{}-test-backend".format(ver_mode),
trigger = trigger,
steps = steps,
environment = environment,

View File

@ -5,18 +5,15 @@ This module returns the pipeline used for testing backend code.
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):
@ -35,68 +32,19 @@ def test_frontend(trigger, ver_mode):
identify_runner_step(),
download_grabpl_step(),
yarn_install_step(),
betterer_frontend_step(edition = "oss"),
betterer_frontend_step(),
]
pipeline_name = "{}-test-frontend".format(ver_mode)
test_step = test_frontend_step(edition = "oss")
test_step = test_frontend_step()
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 = "{}-oss-test-frontend".format(ver_mode)
return pipeline(
name = pipeline_name,
edition = "oss",
trigger = trigger,
steps = steps,
environment = environment,
)
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.
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 = (
[
download_grabpl_step(),
clone_enterprise_step(source),
init_enterprise_step(ver_mode),
identify_runner_step(),
] +
with_deps([yarn_install_step()], ["init-enterprise"]) +
[
betterer_frontend_step(edition),
test_frontend_step(edition),
]
)
pipeline_name = "{}-test-frontend".format(ver_mode)
if ver_mode in ("release-branch", "release"):
pipeline_name = "{}-{}-test-frontend".format(ver_mode, edition)
return pipeline(
name = pipeline_name,
edition = edition,
name = "{}-test-frontend".format(ver_mode),
trigger = trigger,
steps = steps,
environment = environment,

View File

@ -36,7 +36,6 @@ def enterprise_downstream_pipeline():
]
return pipeline(
name = "main-trigger-downstream",
edition = "oss",
trigger = trigger,
services = [],
steps = steps,

View File

@ -22,7 +22,6 @@ def verify_drone(trigger, ver_mode):
]
return pipeline(
name = "{}-verify-drone".format(ver_mode),
edition = "oss",
trigger = trigger,
services = [],
steps = steps,

View File

@ -22,7 +22,6 @@ def verify_starlark(trigger, ver_mode):
]
return pipeline(
name = "{}-verify-starlark".format(ver_mode),
edition = "oss",
trigger = trigger,
services = [],
steps = steps,

View File

@ -35,7 +35,6 @@ def whats_new_checker_pipeline(trigger):
]
return pipeline(
name = "release-whatsnew-checker",
edition = "oss",
trigger = trigger,
services = [],
steps = steps,

View File

@ -10,7 +10,6 @@ load(
"scripts/drone/steps/lib.star",
"get_windows_steps",
"windows_clone_step",
"windows_init_enterprise_steps",
"windows_test_backend_step",
"windows_wire_install_step",
)
@ -34,23 +33,19 @@ def windows_test_backend(trigger, edition, ver_mode):
windows_clone_step(),
]
if edition == "enterprise":
steps.extend(windows_init_enterprise_steps(ver_mode))
else:
steps.extend([{
"name": "windows-init",
"image": windows_images["windows_go_image"],
"depends_on": ["clone"],
"commands": [],
}])
steps.extend([{
"name": "windows-init",
"image": windows_images["windows_go_image"],
"depends_on": ["clone"],
"commands": [],
}])
steps.extend([
windows_wire_install_step(edition),
windows_test_backend_step(),
])
pl = pipeline(
name = "{}-{}-test-backend-windows".format(ver_mode, edition),
edition = edition,
name = "{}-test-backend-windows".format(ver_mode),
trigger = trigger,
steps = steps,
depends_on = [],
@ -62,25 +57,23 @@ def windows_test_backend(trigger, edition, ver_mode):
}
return pl
def windows(trigger, edition, ver_mode):
def windows(trigger, ver_mode):
"""Generates the pipeline used for building Grafana on Windows.
Args:
trigger: a Drone trigger for the pipeline.
edition: controls whether enterprise code is included in the pipeline steps.
ver_mode: controls whether a pre-release or actual release pipeline is generated.
Also indirectly controls which version of enterprise code is used.
Returns:
Drone pipeline.
"""
environment = {"EDITION": edition}
environment = {"EDITION": "oss"}
return pipeline(
name = "main-windows",
edition = edition,
trigger = dict(trigger, repo = ["grafana/grafana"]),
steps = get_windows_steps(edition, ver_mode),
steps = get_windows_steps(ver_mode),
depends_on = [
"main-test-frontend",
"main-test-backend",