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

Add ability to update ci_update_branches from create-branch workflow #767

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

gerrod3
Copy link
Contributor

@gerrod3 gerrod3 commented Jul 12, 2023

Decided to add this functionality to the plugin-template script and have the create-branch workflow call with the new options if specified at dispatch time. Here is how the new dispatch screen looks:

Screenshot from 2023-07-12 01-31-28

Plugins have different behavior from pulpcore, some don't even set this variable, so I added three different options to cover each scenario.

EDIT
Changed it to a new template_config variable: ci_update_release_behavior.

Comment on lines 16 to 24
update_ci_branches:
description: "Behavior for updating ci_update_branches"
required: true
type: choice
default: "none"
options:
- "append-version"
- "replace-previous-version"
- "none"
Copy link
Member

Choose a reason for hiding this comment

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

Interesting idea, but i wonder if we should make this choice in the template-config. Giving the user choice usually leads to confusion.
I suspect we will hear: "Did you not select this option? We always do. Now I need to do it by hand."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like another variable to decide the behavior? I was also thinking of just having the default be different for pulpcore, have it be set to replace-previous-version instead of none since this is the behavior we've decided on for our release policy.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think pulpcore is special per se. Just as you said: Some plugins may not want to do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you suggest then? Switch it to a template-config variable?

@dkliban
Copy link
Member

dkliban commented Jul 12, 2023

Let's make this a template_config variable.

@gerrod3 gerrod3 force-pushed the update-ci-branches branch 2 times, most recently from 89d58fb to 4c66c94 Compare July 14, 2023 17:23
@gerrod3 gerrod3 marked this pull request as ready for review July 18, 2023 20:35
plugin-template Outdated Show resolved Hide resolved
@@ -217,6 +218,28 @@ def main():
"""
),
)
parser.add_argument(
"--add-version-ci-update-branches",
Copy link
Member

Choose a reason for hiding this comment

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

Not sure, the other one is actually more descriptive...

Suggested change
"--add-version-ci-update-branches",
"--add-ci-branch",

So am i understanding correctly that this is another option like --github or --docs that specifies what parts of the plugin to change? I guess, it implies --github?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The option only modifies the variable in the config file, you have to use --github in order to update the templated files.

Copy link
Member

Choose a reason for hiding this comment

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

So yes in a way that it implies you also want to specify --github. XD

plugin-template Outdated
Comment on lines 304 to 306
if args.replace_previous_version_ci_update_branches:
major_v, minor_v = new_version_branch.split(".", maxsplit=1)
minor_v = int(minor_v) - 1
try:
index = config["ci_update_branches"].index(f"{major_v}.{minor_v}")
except ValueError:
config["ci_update_branches"].append(new_version_branch)
else:
config["ci_update_branches"][index] = new_version_branch
else:
config["ci_update_branches"].append(new_version_branch)
Copy link
Member

Choose a reason for hiding this comment

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

So we are assuming here, that a new major version will never replace the last version.
This sounds fine to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think I understand your statement. We will only replace the previous (V - 1) version from the list if --replace_previous_version_ci_update_branches is set. If we can't find that previous version then we will just append the new version to the end of the list.

Copy link
Member

Choose a reason for hiding this comment

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

Replacing only works for 2.1 -> 2.2. If we released 2.1 -> 3.0 we would still keep 2.1 in the list. And that's probably fine because OTOH it's very rare, OTOH it's probably wise to support the last y of the previous x for a bit longer.

plugin-template Outdated Show resolved Hide resolved
templates/github/.github/workflows/create-branch.yml.j2 Outdated Show resolved Hide resolved
@gerrod3 gerrod3 force-pushed the update-ci-branches branch 2 times, most recently from b04c819 to e8eeba5 Compare August 12, 2023 19:30
@mdellweg mdellweg merged commit 9cfc63e into pulp:main Aug 14, 2023
16 checks passed
@gerrod3 gerrod3 deleted the update-ci-branches branch August 14, 2023 13:14
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.

3 participants