Skip to content

Commit 757e825

Browse files
committed
PMM-12899 prevent grafana from using own GOPATH
1 parent 3d01c22 commit 757e825

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

build/packages/rpm/server/SPECS/grafana.spec

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ sed -i "s/unknown-dev/%{grafana_version}/" pkg/build/git.go
3434
sudo npm install -g grunt-cli
3535

3636
%build
37-
mkdir -p _build/src
38-
export GOPATH="$(pwd)/_build"
37+
# mkdir -p _build/src
38+
# export GOPATH="$(pwd)/_build"
3939

4040
make build-go
4141

build/scripts/build-server-rpm

+9-6
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ build() {
104104
local CH_TAG=${rpm_version#*-}
105105
local cache_dir=RELEASE
106106
local volume_mounts="-v ${rpmbuild_dir}/SOURCES:/home/builder/rpm/SOURCES -v ${rpms_dir}:/home/builder/rpm/RPMS"
107-
# local build_deps=("grafana.spec" "percona-dashboards.spec")
108107

109108
if ! is_build_needed "${spec_name}" "${rpm_version}"; then
110109
return
@@ -117,6 +116,7 @@ build() {
117116
volume_mounts+=" -v ${root_dir}/go-path:/home/builder/go/pkg/mod"
118117
fi
119118

119+
echo "Start building Server RPMs..."
120120
echo "spec_name: ${spec_name}"
121121
echo "repo_name: ${repo_name}"
122122
echo "rpm_verison: ${rpm_version}"
@@ -125,7 +125,7 @@ build() {
125125
set -o errexit
126126
set -o xtrace
127127
128-
sudo chown -R builder:builder /home/builder/rpm/RPMS /home/builder/rpm/SOURCES
128+
sudo chown -R builder:builder /home/builder/rpm/RPMS /home/builder/rpm/SOURCES /home/builder/.cache
129129
130130
# Add 'Epoch' to spec file to prevent update of rpms which are built in PR build
131131
if [ ${RPM_EPOCH} = 1 ]; then
@@ -142,8 +142,10 @@ build() {
142142
sleep 1
143143
done
144144
145+
# Only these two specs have build dependencies
145146
if [[ ${spec_name} =~ ^grafana$|^percona-dashboards$ ]]; then
146-
sudo yum-builddep --randomwait=1 -y SOURCES/${spec_name}.spec
147+
sleep 5s
148+
sudo yum-builddep -y SOURCES/${spec_name}.spec
147149
fi
148150
149151
spectool -C SOURCES -g SOURCES/${spec_name}.spec
@@ -160,7 +162,7 @@ build() {
160162
# cp ${rpms_dir}/${spec_name}-${rpm_version}/*/*.rpm ${rpms_dir}
161163

162164
if ! command -v aws &> /dev/null; then
163-
echo "AWS CLI is not installed. Skipping upload to S3."
165+
echo "AWS CLI is not installed. Upload to S3 will be skipped."
164166
return
165167
fi
166168

@@ -172,9 +174,10 @@ build() {
172174
${rpms_dir}/${spec_name}-${rpm_version} \
173175
s3://pmm-build-cache/${cache_dir}/${rpmbuild_dist}/${spec_name}-${rpm_version} \
174176
|| :
177+
178+
echo "Finished building Server RPMs, spec_name: ${spec_name}.spec, repo_name: ${repo_name}"
175179
}
176180

177-
build "$1" "$2"
178-
echo "build-server-rpm finished, spec_name: $1, repo_name: ${2:-$1}"
181+
build "$@"
179182

180183
# vim: expandtab shiftwidth=4 tabstop=4

0 commit comments

Comments
 (0)