Skip to content

Commit

Permalink
Merge pull request #43 from cloudogu/feature/disable-yamllint
Browse files Browse the repository at this point in the history
disable yamllint and updating docs
  • Loading branch information
schnatterer authored Oct 9, 2024
2 parents 4a5e0fb + 7d5b802 commit 8046d36
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Disable yamllint image due to image is not longer maintained

## [0.6.0](https://github.com/cloudogu/gitops-build-lib/releases/tag/0.6.0) - 2024-08-26

### Changed
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,10 @@ class GitHub extends SCMProvider {
## Validators

The library itself provides three validators `yamllint`, `kubeval` and `helmKubeval` to validate the generated resources.
You can disable the built-in operators and/or add your own.
You can enable the built-in operators and/or add your own.
The operators are processed sequentially in no particular order.

Example: Disable all built-ins and add a custom validator.
Example: Enable `yamllint`, `kubeval` and add a custom validator.

```groovy
node {
Expand All @@ -787,10 +787,10 @@ node {
// ...
validators : [
yamllint: [
enabled : false,
enabled : enable,
],
kubeval: [
enabled : false,
enabled : enable,
],
myVali: [
validator: new MyValidator(this),
Expand Down
16 changes: 9 additions & 7 deletions test/com/cloudogu/gitopsbuildlib/DeployViaGitopsTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DeployViaGitopsTest extends BasePipelineTest {
validators : [
kubeval : [
validator: new Kubeval(deployViaGitops),
enabled : true,
enabled : false,
config : [
// We use the helm image (that also contains kubeval plugin) to speed up builds by allowing to reuse image
image : 'ghcr.io/cloudogu/helm:3.4.1-1',
Expand All @@ -68,7 +68,7 @@ class DeployViaGitopsTest extends BasePipelineTest {
],
yamllint: [
validator: new Yamllint(deployViaGitops),
enabled : true,
enabled : false,
config : [
image : 'cytopia/yamllint:1.25-0.9',
// Default to relaxed profile because it's feasible for mere mortalYAML programmers.
Expand Down Expand Up @@ -221,10 +221,10 @@ spec:


@Test
void 'default validator can be disabled'() {
void 'default validator can be enabled'() {

deployViaGitops.metaClass.validateConfig = { Map actualGitOpsConfig ->
assertThat(actualGitOpsConfig.validators.kubeval.enabled).isEqualTo(false)
assertThat(actualGitOpsConfig.validators.kubeval.enabled).isEqualTo(true)
assertThat(actualGitOpsConfig.validators.kubeval.validator).isNotNull()
assertThat(actualGitOpsConfig.validators.yamllint.enabled).isEqualTo(true)
}
Expand All @@ -233,7 +233,10 @@ spec:
deployViaGitops([
validators: [
kubeval: [
enabled: false
enabled: true
],
yamllint: [
enabled: true
]
]
])
Expand All @@ -244,8 +247,7 @@ spec:

deployViaGitops.metaClass.validateConfig = { Map actualGitOpsConfig ->
assertThat(actualGitOpsConfig.validators.myVali.config.a).isEqualTo('b')
assertThat(actualGitOpsConfig.validators.yamllint.enabled).isEqualTo(true)
assertThat(actualGitOpsConfig.validators.yamllint.enabled).isEqualTo(true)
assertThat(actualGitOpsConfig.validators.myVali.enabled).isEqualTo(true)
}
deployViaGitops.metaClass.deploy = {Map actualGitOpsConfig ->} // Stop after validation

Expand Down
3 changes: 2 additions & 1 deletion vars/deployViaGitops.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ Map createDefaultConfig(String k8sVersion) {
],
yamllint : [
validator: new Yamllint(this),
enabled : true,
//disabled due to image is not longer maintained
enabled : false,
config : [
imageRef : 'yamllint',
// Default to relaxed profile because it's feasible for mere mortalYAML programmers.
Expand Down

0 comments on commit 8046d36

Please sign in to comment.