2023-05-08 08:22:34 -05:00
|
|
|
"""
|
|
|
|
This module contains steps and pipelines relating to creating CI Docker images.
|
|
|
|
"""
|
|
|
|
|
|
|
|
load(
|
2023-09-12 10:19:06 -05:00
|
|
|
"scripts/drone/utils/utils.star",
|
|
|
|
"pipeline",
|
2023-05-08 08:22:34 -05:00
|
|
|
)
|
2023-06-12 08:41:18 -05:00
|
|
|
load(
|
2023-06-13 02:38:18 -05:00
|
|
|
"scripts/drone/utils/windows_images.star",
|
|
|
|
"windows_images",
|
2023-06-12 08:41:18 -05:00
|
|
|
)
|
2023-07-11 06:08:05 -05:00
|
|
|
load(
|
2023-09-12 10:19:06 -05:00
|
|
|
"scripts/drone/vault.star",
|
|
|
|
"from_secret",
|
2023-07-11 06:08:05 -05:00
|
|
|
)
|
2023-05-08 08:22:34 -05:00
|
|
|
|
|
|
|
def publish_ci_windows_test_image_pipeline():
|
|
|
|
trigger = {
|
|
|
|
"event": ["promote"],
|
|
|
|
"target": ["ci-windows-test-image"],
|
|
|
|
}
|
|
|
|
pl = pipeline(
|
|
|
|
name = "publish-ci-windows-test-image",
|
|
|
|
trigger = trigger,
|
|
|
|
platform = "windows",
|
|
|
|
steps = [
|
|
|
|
{
|
|
|
|
"name": "clone",
|
2023-09-12 10:19:06 -05:00
|
|
|
"image": windows_images["wix"],
|
2023-05-08 08:22:34 -05:00
|
|
|
"environment": {
|
|
|
|
"GITHUB_TOKEN": from_secret("github_token"),
|
|
|
|
},
|
|
|
|
"commands": [
|
|
|
|
'git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-ci-sandbox.git" .',
|
|
|
|
"git checkout -f $$env:DRONE_COMMIT",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "build-and-publish",
|
2023-09-12 10:19:06 -05:00
|
|
|
"image": windows_images["windows_server_core"],
|
2023-05-08 08:22:34 -05:00
|
|
|
"environment": {
|
|
|
|
"DOCKER_USERNAME": from_secret("docker_username"),
|
|
|
|
"DOCKER_PASSWORD": from_secret("docker_password"),
|
|
|
|
},
|
|
|
|
"commands": [
|
|
|
|
"cd scripts\\build\\ci-windows-test",
|
|
|
|
"docker login -u $$env:DOCKER_USERNAME -p $$env:DOCKER_PASSWORD",
|
|
|
|
"docker build -t grafana/grafana-ci-windows-test:$$env:TAG .",
|
|
|
|
"docker push grafana/grafana-ci-windows-test:$$env:TAG",
|
|
|
|
],
|
|
|
|
"volumes": [
|
|
|
|
{
|
|
|
|
"name": "docker",
|
|
|
|
"path": "//./pipe/docker_engine/",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
pl["clone"] = {
|
|
|
|
"disable": True,
|
|
|
|
}
|
|
|
|
|
|
|
|
return [pl]
|