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 support for arbitrary with values for beaker.yml workflow #858

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions moduleroot/.github/workflows/ci.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
<%- if @configs['acceptance_tests'] && Dir[File.join(@metadata[:workdir], 'spec', 'acceptance', '**', '*_spec.rb')].any? -%>
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2
with:
<%- if @configs['with'] -%>
<%= @configs['with'].to_yaml.split("\n")[1..-1].join.gsub(/^/, ' ' * 6) %>
<%- end -%>
Copy link
Contributor

@h-haaks h-haaks Apr 22, 2024

Choose a reason for hiding this comment

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

I'm not very familiar with modulesync and this config, but if @configs['with'] is a hash why bother manipulating it as a multi line string and not just:

<%- if @configs['with'] -%>
<%- @configs['with'].each do |k,v| -%>
      <%= k %>: <%=  v %>
<%- end -%>
<%- end -%>

Copy link
Member Author

Choose a reason for hiding this comment

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

Because yaml is sensitive to indention.

Copy link
Contributor

@h-haaks h-haaks Apr 22, 2024

Choose a reason for hiding this comment

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

Is there a plan to refactor all .sync.yml files so that we in the end could end up with this being something like:

<%- if @configs['acceptance_tests'] && Dir[File.join(@metadata[:workdir], 'spec', 'acceptance', '**', '*_spec.rb')].any? -%>
    uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2
<%- else -%>
    uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v2
<%- end -%>
<%- if @configs['with'] -%>
    with:
<%- @configs['with'].each do |k,v| -%>
      <%= k %>: <%=  v %>
<%- end -%>
<%- end -%>

Copy link
Member Author

Choose a reason for hiding this comment

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

I think you volunteered...

Copy link
Member

Choose a reason for hiding this comment

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

@h-haaks send us a PR :) and we could also switch to json if that's easier. I don't mind it.

Copy link
Contributor

Choose a reason for hiding this comment

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

How do I actually test my changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

Created #887
I'll start working right away :)

Copy link
Member

Choose a reason for hiding this comment

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

If you spin up a PR against this repo it will do a noop msync to all repos as a CI job and print you the diff. And please run msync against our puppet-example repo and provide a real PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

See #888

pidfile_workaround: '<%= @configs['pidfile_workaround'] %>'
<%- if @configs['unit_runs_on'] -%>
unit_runs_on: '<%= @configs['unit_runs_on'] %>'
Expand Down