Skip to content

Commit dff2218

Browse files
committed
PMM-14072 make the build platform-aware
1 parent f52737e commit dff2218

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,9 @@ docker_clean:
5252

5353
.PHONY: upgrade_plugins
5454
upgrade_plugins:
55-
cd misc \
56-
&& ./upgrade-plugins.sh
55+
@echo "Upgrading PMM plugins..."
56+
@echo "To override the platform, set the PLATFORM environment variable."
57+
@echo "Example: PLATFORM=linux/arm64 make upgrade_plugins"
58+
@echo
59+
@cd misc && \
60+
./upgrade-plugins.sh

misc/upgrade-plugins.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
#!/bin/bash -ex
22

3-
declare DIR OWNER
3+
declare PLATFORM=${PLATFORM:-linux/amd64}
4+
declare DIR
45
DIR=$(realpath ../panels)
5-
OWNER=$(id -u):$(id -g)
66

7-
docker pull grafana/grafana
8-
9-
docker buildx build --progress=plain -t local/grafana -f Dockerfile.upgrade .
7+
# Note: the PLATFORM matters because some plugins are built for a specific architecture.
8+
docker buildx build --platform="$PLATFORM" --progress=plain -t local/grafana -f Dockerfile.upgrade .
109

1110
rm -rf "${DIR:?}"/*
1211

1312
docker run \
1413
--rm -t \
1514
--name grafana \
15+
--platform="$PLATFORM" \
1616
-e GF_INSTALL_PLUGINS=grafana-clickhouse-datasource,grafana-polystat-panel,jdbranham-diagram-panel \
1717
-v "${DIR}":/var/lib/grafana/plugins \
1818
local/grafana
1919

20-
sudo chown -R "$OWNER" "$DIR"
21-
2220
echo "Listing upgraded Grafana plugins..."
2321
ls -l "$DIR"
2422

25-
docker rmi local/grafana grafana/grafana
23+
docker rmi local/grafana

0 commit comments

Comments
 (0)