Skip to content

Commit

Permalink
Cleanup workflow templates; require 'with' key in module's .sync.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
h-haaks committed May 5, 2024
1 parent f5a635b commit c5f3e04
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
2 changes: 0 additions & 2 deletions config_defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# yamllint disable rule:line-length
.github/workflows/ci.yml:
excludes: []
pidfile_workaround: false
additional_packages: ''
acceptance_tests: true
main_branches: ['main', 'master']
# PDK creates this
Expand Down
32 changes: 4 additions & 28 deletions moduleroot/.github/workflows/ci.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,18 @@ jobs:
name: Puppet
<%- if @configs['acceptance_tests'] && Dir[File.join(@metadata[:workdir], 'spec', 'acceptance', '**', '*_spec.rb')].any? -%>
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2
with:
pidfile_workaround: '<%= @configs['pidfile_workaround'] %>'
<%- if @configs['with'] -%>
with:
<%- @configs['with'].each do |k,v| -%>
<%= k %>: <%= v %>
<%- end -%>
<%- end -%>
<%- if @configs['unit_runs_on'] -%>
unit_runs_on: '<%= @configs['unit_runs_on'] %>'
<%- end -%>
<%- if @configs['beaker_facter'] -%>
beaker_facter: '<%= @configs['beaker_facter'] %>'
<%- end -%>
<%- if @configs['beaker_hypervisor'] -%>
beaker_hypervisor: '<%= @configs['beaker_hypervisor'] %>'
<%= k %>: '<%= v %>'
<%- end -%>
<%- if @configs['acceptance_runs_on'] -%>
acceptance_runs_on: '<%= @configs['acceptance_runs_on'] %>'
<%- end -%>
<%- else -%>
uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v2
<%- if @configs.key?('rubocop') || !@configs['additional_packages'].empty? || @configs.key?('unit_runs_on') || @configs.key?('with') -%>
with:
<%- end -%>
<%- if @configs['with'] -%>
with:
<%- @configs['with'].each do |k,v| -%>
<%= k %>: <%= v %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- unless @configs['additional_packages'].empty? -%>
additional_packages: '<%= @configs['additional_packages'] %>'
<%= k %>: '<%= v %>'
<%- end -%>
<%- if @configs.key?('rubocop') -%>
rubocop: <%= @configs['rubocop'] %>
<%- end -%>
<%- if Dir[File.join(@metadata[:workdir], 'spec', 'acceptance', '**', '*_spec.rb')].none? && @configs['unit_runs_on'] -%>
unit_runs_on: '<%= @configs['unit_runs_on'] %>'
<%- end -%>
4 changes: 3 additions & 1 deletion moduleroot/.github/workflows/release.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ jobs:
with:
<%- if @configs['with'] -%>
<%- @configs['with'].each do |k,v| -%>
<%= k %>: <%= v %>
<%= k %>: '<%= v %>'
<%- end -%>
<%- end -%>
<%- if @configs['with'].nil? || !@configs['with'].has_key?('allowed_owner') -%>
allowed_owner: '<%= @configs[:namespace] %>'
<%- end -%>
secrets:
# Configure secrets here:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
Expand Down

0 comments on commit c5f3e04

Please sign in to comment.