SimpleDataLabsInc / prophecy-build-tool

Prophecy-built-tool (PBT) allows you to quickly build projects generated by Prophecy (your standard Spark Scala and PySpark pipelines) to integrate them with your own CI / CD (e.g. Github Actions), build system (e.g. Jenkins), and orchestration (e.g. Databricks Workflows).
https://pypi.org/project/prophecy-build-tool
Apache License 2.0
28 stars 3 forks source link

Rj/versioning check helpers #127

Closed neontty closed 1 month ago

neontty commented 1 month ago

adds helpers to the versioning subcommand:

--check-sync: checks to see if versions are synchronized. return 0 success or 1 fail. --make-unique: adds prerelease candidate and build metadata to differentiate version for working on feature branches (if users need to deploy artifacts simultaneously in dev environment) --compare: compare current version to version in another target branch. return 0 success or 1 fail. If combined with the --bump option then it will use that strategy to bump the current version past the target.

also renames --set-prerelease to --set-suffix as the suffix can also hold build data. AFAIK this flag is brand new and not documented yet, so it's unlikely anyone has adopted it for so long it can't be updated.

neontty commented 1 month ago

versioning --help output for easier review:

Prophecy-build-tool v1.2.42

Usage: pbt versioning [OPTIONS]

Options:
  --path <PATH>                   Path to the directory containing the
                                  pbt_project.yml file  [required]
  --repo-path <PATH>              Path to the repository root. If left blank
                                  it will use '--path'
  --bump [major|minor|patch|build|prerelease]
                                  bumps one of the semantic version numbers
                                  for the project and all pipelines based on
                                  the current value. Only works if existing
                                  versions follow semantic versioning
                                  https://semver.org/
  --set TEXT                      Explicitly set the exact version
  --force, --spike                bypass errors if the version set is lower
                                  than the base branch
  --sync                          Ensure all files are set to the same version
                                  that is defined in pbt_project.yml. (implies
                                  --force)
  --set-suffix TEXT               Set a suffix string. example '-SNAPSHOT' or
                                  '-rc.4' . If this is not a valid semVer
                                  string an error will be thrown.
  --check-sync                    check to see if versions are synced. exit
                                  code 0 success, 1 failure.
  --compare-to-target, --compare <TARGET_BRANCH>
                                  Checks to see if current branch has a
                                  greater version number than the
                                  <TARGET_BRANCH> branch name provided.
                                  Returns 0 true, or 1 false. (Also performs
                                  --sync check). NOTE: if you provide '--bump'
                                  with this option then it will compare the
                                  current version with the version in the
                                  target branch and use the bump strategy IF
                                  the current version is lower than the
                                  target.
  --make-unique                   Helper function that makes a version unique
                                  for feature branches. Adds build-metadata
                                  suffix to differentiate this feature branch
                                  from other dev branches (hash based on
                                  branch name). Adds Prerelease candidate to
                                  deprioritize this version from being chosen
                                  over other versions (recommended so that it
                                  does not  accidentally get chosen over a
                                  real release.   format: MAJOR.MINOR.PATCH-
                                  PRERELEASE+BUILDMETADATA  python example:
                                  3.3.0 -> 3.3.0-dev+sha.j0239ruf0ew  scala
                                  example: 3.3.0 ->
                                  3.3.0-SNAPSHOT+sha.j0239ruf0ew
  --help                          Show this message and exit.
neontty commented 1 month ago

fyi: all changes after Rajat's approval were just to get the tests to run correctly on a GHA runner.