Skip to content

PSMDB-2150 Partially clean up psmdb-builder.sh#1993

Open
ktrushin wants to merge 7 commits into
v8.0from
psmdb-2150-80-psmdb-builder-cleanup
Open

PSMDB-2150 Partially clean up psmdb-builder.sh#1993
ktrushin wants to merge 7 commits into
v8.0from
psmdb-2150-80-psmdb-builder-cleanup

Conversation

@ktrushin

@ktrushin ktrushin commented Jul 2, 2026

Copy link
Copy Markdown

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors and partially cleans up percona-packaging/scripts/psmdb_builder.sh to make failures consistent (via a shared abort helper), improve environment setup (path_affix / set_gopath), and simplify source/tool fetching and packaging steps.

Changes:

  • Introduces abort, path_affix, and set_gopath helpers and replaces multiple ad-hoc exit 1 paths with consistent error handling.
  • Switches repository and mongo-tools fetches to shallow git clone with explicit branches/tags and submodule recursion.
  • Reworks source artifact retrieval into clearer helpers (get_source_tarball, get_deb_sources, get_source_rpm_package) and adds a Bazel pre-run to avoid .bazelrc.bazelisk dirty-tree issues during source package builds.
Comments suppressed due to low confidence (1)

percona-packaging/scripts/psmdb_builder.sh:577

  • In build_rpm, $WORKDIR and $SRC_RPM are used unquoted. If the build directory or filename ever contains whitespace or glob characters, cd/cp can fail or behave unexpectedly. Quoting these variables makes the script more robust.
    SRC_RPM="$(get_source_rpm_package)"
    cd $WORKDIR
    rm -fr rpmbuild
    mkdir -vp rpmbuild/{SOURCES,SPECS,BUILD,SRPMS,RPMS}
    cp $SRC_RPM rpmbuild/SRPMS/

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread percona-packaging/scripts/psmdb_builder.sh Outdated
ktrushin added 6 commits July 2, 2026 16:03
The root privileges are only required for installing dependencies.
All other operations, including generating source and binary
packages, can be done by a regular user. However, the script,
while conducting those operations, assumed it was run by `root`.
The patch:
- prevents adding duplicates to `PATH`;
- adds the Bazel installation directory to `PATH` only once rather
  than in multiple times;
- removes the `GOBINPATH` variable that is not recognized by Go;
- exports `GOROOT` only once rather multiple times;
- adds `$GOROOT/bin` to `PATH` only once rather then in mulitiple
  times;
- synchronizes setting `GOPATH` with adding `$GOPATH/bin` to `PATH`.
Reasons to remove:
- it is not used in Jenkins pipelines anymore;
- its functionality is covered by the _mandatory_ options
  `--psm_ver` and `--mongo_tools_tag` anyway;
- the option was used in particular to use mongo tools tag equal
  to the PSMDB version but the `mongo_tools` repository doesn't
  have tags of such a form anymore; so that `--jenkins_mode` would
  not work anyway.
Avoid cloning the full Git history because we don't use it anyway.

Notes:
- the `MONGO_TOOLS_TAG` variable is safe to use as the value of
  `--branch` option because `--mongo_tools_tag` is a  mandatory
  script option
- the `BRANCH` variable is safe to use as the value of
 `--branch` option because it has the default value "master"
@ktrushin ktrushin force-pushed the psmdb-2150-80-psmdb-builder-cleanup branch from 64ab15c to ec1ef51 Compare July 2, 2026 12:04
@ktrushin ktrushin requested a review from vorsel July 2, 2026 12:12
@ktrushin

ktrushin commented Jul 2, 2026

Copy link
Copy Markdown
Author

Note. It can be easier to review the PR one commit at a time rather than the entire change at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants