66 - container prep
77 - sanity check
88 - build
9- - deploy
9+ - check
1010
1111# https://docs.gitlab.com/ee/ci/yaml/README.html#switch-between-branch-pipelines-and-merge-request-pipelines
1212# if a MR is opened: run a detached MR pipeline
@@ -81,13 +81,12 @@ build:
8181 - .fdo.distribution-image@alpine
8282 - .common_variables
8383 script :
84- # call make at root directory to do a 'fullbuild'
84+ - cd scripts
8585 - make
8686 artifacts :
8787 paths :
88- - info/RHMAINTAINERS
89- - info/CODEOWNERS
90- - info/owners.yaml
88+ - scripts/yaml2CODEOWNERS
89+ - scripts/yaml2RHMAINTAINERS
9190
9291.pages :
9392 stage : build
@@ -114,8 +113,6 @@ build:
114113 - public
115114
116115pages CI check :
117- # This stage, while still "deploying" a gitlab pages instance, does *not* run
118- # on the `main` branch.
119116 extends :
120117 - .pages
121118 before_script :
@@ -129,33 +126,40 @@ pages CI check:
129126 when : never
130127 - when : on_success
131128
132- deploy :
133- stage : deploy
134- dependencies :
135- - build
129+ check :
130+ stage : check
136131 extends :
137132 - .fdo.distribution-image@alpine
138133 - .common_variables
139134 script :
140- # we've already run 'make' and the artifacts are available.
141- # so just deploy code to main
142- - git config user.name "Gitlab Runner"
143- - git config user.email ""
144- - git fetch origin
145- - git add info/owners.yaml info/RHMAINTAINERS info/CODEOWNERS
146- # make it so that job will not fail if there is nothing to commit
147- - git diff-index --quiet HEAD || git commit -m "[Gitlab CI/CD] Automated rebuild of info/*"
148- - git push https://gitlab-ci-token:$MAKE_MAINT@gitlab.com/redhat/centos-stream/src/kernel/documentation.git HEAD:main
135+ # rebuild the current files
136+ - make
149137
150- rules :
151- - if : ' $CI_PROJECT_NAMESPACE == "redhat/centos-stream/src/kernel" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
152- - changes :
153- - info/owners.yaml
138+ # clean up cache
139+ - rm -f .failed
140+
141+ # check that the committed files matched
142+ - git diff --exit-code || touch .failed
143+ - |
144+ if [[ -e .failed ]]
145+ then
146+ echo '-----------------------------------------------------------------'
147+ echo ''
148+ echo ' Looks like the files scripts/CODEOWNERS or scripts/RHMAINTAINERS'
149+ echo ' have not been regenerated and checked in this commit.'
150+ echo ''
151+ echo ' Please run the following command before committing:'
152+ echo ' ./scripts/yaml2CODEOWNERS info/owners.yaml > info/CODEOWNERS'
153+ echo ' ./scripts/yaml2RHMAINTAINERS info/owners.yaml > info/RHMAINTAINERS'
154+ echo ''
155+ echo '-----------------------------------------------------------------'
156+ exit 1
157+ fi
154158
155159pages :
156160 extends :
157161 - .pages
158- stage : deploy
162+ stage : check
159163 rules :
160- - if : ' $CI_PROJECT_NAMESPACE == "redhat/centos-stream/src/kernel" && $ CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
161-
164+ - if : ' $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
165+ - when : never
0 commit comments