Files
grafana/scripts/drone/pipelines/test_frontend.star
Kevin Minehart 2400483d6c CI: Add github app token generation in pipelines that use GITHUB_TOKEN (#96646)
* Add github app token generation in pipelines that use GITHUB_TOKEN

* ci?

* clone gh repo using x-access-token user

* address linting issues

* use mounted volume for exporting token

* remove unused github_token env var swagger gen step

* replace pat on release_pr pipepline

* cleanup GH PAT references

* linting

* Update scripts/drone/steps/lib.star

* make drone

---------

Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
2024-11-21 17:08:02 +02:00

61 lines
1.4 KiB
Plaintext

"""
This module returns the pipeline used for testing backend code.
"""
load(
"scripts/drone/steps/github.star",
"github_app_generate_token_step",
"github_app_pipeline_volumes",
)
load(
"scripts/drone/steps/lib.star",
"betterer_frontend_step",
"enterprise_setup_step",
"identify_runner_step",
"test_frontend_step",
"yarn_install_step",
)
load(
"scripts/drone/utils/utils.star",
"pipeline",
)
def test_frontend(trigger, ver_mode):
"""Generates the pipeline used for testing frontend code.
Args:
trigger: a Drone trigger for the pipeline
ver_mode: indirectly controls which revision of enterprise code to use.
Returns:
Drone pipeline.
"""
environment = {"EDITION": "oss"}
steps = [
identify_runner_step(),
yarn_install_step(),
betterer_frontend_step(),
]
test_step = test_frontend_step()
volumes = []
if ver_mode == "pr":
# In pull requests, attempt to clone grafana enterprise.
steps.append(github_app_generate_token_step())
steps.append(enterprise_setup_step())
volumes += github_app_pipeline_volumes()
steps.append(test_step)
return pipeline(
name = "{}-test-frontend".format(ver_mode),
trigger = trigger,
steps = steps,
environment = environment,
volumes = volumes,
)