Skip to content

Commit bf2c78e

Browse files
committed
Add a job to warn about modulesync changes
01cfc20 added headers, but this isn't really a good experience for users. It's actually much better to fail in CI if a diff is detected. That gives them also a way to verify their changes to .sync.yml are correct. This takes the approach of checking out the modulesync config with the version from .msync.yml and running a one off change in offline mode. Then it uses git diff to see if there are differences. That should fail the build and also show the actual differences, which makes debugging easier.
1 parent 8faa0b8 commit bf2c78e

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
# Managed by modulesync - DO NOT EDIT
3+
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
4+
5+
name: CI
6+
7+
on: pull_request
8+
9+
jobs:
10+
compare_with_repo:
11+
name: 'Setup Test Matrix'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Puppet module repository
15+
uses: actions/checkout@v2
16+
path: modules/${{ env.github_repository }}
17+
18+
- name: Setup ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: '3.0'
22+
23+
- name: Set modulesync version
24+
run: cat .msync.yml | ruby -ryaml -e 'puts "MSYNC_VER=#{YAML.load(STDIN)["modulesync_config_version"]}"' >> $GITHUB_ENV
25+
working-directory: modules/${{ env.github_repository }}
26+
27+
- name: Checkout modulesync configuration repository
28+
uses: actions/checkout@v2
29+
# TODO: is there a modulesync variable for this?
30+
repository: voxpupuli/modulesync_config
31+
ref: ${{ env.MSYNC_VER }}
32+
path: msync_config
33+
34+
- name: Create a temporary managed modules file
35+
run: echo "- $GITHUB_REPOSITORY" > msync_config/pr-managed-modules.yaml
36+
37+
- name: Setup ruby
38+
uses: ruby/setup-ruby@v1
39+
with:
40+
ruby-version: '3.0'
41+
bundler-cache: true
42+
path: msync_config
43+
44+
- name: Run modulesync
45+
run: bundle exec msync update --offline --managed-modules-conf=pr-managed-modules.yaml --project-root=../modules
46+
working-directory: msync_config
47+
48+
# TODO: does this actually fail the build?
49+
- name: Check for differences
50+
run: git diff
51+
working-directory: modules/${{ env.github_repository }}

0 commit comments

Comments
 (0)