Skip to content

Feature request: Support git push options #973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mmomper opened this issue Jul 5, 2024 · 10 comments
Open

Feature request: Support git push options #973

mmomper opened this issue Jul 5, 2024 · 10 comments
Labels
confirmed Prevent from becoming stale feature A new feature or a feature request

Comments

@mmomper
Copy link

mmomper commented Jul 5, 2024

Description

It would be nice to support git push options (added in Git 2.10.2). Preferable separated for the commit push and the tag push.

Use cases

We are using GitLab CI/CD and want to use this tool for version management but don't want a pipeline run for the version bump commit. This could be archived by using the push option ci.skip for the new commit.

Adding [skip ci] to every commit has also impact on everything else referencing this commit (for example the tag).

Possible implementation

I tested that it works by simply modifying the commit push line from repo.git.push(remote_url, branch) to repo.git.push(remote_url, branch, "-o", "ci.skip") and it works.

I did not create a PR because I'm unsure which is the best option for adding this as a cli/config parameter.

@mmomper mmomper added the feature A new feature or a feature request label Jul 5, 2024
@codejedi365
Copy link
Contributor

Hi @mmomper,

Thank you for submitting this feature request. I've been dwelling on what is the best course of action here. I can understand the need for PSR providing some level of triggering support for skip ci flags.

My hesitation with your recommended implementation is that we support more than one hosted version control system (HVCS) and my cursory look is that GitHub does not support push options but GitLab does. I have not looked into Gitea or BitBucket's compatibility yet but that could be different as well. This leads me to consider a configuration option that basically defines which type of skip ci do you want to apply (push options or a commit message label). I personally don't quite want to get into the game of just inserting arbitrary user command switches for every internal command we provide as it seems quite messy as we have a few of those already. It stands to question what is the benefit of the package in the first place, but I digress. This is one motivation to instead consider the action we apply and handle that use. I think skip CI is something PSR needs to be cognizant of as we are generally triggering secondary CI workflows and running from within a CI environment, generally.

Prior to reading up on push options, my recommendation would have been to use the commit_message configuration option to customize the commit message to include a [skip ci] entry which has wider support including GitLab. However, based on your comment below, you seem to have some hesitation here?

Adding [skip ci] to every commit has also impact on everything else referencing this commit (for example the tag).

Can you expand upon the problem with this?

When I work with GitLab CI, generally if I'm using a semantic-release tool in a job, then I use the workflow:rules directive to turn off CI pipelines on any tags via the $CI_COMMIT_TAG variable. This is how I would handle the tag environment so would a push-option on the git push tag be necessary? The commit would need the [skip ci] tag in the commit message if I am writing back to the repository to prevent a subsequent workflow.

@mmomper
Copy link
Author

mmomper commented Jul 8, 2024

Hi @codejedi365 ,

Thanks for the reply and thoughts about it. First of all, my issue with the [skip ci] in the message is the following:

When the new commit is created and pushed, the CI gets skipped, as intended. But when the Tag is created and pushed, the CI for the Tag is also skipped, which may be unintended. I read somewhere that, if this commit is the lates of an MR, the CI for the merge would also be skipped (not my use case but I think it is something to not forget about).

In my use case, I thought about triggering a CI run on Tags in which the package gets pushed to the JFrog we are using.

I would agree, creating a switch/config option for every push option is not a good practice since the supported options are not specified by Git but by the HVCS implementation. I thought about a generic flag/config like commit-push-option/tag-push-option, which then gets passed to the call. In this way, the user could add the options he wants for his HVCS and there is no need to implement all of them explicitly.

Of course this could be archived with not including [skip ci] and using rules to not trigger the back push, but this is something you always have to not forget and maybe include in a job template. In my opinion, the push option would be a cleaner solution for that.

Copy link

github-actions bot commented Nov 2, 2024

It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

@github-actions github-actions bot added the needs-update Needs status update from maintainers label Nov 2, 2024
@codejedi365
Copy link
Contributor

Still in the backlog, haven't gotten back around to the implementation

@github-actions github-actions bot removed the needs-update Needs status update from maintainers label Nov 3, 2024
Copy link

github-actions bot commented Jan 3, 2025

It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

@github-actions github-actions bot added the needs-update Needs status update from maintainers label Jan 3, 2025
@codejedi365
Copy link
Contributor

Still in backlog

@github-actions github-actions bot removed the needs-update Needs status update from maintainers label Jan 4, 2025
Copy link

github-actions bot commented Mar 5, 2025

It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

@github-actions github-actions bot added the needs-update Needs status update from maintainers label Mar 5, 2025
@codejedi365
Copy link
Contributor

Still in backlog

@github-actions github-actions bot removed the needs-update Needs status update from maintainers label Mar 6, 2025
Copy link

github-actions bot commented May 5, 2025

It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

@github-actions github-actions bot added the needs-update Needs status update from maintainers label May 5, 2025
@codejedi365
Copy link
Contributor

Still in backlog

@github-actions github-actions bot removed the needs-update Needs status update from maintainers label May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed Prevent from becoming stale feature A new feature or a feature request
Projects
None yet
Development

No branches or pull requests

2 participants