RFC: Changes to PHP and Bower builder
Change PHP and Bower package creation behavior to follow the Gemfury
standard of always building a single package from the tip of the
master branch. Customers will still have the option to version packages
explicitly or tag-based, where the package version will be created based
on the SemVer-compatible Git tags.
Since implementing support for PHP and Bower, we and our customers have identified the following deficiencies with the current implementation of the Composer and Bower package builder:
- Lack of control over versions created when pushing a repo into Gemfury. This leads to confusion, and possibly undesired behavior, such as rebuilding existing versions, or versions that have been purposefully deleted.
- Building all tagged versions requires a deep/full clone and multiple build iteration. This is both time and resource consuming, and in many cases it triggers unnecessary or undesired builds.
- No ability to rebuild a specific tagged version if a version has been deleted from your account.
- If no new tags are pushed,
git push --tagsresults in an error.
We believe the current behavior is confusing, error-prone, and inconsistent with how all other packages are built on Gemfury (one-build ⇒ one-package).
To address these problem, we plan to replace the current build-all-tags behavior of the builder with the standard build-HEAD behavior, where we will create a package for the incoming commit of the master branch:
git push --tags fury master
If you would like to build a specific tag, you would have to push that
tag into the master branch. Please note that you may need to append
~0 to the tag name to dereference annotated tags:
git push --tags fury +v1.5.0~0:refs/heads/master
We also plan to add an optional argument to
git:rebuild CLI command
that would enable building specific tags from an existing repo:
fury git:rebuild v1.5.0
Explicit versioning changes
Versioning of PHP and Bower packages will still support two modes: explicit
and tag-based. As before, explicit versioning will be based on the
field in the respective package config files. However, this mode will now
ignore Git tags and build directly from the tip of the pushed master branch.
Subsequent pushes will result in a duplicate-version error until the version
is incremented in the config file. This behavior is consistent will all other
Tag-based versioning changes
Tag-based versioning behavior will remain the same for tagged commits: if an
incoming HEAD commit is tagged with a Semantic Version (with or
v prefix), this version will be built and pushed into your account.
Subsequent pushes of that version will result in duplicate-version errors.
Where as the current builder would ignore or generate an error for an untagged commit pushed to master branch, the new builder will always create a package version. For this, we will implement auto-versioning.
Untagged commits will be auto-versioned as follows based on the closest tagged
upstream commit. If no SemVer tags are found in a commit's history, we assume
initial version of
[Incremented tagged version]-dev.[distance to tag]+g[short-SHA1]
Here's an example of how commits of a master branch may be versioned:
HEAD ├── [Untagged: a3e434b] Version: 1.5.1-dev.3+ga3e434b ├── [Untagged: fce57b5] Version: 1.5.1-dev.2+gfce57b5 ├── [Untagged: 1489d75] Version: 1.5.1-dev.1+g1489d75 ├── [Tagged: v1.5.0] Version: 1.5.0 ├── ... ├── [Untagged: 1489d75] Version: 0.1.0-dev.2+g1489d75 └── [Initial: ff9a20b] Version: 0.1.0-dev.1+gff9a20b
For those following along, this is closely based on the
git describe --tags
algorithm adjusted for SemVer compatibility and rules of precedence.
Tags that are not compatible with SemVer will be ignored. For commits with multiple tags, annotated tags will always be preferred over lightweight tags, and tags with newer dates will always be preferred over tags with older dates.
Migration plan and schedule