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 Candlepin branch procedure #375

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

ehelms
Copy link
Member

@ehelms ehelms commented Jun 3, 2024

No description provided.

@ehelms ehelms marked this pull request as ready for review June 13, 2024 14:44
procedures/candlepin/branch.md.erb Outdated Show resolved Hide resolved
procedures/candlepin/release.md.erb Outdated Show resolved Hide resolved
- [ ] VERSION=<%= release %> PROJECT=candlepin <%= rel_eng_script('generate_stage_repository') %>
- [ ] VERSION=<%= release %> PROJECT=candlepin <%= rel_eng_script('sign_stage_rpms') %>
- [ ] VERSION=<%= release %> PROJECT=candlepin <%= rel_eng_script('upload_stage_rpms') %>
- [ ] [Run release pipeline](https://ci.theforeman.org/job/candlepin-<%= release %>-rpm-pipeline/)
Copy link
Member

Choose a reason for hiding this comment

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

Should this be

Suggested change
- [ ] [Run release pipeline](https://ci.theforeman.org/job/candlepin-<%= release %>-rpm-pipeline/)
- [ ] Kick off the [release pipeline](https://ci.theforeman.org/job/candlepin-<%= release %>-rpm-pipeline/) by calling <%= rel_eng_script('release_pipeline') %>

(requires a tiny adjustment in ci-jobs script to know how to call candlepin pipes)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

We'll need to modify the procedure script:

$ ./procedure branch --project candlepin
./procedure:136:in `<main>': invalid argument: --project candlepin (OptionParser::InvalidArgument)

I ended up writing this patch

diff --git a/procedure b/procedure
index c86881f42ca5..c5c7eaa8b88e 100755
--- a/procedure
+++ b/procedure
@@ -59,9 +59,9 @@ global = OptionParser.new do |opts|
 end
 procedures = {
 	'branch' => OptionParser.new do |opts|
-    opts.banner = "Usage: #{opts.program_name} branch --project [foreman|katello] --release [X.Y] --target-date [YYYY-MM-DD] --owner [OWNER] [--engineer [ENGINEER]]"
+    opts.banner = "Usage: #{opts.program_name} branch --project [foreman|katello|candlepin] --release [X.Y] --target-date [YYYY-MM-DD] --owner [OWNER] [--engineer [ENGINEER]]"
 
-    opts.on('--project [PROJECT]', ['foreman', 'katello'],
+    opts.on('--project [PROJECT]', ['foreman', 'katello', 'candlepin'],
             'Project to generate branch procedure for') do |t|
       context[:project] = t
     end
@@ -129,13 +129,26 @@ procedures = {
 	end
 }
 
+def missing_required_option?(procedure, context)
+  case context[:project]
+  when 'candlepin'
+    context[:release].nil?
+  when 'katello'
+    context[:target_date].nil? || context[:owner].nil? || (procedure == 'release' && context[:foreman_version].nil?)
+  when 'foreman'
+    context[:target_date].nil? || context[:owner].nil?
+  else
+    true
+  end
+end
+
 global.order!
 procedure = ARGV.shift
 if procedures.key?(procedure)
   command = procedures[procedure]
   command.order!
 
-  unless context[:project] && context[:target_date] && context[:owner] && (context[:project] != 'katello' || procedure != 'release' || context[:foreman_version])
+  if missing_required_option?(procedure, context)
     STDERR.puts command.help
     exit 1
   end

procedures/candlepin/branch.md.erb Outdated Show resolved Hide resolved
procedures/candlepin/branch.md.erb Outdated Show resolved Hide resolved
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Please include my suggested changes to the procedure script.

@ehelms
Copy link
Member Author

ehelms commented Jul 31, 2024

Updated

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I ended up creating ehelms#1 with my comments. If you merge theforeman/jenkins-jobs#484 and that PR I think my concerns are addressed.

procedures/candlepin/branch.md.erb Outdated Show resolved Hide resolved
procedures/candlepin/branch.md.erb Outdated Show resolved Hide resolved
procedures/candlepin/branch.md.erb Outdated Show resolved Hide resolved
This reuses the existing branch_project and branch_push scripts to
handle candlepin-packaging's branching. branch_project is modified to
update package_manifest.yaml as well as some setting files.

For CI it uses the branch-candlepin script inside the repository while
also using the release_pipeline script to kick off Jenkins.
@ekohl ekohl merged commit ebfe219 into theforeman:master Aug 2, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants