Skip to content

Commit

Permalink
PMM-12899 prevent grafana from using own GOPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Apr 1, 2024
1 parent d57ec55 commit 5c7821f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build/packages/rpm/server/SPECS/grafana.spec
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ sed -i "s/unknown-dev/%{grafana_version}/" pkg/build/git.go
sudo npm install -g grunt-cli

%build
mkdir -p _build/src
export GOPATH="$(pwd)/_build"
# mkdir -p _build/src
# export GOPATH="$(pwd)/_build"

make build-go

Expand Down
15 changes: 9 additions & 6 deletions build/scripts/build-server-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ build() {
local CH_TAG=${rpm_version#*-}
local cache_dir=RELEASE
local volume_mounts="-v ${rpmbuild_dir}/SOURCES:/home/builder/rpm/SOURCES -v ${rpms_dir}:/home/builder/rpm/RPMS"
# local build_deps=("grafana.spec" "percona-dashboards.spec")

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

echo "Start building Server RPMs..."
echo "spec_name: ${spec_name}"
echo "repo_name: ${repo_name}"
echo "rpm_verison: ${rpm_version}"
Expand All @@ -125,7 +125,7 @@ build() {
set -o errexit
set -o xtrace
sudo chown -R builder:builder /home/builder/rpm/RPMS /home/builder/rpm/SOURCES
sudo chown -R builder:builder /home/builder/rpm/RPMS /home/builder/rpm/SOURCES /home/builder/.cache
# Add 'Epoch' to spec file to prevent update of rpms which are built in PR build
if [ ${RPM_EPOCH} = 1 ]; then
Expand All @@ -142,8 +142,10 @@ build() {
sleep 1
done
# Only these two specs have build dependencies
if [[ ${spec_name} =~ ^grafana$|^percona-dashboards$ ]]; then
sudo yum-builddep --randomwait=1 -y SOURCES/${spec_name}.spec
sleep 5s
sudo yum-builddep -y SOURCES/${spec_name}.spec
fi
spectool -C SOURCES -g SOURCES/${spec_name}.spec
Expand All @@ -160,7 +162,7 @@ build() {
# cp ${rpms_dir}/${spec_name}-${rpm_version}/*/*.rpm ${rpms_dir}

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

Expand All @@ -172,9 +174,10 @@ build() {
${rpms_dir}/${spec_name}-${rpm_version} \
s3://pmm-build-cache/${cache_dir}/${rpmbuild_dist}/${spec_name}-${rpm_version} \
|| :

echo "Finished building Server RPMs, spec_name: ${spec_name}.spec, repo_name: ${repo_name}"
}

build "$1" "$2"
echo "build-server-rpm finished, spec_name: $1, repo_name: ${2:-$1}"
build "$@"

# vim: expandtab shiftwidth=4 tabstop=4

0 comments on commit 5c7821f

Please sign in to comment.