mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CI: Update RGM steps to use the artifacts command (#77470)
* update rgm steps to use artifacts subcmd * format-drone * make drone
This commit is contained in:
@@ -28,8 +28,8 @@ load(
|
||||
)
|
||||
load(
|
||||
"scripts/drone/steps/rgm.star",
|
||||
"rgm_artifacts_step",
|
||||
"rgm_build_docker_step",
|
||||
"rgm_package_step",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/utils/images.star",
|
||||
@@ -70,14 +70,21 @@ def build_e2e(trigger, ver_mode):
|
||||
[
|
||||
build_frontend_package_step(),
|
||||
enterprise_downstream_step(ver_mode = ver_mode),
|
||||
rgm_package_step(distros = "linux/amd64,linux/arm64", file = "packages.txt"),
|
||||
rgm_artifacts_step(artifacts = ["targz:grafana:linux/amd64", "targz:grafana:linux/arm64"], file = "packages.txt"),
|
||||
],
|
||||
)
|
||||
else:
|
||||
build_steps.extend([
|
||||
update_package_json_version(),
|
||||
build_frontend_package_step(depends_on = ["update-package-json-version"]),
|
||||
rgm_package_step(depends_on = ["update-package-json-version"], distros = "linux/amd64,linux/arm64", file = "packages.txt"),
|
||||
rgm_artifacts_step(
|
||||
artifacts = [
|
||||
"targz:grafana:linux/amd64",
|
||||
"targz:grafana:linux/arm64",
|
||||
],
|
||||
depends_on = ["update-package-json-version"],
|
||||
file = "packages.txt",
|
||||
),
|
||||
])
|
||||
|
||||
build_steps.extend(
|
||||
@@ -104,7 +111,6 @@ def build_e2e(trigger, ver_mode):
|
||||
store_storybook_step(trigger = trigger_oss, ver_mode = ver_mode),
|
||||
frontend_metrics_step(trigger = trigger_oss),
|
||||
rgm_build_docker_step(
|
||||
"packages.txt",
|
||||
images["ubuntu"],
|
||||
images["alpine"],
|
||||
tag_format = "{{ .version_base }}-{{ .buildID }}-{{ .arch }}",
|
||||
@@ -135,7 +141,6 @@ def build_e2e(trigger, ver_mode):
|
||||
build_steps.extend(
|
||||
[
|
||||
rgm_build_docker_step(
|
||||
"packages.txt",
|
||||
images["ubuntu"],
|
||||
images["alpine"],
|
||||
tag_format = "{{ .version_base }}-{{ .buildID }}-{{ .arch }}",
|
||||
|
||||
@@ -137,6 +137,8 @@ def rgm_run(name, script):
|
||||
"""
|
||||
env = {
|
||||
"GO_VERSION": golang_version,
|
||||
"ALPINE_BASE": images["alpine"],
|
||||
"UBUNTU_BASE": images["ubuntu"],
|
||||
}
|
||||
rgm_run_step = {
|
||||
"name": name,
|
||||
|
||||
@@ -8,15 +8,25 @@ load(
|
||||
"golang_version",
|
||||
)
|
||||
|
||||
# rgm_package_step will create a tar.gz for use in e2e tests or other PR testing related activities..
|
||||
def rgm_package_step(distros = "linux/amd64,linux/arm64", file = "packages.txt", depends_on = ["yarn-install"]):
|
||||
def artifacts_cmd(artifacts = []):
|
||||
cmd = "/src/grafana-build artifacts "
|
||||
|
||||
for artifact in artifacts:
|
||||
cmd += "-a {} ".format(artifact)
|
||||
|
||||
return cmd
|
||||
|
||||
# rgm_artifacts_step will create artifacts using the '/src/build artifacts' command.
|
||||
def rgm_artifacts_step(name = "rgm-package", artifacts = ["targz:grafana:linux/amd64", "targz:grafana:linux/arm64"], file = "packages.txt", depends_on = ["yarn-install"]):
|
||||
cmd = artifacts_cmd(artifacts = artifacts)
|
||||
|
||||
return {
|
||||
"name": "rgm-package",
|
||||
"name": name,
|
||||
"image": "grafana/grafana-build:main",
|
||||
"pull": "always",
|
||||
"depends_on": depends_on,
|
||||
"commands": [
|
||||
"/src/grafana-build package --distro={} ".format(distros) +
|
||||
cmd +
|
||||
"--go-version={} ".format(golang_version) +
|
||||
"--yarn-cache=$$YARN_CACHE_FOLDER " +
|
||||
"--build-id=$$DRONE_BUILD_NUMBER " +
|
||||
@@ -28,31 +38,27 @@ def rgm_package_step(distros = "linux/amd64,linux/arm64", file = "packages.txt",
|
||||
# rgm_build_backend will create compile the grafana backend for various platforms. It's preferred to use
|
||||
# 'rgm_package_step' if you creating a "usable" artifact. This should really only be used to verify that the code is
|
||||
# compilable.
|
||||
def rgm_build_backend_step(distros = "linux/amd64,linux/arm64"):
|
||||
return {
|
||||
"name": "rgm-package",
|
||||
"image": "grafana/grafana-build:main",
|
||||
"pull": "always",
|
||||
"commands": [
|
||||
"/src/grafana-build build " +
|
||||
"--go-version={} ".format(golang_version) +
|
||||
"--distro={} --grafana-dir=$$PWD".format(distros),
|
||||
],
|
||||
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
|
||||
}
|
||||
def rgm_build_backend_step(artifacts = ["backend:grafana:linux/amd64", "backend:grafana:linux/arm64"]):
|
||||
return rgm_artifacts_step(name = "rgm-build-backend", artifacts = artifacts, depends_on = [])
|
||||
|
||||
def rgm_build_docker_step(packages, ubuntu, alpine, depends_on = ["rgm-package"], file = "docker.txt", tag_format = "{{ .version }}-{{ .arch }}", ubuntu_tag_format = "{{ .version }}-ubuntu-{{ .arch }}"):
|
||||
def rgm_build_docker_step(ubuntu, alpine, depends_on = ["yarn-install"], file = "docker.txt", tag_format = "{{ .version }}-{{ .arch }}", ubuntu_tag_format = "{{ .version }}-ubuntu-{{ .arch }}"):
|
||||
return {
|
||||
"name": "rgm-build-docker",
|
||||
"image": "grafana/grafana-build:main",
|
||||
"pull": "always",
|
||||
"commands": [
|
||||
"docker run --privileged --rm tonistiigi/binfmt --install all",
|
||||
"/src/grafana-build docker " +
|
||||
"$(cat {} | grep tar.gz | grep -v docker | grep -v sha256 | awk '{{print \"--package=\" $0}}') ".format(packages) +
|
||||
"/src/grafana-build artifacts " +
|
||||
"-a docker:grafana:linux/amd64 " +
|
||||
"-a docker:grafana:linux/amd64:ubuntu " +
|
||||
"-a docker:grafana:linux/arm64 " +
|
||||
"-a docker:grafana:linux/arm64:ubuntu " +
|
||||
"--yarn-cache=$$YARN_CACHE_FOLDER " +
|
||||
"--build-id=$$DRONE_BUILD_NUMBER " +
|
||||
"--ubuntu-base={} ".format(ubuntu) +
|
||||
"--alpine-base={} ".format(alpine) +
|
||||
"--tag-format='{}' ".format(tag_format) +
|
||||
"--grafana-dir=$$PWD " +
|
||||
"--ubuntu-tag-format='{}' > {}".format(ubuntu_tag_format, file),
|
||||
"find ./dist -name '*docker*.tar.gz' -type f | xargs -n1 docker load -i",
|
||||
],
|
||||
|
||||
@@ -14,7 +14,7 @@ images = {
|
||||
"node": "node:{}-alpine".format(nodejs_version),
|
||||
"cloudsdk": "google/cloud-sdk:431.0.0",
|
||||
"publish": "grafana/grafana-ci-deploy:1.3.3",
|
||||
"alpine": "alpine:3.18.3",
|
||||
"alpine": "alpine:3.18.4",
|
||||
"ubuntu": "ubuntu:22.04",
|
||||
"curl": "byrnedo/alpine-curl:0.1.8",
|
||||
"plugins_slack": "plugins/slack",
|
||||
|
||||
Reference in New Issue
Block a user