Skip to content

Commit c8e80f7

Browse files
committed
Adding YAML test files
adding yaml linting biz
1 parent 4279d5b commit c8e80f7

File tree

8 files changed

+118
-0
lines changed

8 files changed

+118
-0
lines changed

.travis.yml

+9
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ jobs:
6767
- travis_retry vale sync # pull down VRH rules package
6868
- chmod +x ./scripts/check-with-vale.sh
6969
- ./scripts/check-with-vale.sh
70+
- stage: check-yaml
71+
if: type IN (pull_request)
72+
name: "Run yamllint against PR YAML files"
73+
before_script:
74+
- travis_retry sudo apt-get install yamllint
75+
script:
76+
- chmod +x ./scripts/lint-yaml.sh
77+
- ./scripts/lint-yaml.sh
7078
# Commenting out to disable auto-merging of PRs
7179
# - stage: automerge
7280
# if: env(PR_AUTHOR)=openshift-cherrypick-robot
@@ -83,4 +91,5 @@ stages:
8391
- build
8492
- netlify
8593
- check-with-vale
94+
- check-yaml
8695
#- automerge

modules/yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../yaml

modules/yaml-test.adoc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * scalability_and_performance/cnf-create-performance-profiles.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="REPLACE_ME_WITH_ID_{context}"]
7+
= Included YAML example
8+
9+
Have a look at this YAML.
10+
11+
[source,yaml]
12+
----
13+
include::yaml/install-config.yaml[]
14+
----
15+
<1> Instance type, for example, `m5d.2xlarge`.
16+
<2> Pull secret
17+
<3> SSH key

scalability_and_performance/cnf-create-performance-profiles.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ toc::[]
88

99
Learn about the Performance Profile Creator (PPC) and how you can use it to create a performance profile.
1010

11+
include::modules/yaml-test.adoc[leveloffset=+1]
12+
1113
include::modules/cnf-about-the-profile-creator-tool.adoc[leveloffset=+1]
1214

1315
include::modules/cnf-gathering-data-about-cluster-using-must-gather.adoc[leveloffset=+2]

scalability_and_performance/yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../yaml

scripts/lint-yaml.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Use yamllint to lint and report errors for modified YAML files in repo
4+
# $ ./lint-yaml.sh
5+
6+
set -e
7+
8+
if [ -z "$(which yamllint)" ]; then
9+
echo "yamllint not found" >&2
10+
fi
11+
12+
RESULT=0
13+
14+
INPUT=$1
15+
16+
YAMLLINT_PARAMS="{extends: relaxed, rules: {line-length: disable, indentation: disable, colons: {max-spaces-before: 0, max-spaces-after: 1}, empty-lines: enable, trailing-spaces: {}, truthy: {}, new-line-at-end-of-file: disable }}"
17+
18+
# list of modified ./yaml/*.yaml files
19+
FILES=$(git diff --name-only HEAD~1 HEAD --diff-filter=d "./yaml/*.yaml")
20+
21+
for FILE in "$FILES"; do
22+
if ! yamllint -d "$YAMLLINT_PARAMS" $FILE; then
23+
RESULT=1
24+
exit ${RESULT}
25+
elif [ "$RESULT" -eq 0 ]; then
26+
echo "No YAML errors found."
27+
fi
28+
done

yaml/install-config.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
additionalTrustBundlePolicy: Proxyonly
2+
apiVersion: v1
3+
baseDomain: devcluster.openshift.com
4+
compute:
5+
- architecture: amd64
6+
hyperthreading: Enabled
7+
name: worker
8+
platform:
9+
aws:
10+
rootVolume:
11+
size: 120
12+
type: m5d.2xlarge #<1>
13+
replicas: 0
14+
controlPlane:
15+
architecture: amd64
16+
hyperthreading: Enabled
17+
name: master
18+
platform:
19+
aws:
20+
rootVolume:
21+
size: 120
22+
type: m5d.2xlarge
23+
replicas: 1
24+
metadata:
25+
creationTimestamp: null
26+
name: 241122-aireilly
27+
networking:
28+
clusterNetwork:
29+
- cidr: 10.128.0.0/14
30+
hostPrefix: 23
31+
machineNetwork:
32+
- cidr: 10.0.0.0/16
33+
networkType: OVNKubernetes
34+
serviceNetwork:
35+
- 172.30.0.0/16
36+
platform:
37+
aws:
38+
region: us-east-1
39+
publish: External
40+
pullSecret: '<pull_secret>' #<2>
41+
sshKey: |
42+
<ssh_key> #<3>

yaml/machine-config.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: machineconfiguration.openshift.io/v1
2+
kind: MachineConfigPool
3+
metadata:
4+
name: worker-rt
5+
labels:
6+
machineconfiguration.openshift.io/role: worker-rt
7+
spec:
8+
machineConfigSelector:
9+
matchExpressions:
10+
- {
11+
key: machineconfiguration.openshift.io/role,
12+
operator: In,
13+
values: [worker, worker-rt],
14+
}
15+
paused: false
16+
nodeSelector:
17+
matchLabels:
18+
node-role.kubernetes.io/worker-rt: ""

0 commit comments

Comments
 (0)