Files
grafana/scripts/drone/pipelines/lint_frontend.star
T

55 lines
1.3 KiB
Python
Raw Normal View History

"""
This module returns the pipeline used for linting frontend code.
"""
2022-09-21 22:39:28 +03:00
load(
"scripts/drone/steps/lib.star",
2023-02-01 10:55:49 -06:00
"enterprise_setup_step",
"identify_runner_step",
"lint_frontend_step",
"yarn_install_step",
2022-09-21 22:39:28 +03:00
)
load(
"scripts/drone/utils/utils.star",
"pipeline",
2022-09-21 22:39:28 +03:00
)
def lint_frontend_pipeline(trigger, ver_mode):
"""Generates the pipelines used linting frontend code.
Args:
trigger: controls which events can trigger the pipeline execution.
ver_mode: used in the naming of the pipeline.
Returns:
Drone pipeline.
"""
environment = {"EDITION": "oss"}
2022-12-07 02:13:57 -05:00
2023-02-01 10:55:49 -06:00
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 += [
2022-09-21 22:39:28 +03:00
identify_runner_step(),
2022-12-07 02:13:57 -05:00
yarn_install_step(),
2022-09-21 22:39:28 +03:00
]
test_steps = [
2023-02-01 10:55:49 -06:00
lint_step,
2022-09-21 22:39:28 +03:00
]
2022-12-07 02:13:57 -05:00
2022-09-21 22:39:28 +03:00
return pipeline(
name = "{}-lint-frontend".format(ver_mode),
edition = "oss",
trigger = trigger,
services = [],
steps = init_steps + test_steps,
environment = environment,
2022-09-21 22:39:28 +03:00
)