Do not commit release artefacts by default#1183
Merged
Conversation
The `prepare_initial_release` rule does exactly the same thing as the `prepare_release` rule, except that it also adds the release assets to Git's staging area (so that they will be tracked by Git and later committed). Instead of duplicating the code of the `prepare_release` rule, we simply make `prepare_initial_release` rule dependendent on `prepare_release`, so that the only thing the rule specifically does is adding the release assets to the staging area.
Add a project-level option `commit_release_artefacts` (disabled by default). When enabled, it makes the seeding process automatically commit the release artefacts to the repository. As part of this change, the git step of the seeding process is simplified: * the name of the main branch is set at `git init` time, rather than a posteriori (relatedly, we no longer show the instruction for renaming the branch, since the branch does not need to be renamed); * we create an initial commit containing only the instantiated template files; * we invoke a single build target (prepare_release or prepare_initial_release, depending on whether release artefacts should be committed or not); * we commit the resulting modified files to create the 'initial release'.
If release artefacts are not to be committed (as is the case by default), then we instruct Git to ignore them so that they are not later inadvertently committed.
When we are not committing the release artefacts, it could happen that `make prepare_release` does not modify any of the tracked files (e.g. if there are no import modules that would normally be refreshed as part of the release preparation), and in that case we should not attempt to create a commit (otherwise Git would error out, complaining that there is nothing to commit).
matentzn
reviewed
Feb 20, 2025
Contributor
matentzn
left a comment
There was a problem hiding this comment.
Some initial thoughts on this. In a nutshell:
- obliterate
prepare_initial_releaseentirely - make
commit_release_artefactsa parameter to odk.py rather than a config option
See comments for details
Unconditionally ignore the top-level release artefacts, so that they can never be committed inadvertently. If the user chooses to commit release artefacts at commit time (using the to-be-introduced `--commit-artefacts` option for the `seed` command), we will forcefully add the artefacts so that Git will start tracking them anyway.
Remove the `prepare_initial_release` target from the Makefile. Instead, add a helper `show_release_assets` target that simply prints the list of release assets; that target is used by the seeding command to know which files should be forcefully added to the repository if the user chooses to commit the release artefacts. Replace the `commit_release_artefacts` project-level option by a `--commit-artefacts` command-line option at the level of the `seed` command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the seeding process so that, by default, release artefacts are not committed to the repository.
It adds a project-level option named
commit_release_artefactsthat can be set toTrueto restore the previous behaviour of committing the artefacts.closes #1144