Skip to content
New issue

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

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

Already on GitHub? # to your account

add support for arbitrary with values for beaker.yml workflow #858

Closed
wants to merge 1 commit into from

Conversation

jhoblitt
Copy link
Member

@jhoblitt jhoblitt commented Oct 30, 2023

Example .sync.yml snippet:

.github/workflows/ci.yml:
   with:
     hosts: master,replica,client

Related to:

Example `.sync.yml` snippet:

    .github/workflows/ci.yml:
       with:
         hosts: master,replica,client
@@ -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

@h-haaks
Copy link
Contributor

h-haaks commented Apr 24, 2024

@jhoblitt #888 is now merged. Close this one?

@h-haaks
Copy link
Contributor

h-haaks commented Apr 25, 2024

I'm closing this. Please reopen it if needed :)

@h-haaks h-haaks closed this Apr 25, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants