Skip to content
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

Automated release #665

Closed
wants to merge 3 commits into from
Closed

Conversation

benthomasson
Copy link
Contributor

@benthomasson benthomasson commented Feb 22, 2024

This PR creates an automated release process using github actions and an ansible rulebook.

This can also be run locally using this command:

ansible-playbook tools/ansible/release.yml -i localhost -e github_token=${GH_TOKEN}

An example release is here: https://github.com/ansible/ansible-rulebook/releases/tag/2024.2.22

@mkanoor
Copy link
Contributor

mkanoor commented Feb 22, 2024

@benthomasson Would this get published to PyPi at the end?

@benthomasson
Copy link
Contributor Author

benthomasson commented Feb 22, 2024

@benthomasson Would this get published to PyPi at the end?

Yes, we probably should. I'll do that in another PR.

@benthomasson benthomasson force-pushed the automated_release branch 4 times, most recently from 1914528 to 8370239 Compare February 26, 2024 15:40
@benthomasson benthomasson marked this pull request as ready for review February 26, 2024 15:43
@mkanoor
Copy link
Contributor

mkanoor commented Feb 26, 2024

@benthomasson Would switching from semver to calver have issues if there are users using versions in their requirements.txt files or Dockerfiles?

@benthomasson
Copy link
Contributor Author

@benthomasson Would switching from semver to calver have issues if there are users using versions in their requirements.txt files or Dockerfiles?

The calver will be greater than semver, so going that way won't be a problem.

@benthomasson benthomasson force-pushed the automated_release branch 2 times, most recently from a3fb312 to 67a4285 Compare March 4, 2024 14:27
Dostonbek1
Dostonbek1 previously approved these changes Mar 4, 2024
@mkanoor
Copy link
Contributor

mkanoor commented Mar 4, 2024

@benthomasson Should the release document that we are switching to CalVer?

@Alex-Izquierdo
Copy link
Contributor

The main goal of this automation is the automatic publication of the package in pypi. That step would be even more complicated with this pipeline, because with the current manual procedure we can generate the artifacts and publish them in pypi with the same command but now we should download the artifacts generated by this pipeline and publish them manually. I recommend to add that step before merge.

@benthomasson benthomasson force-pushed the automated_release branch 2 times, most recently from bd1d1a0 to f48b5a2 Compare March 6, 2024 18:45
@benthomasson
Copy link
Contributor Author

The main goal of this automation is the automatic publication of the package in pypi. That step would be even more complicated with this pipeline, because with the current manual procedure we can generate the artifacts and publish them in pypi with the same command but now we should download the artifacts generated by this pipeline and publish them manually. I recommend to add that step before merge.

We should not be building any released binary locally. It is very easy to slip in development files into a release build without realizing it if it is built locally.

@Alex-Izquierdo
Copy link
Contributor

We should not be building any released binary locally. It is very easy to slip in development files into a release build without realizing it if it is built locally.

The local build/publish is already handled by make: https://github.com/ansible/ansible-rulebook/blob/main/Makefile#L80

My point is that the publication on pypi is the main goal of an automated release process. Users usually won't consume the artifacts from github, they will run pip install ansible-rulebook as it is described in the documentation.

With the current process you only have to run make. Now, with this pipeline as it is now, I should have to go to github, download the artifacts generated and publish them in pypi, which is a more tedious process than make release

That's why I'm requesting to automate also the publication on pypi.

Copy link
Contributor

@Alex-Izquierdo Alex-Izquierdo left a comment

Choose a reason for hiding this comment

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

As it is now, the release could be done accidentally with the code of any branch. I think it would be good to ensure that only can be executed from the expected branches.


jobs:
stage:
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add if: github.repository == 'ansible/ansible-rulebook' to make clear this workflow is not intended to be executed by forks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't work on forks because it doesn't have permissions to push to this repo.

@Alex-Izquierdo
Copy link
Contributor

Alex-Izquierdo commented Mar 7, 2024

I think calver doesn't meet our requirements. We have to maintain multiple versions right now are two:
main and https://github.com/ansible/ansible-rulebook/tree/stable/1.0

Eventually we will have to maintain more versions. The calver itself doesn't tell you what is the branch. Everytime you need to check the releases for a given supported version you would have to inspect the tags per branch.

If a user wants the latest release of 1.0, we are forcing him to figure out first what is the tag and we prevent him to set rules like (<=1.0.*)

@benthomasson
Copy link
Contributor Author

benthomasson commented Mar 8, 2024

I think calver doesn't meet our requirements.

This is a valid concern. I am debating this myself. With semver we need to be able to bump the patch number every week to do automated weekly releases. That might make the patch number meaningless. https://semver.org/spec/v2.0.0.html. Semver 2.0 does support release candidates so that should be easier to automate.

@benthomasson benthomasson force-pushed the automated_release branch 5 times, most recently from b6600db to e7ac2f1 Compare March 8, 2024 21:31
@benthomasson benthomasson force-pushed the automated_release branch 6 times, most recently from 2d23c17 to 1589a54 Compare March 8, 2024 22:34
@benthomasson
Copy link
Contributor Author

I am closing this in favor of #667

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.

4 participants