Files
grafana/scripts/drone/pipelines/lint_frontend.star
Tobias Skarhed 134839d701 CI: Add i18n verification step (#69384)
* Add i18n verification step

* Add check for extracted translations

* Run extract

* Add newline for pseudo

* Format JSON output with prettier

* Print file diff

* Actually run make drone

* Only deo git diff on locales

* Update error message

* Verify that step fails on dynamic phrases

* Verify that it passes when fixed

* Verify that dynamic phrase fails, for real this time

* Extract error messages

* Change echo

* Fix string format

* Try double escaping

* Escape for Drone substitution

* Update character escape

* Remove dynamic phrase

* Verify multiple keys

* Remove double keys

* Readd en locale because of reasons

* Undo changes

* Format lint_frontend.star

* Update error message

* Update .drone.yml

* Add quotes for echo

* Verify fail to extract

* Fix diff stat command

* Reset footer changes
2023-06-06 09:29:04 +02:00

58 lines
1.3 KiB
Plaintext

"""
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",
"verify_i18n_step",
"yarn_install_step",
)
load(
"scripts/drone/utils/utils.star",
"pipeline",
)
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"}
init_steps = []
lint_step = lint_frontend_step()
i18n_step = verify_i18n_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_step,
i18n_step,
]
return pipeline(
name = "{}-lint-frontend".format(ver_mode),
edition = "oss",
trigger = trigger,
services = [],
steps = init_steps + test_steps,
environment = environment,
)