2023-09-12 10:19:06 -05:00
|
|
|
"""
|
|
|
|
Individual steps that use 'grafana-build' to replace existing individual steps.
|
|
|
|
These aren't used in releases.
|
|
|
|
"""
|
|
|
|
|
2023-09-12 16:44:33 -05:00
|
|
|
load(
|
|
|
|
"scripts/drone/variables.star",
|
|
|
|
"golang_version",
|
|
|
|
)
|
|
|
|
|
2023-09-12 10:19:06 -05:00
|
|
|
# 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"):
|
|
|
|
return {
|
|
|
|
"name": "rgm-package",
|
|
|
|
"image": "grafana/grafana-build:main",
|
2023-09-12 12:59:02 -05:00
|
|
|
"pull": "always",
|
2023-09-12 10:19:06 -05:00
|
|
|
"depends_on": ["yarn-install"],
|
|
|
|
"commands": [
|
|
|
|
"/src/grafana-build package --distro={} ".format(distros) +
|
2023-09-12 16:44:33 -05:00
|
|
|
"--go-version={} ".format(golang_version) +
|
2023-09-12 10:19:06 -05:00
|
|
|
"--yarn-cache=$$YARN_CACHE_FOLDER " +
|
|
|
|
"--build-id=$$DRONE_BUILD_NUMBER " +
|
|
|
|
"--grafana-dir=$$PWD > {}".format(file),
|
|
|
|
],
|
|
|
|
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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",
|
2023-09-12 12:59:02 -05:00
|
|
|
"pull": "always",
|
2023-09-12 10:19:06 -05:00
|
|
|
"commands": [
|
2023-09-12 16:44:33 -05:00
|
|
|
"/src/grafana-build build " +
|
|
|
|
"--go-version={} ".format(golang_version) +
|
|
|
|
"--distro={} --grafana-dir=$$PWD".format(distros),
|
2023-09-12 10:19:06 -05:00
|
|
|
],
|
|
|
|
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
|
|
|
|
}
|
|
|
|
|
|
|
|
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 }}"):
|
|
|
|
return {
|
|
|
|
"name": "rgm-build-docker",
|
|
|
|
"image": "grafana/grafana-build:main",
|
2023-09-12 12:59:02 -05:00
|
|
|
"pull": "always",
|
2023-09-12 10:19:06 -05:00
|
|
|
"commands": [
|
2023-09-12 12:59:02 -05:00
|
|
|
"docker run --privileged --rm tonistiigi/binfmt --install all",
|
2023-09-12 10:19:06 -05:00
|
|
|
"/src/grafana-build docker " +
|
2023-09-12 14:02:32 -05:00
|
|
|
"$(cat {} | grep tar.gz | grep -v docker | grep -v sha256 | awk '{{print \"--package=\" $0}}') ".format(packages) +
|
2023-09-12 10:19:06 -05:00
|
|
|
"--ubuntu-base={} ".format(ubuntu) +
|
|
|
|
"--alpine-base={} ".format(alpine) +
|
|
|
|
"--tag-format='{}' ".format(tag_format) +
|
|
|
|
"--ubuntu-tag-format='{}' > {}".format(ubuntu_tag_format, file),
|
|
|
|
"find ./dist -name '*docker*.tar.gz' -type f | xargs -n1 docker load -i",
|
|
|
|
],
|
|
|
|
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
|
|
|
|
"depends_on": depends_on,
|
|
|
|
}
|