Skip to content

Commit df34251

Browse files
authored
Merge branch 'main' into main
2 parents 990bb10 + 3db5e1a commit df34251

File tree

5 files changed

+128
-33
lines changed

5 files changed

+128
-33
lines changed

.github/workflows/docker-image.yml

Lines changed: 99 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,117 @@ on:
66

77
jobs:
88
build:
9-
runs-on: ubuntu-latest
9+
runs-on: ${{ matrix.runner }}
10+
strategy:
11+
matrix:
12+
include:
13+
- platform: amd64
14+
runner: ubuntu-latest
15+
- platform: arm64
16+
runner: ubuntu-24.04-arm
1017
steps:
1118
- name: Check out code
1219
uses: actions/checkout@v3
13-
- name: Build the Docker images
14-
if: startsWith(github.ref, 'refs/tags')
15-
run: |
16-
./containers/compile_dockerfile.sh
17-
docker build --no-cache -t quay.io/krkn-chaos/krkn containers/ --build-arg TAG=${GITHUB_REF#refs/tags/}
18-
docker tag quay.io/krkn-chaos/krkn quay.io/redhat-chaos/krkn
19-
docker tag quay.io/krkn-chaos/krkn quay.io/krkn-chaos/krkn:${GITHUB_REF#refs/tags/}
20-
docker tag quay.io/krkn-chaos/krkn quay.io/redhat-chaos/krkn:${GITHUB_REF#refs/tags/}
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
2123

2224
- name: Test Build the Docker images
23-
if: ${{ github.event_name == 'pull_request' }}
25+
if: github.event_name == 'pull_request'
2426
run: |
2527
./containers/compile_dockerfile.sh
26-
docker build --no-cache -t quay.io/krkn-chaos/krkn containers/ --build-arg PR_NUMBER=${{ github.event.pull_request.number }}
27-
- name: Login in quay
28+
docker buildx build --no-cache \
29+
--platform linux/${{ matrix.platform }} \
30+
-t quay.io/krkn-chaos/krkn \
31+
-t quay.io/redhat-chaos/krkn \
32+
containers/ \
33+
--build-arg PR_NUMBER=${{ github.event.pull_request.number }}
34+
35+
- name: Login to krkn-chaos quay
2836
if: startsWith(github.ref, 'refs/tags')
29-
run: docker login quay.io -u ${QUAY_USER} -p ${QUAY_TOKEN}
30-
env:
31-
QUAY_USER: ${{ secrets.QUAY_USERNAME }}
32-
QUAY_TOKEN: ${{ secrets.QUAY_PASSWORD }}
33-
- name: Push the KrknChaos Docker images
37+
uses: docker/login-action@v3
38+
with:
39+
registry: quay.io
40+
username: ${{ secrets.QUAY_USERNAME }}
41+
password: ${{ secrets.QUAY_PASSWORD }}
42+
43+
- name: Build and push krkn-chaos images
3444
if: startsWith(github.ref, 'refs/tags')
3545
run: |
36-
docker push quay.io/krkn-chaos/krkn
37-
docker push quay.io/krkn-chaos/krkn:${GITHUB_REF#refs/tags/}
38-
- name: Login in to redhat-chaos quay
39-
if: startsWith(github.ref, 'refs/tags/v')
40-
run: docker login quay.io -u ${QUAY_USER} -p ${QUAY_TOKEN}
41-
env:
42-
QUAY_USER: ${{ secrets.QUAY_USER_1 }}
43-
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN_1 }}
44-
- name: Push the RedHat Chaos Docker images
46+
./containers/compile_dockerfile.sh
47+
TAG=${GITHUB_REF#refs/tags/}
48+
docker buildx build --no-cache \
49+
--platform linux/${{ matrix.platform }} \
50+
--provenance=false \
51+
-t quay.io/krkn-chaos/krkn:latest-${{ matrix.platform }} \
52+
-t quay.io/krkn-chaos/krkn:${TAG}-${{ matrix.platform }} \
53+
containers/ \
54+
--build-arg TAG=${TAG} \
55+
--push --load
56+
57+
- name: Login to redhat-chaos quay
4558
if: startsWith(github.ref, 'refs/tags')
46-
run: |
47-
docker push quay.io/redhat-chaos/krkn
48-
docker push quay.io/redhat-chaos/krkn:${GITHUB_REF#refs/tags/}
49-
- name: Rebuild krkn-hub
59+
uses: docker/login-action@v3
60+
with:
61+
registry: quay.io
62+
username: ${{ secrets.QUAY_USER_1 }}
63+
password: ${{ secrets.QUAY_TOKEN_1 }}
64+
65+
- name: Push redhat-chaos images
5066
if: startsWith(github.ref, 'refs/tags')
67+
run: |
68+
TAG=${GITHUB_REF#refs/tags/}
69+
docker tag quay.io/krkn-chaos/krkn:${TAG}-${{ matrix.platform }} quay.io/redhat-chaos/krkn:${TAG}-${{ matrix.platform }}
70+
docker tag quay.io/krkn-chaos/krkn:${TAG}-${{ matrix.platform }} quay.io/redhat-chaos/krkn:latest-${{ matrix.platform }}
71+
docker push quay.io/redhat-chaos/krkn:${TAG}-${{ matrix.platform }}
72+
docker push quay.io/redhat-chaos/krkn:latest-${{ matrix.platform }}
73+
74+
manifest:
75+
runs-on: ubuntu-latest
76+
needs: build
77+
if: startsWith(github.ref, 'refs/tags')
78+
steps:
79+
- name: Login to krkn-chaos quay
80+
uses: docker/login-action@v3
81+
with:
82+
registry: quay.io
83+
username: ${{ secrets.QUAY_USERNAME }}
84+
password: ${{ secrets.QUAY_PASSWORD }}
85+
86+
- name: Create and push KrknChaos manifests
87+
run: |
88+
TAG=${GITHUB_REF#refs/tags/}
89+
docker manifest create quay.io/krkn-chaos/krkn:${TAG} \
90+
quay.io/krkn-chaos/krkn:${TAG}-amd64 \
91+
quay.io/krkn-chaos/krkn:${TAG}-arm64
92+
docker manifest push quay.io/krkn-chaos/krkn:${TAG}
93+
94+
docker manifest create quay.io/krkn-chaos/krkn:latest \
95+
quay.io/krkn-chaos/krkn:latest-amd64 \
96+
quay.io/krkn-chaos/krkn:latest-arm64
97+
docker manifest push quay.io/krkn-chaos/krkn:latest
98+
99+
- name: Login to redhat-chaos quay
100+
uses: docker/login-action@v3
101+
with:
102+
registry: quay.io
103+
username: ${{ secrets.QUAY_USER_1 }}
104+
password: ${{ secrets.QUAY_TOKEN_1 }}
105+
106+
- name: Create and push RedHat Chaos manifests
107+
run: |
108+
TAG=${GITHUB_REF#refs/tags/}
109+
docker manifest create quay.io/redhat-chaos/krkn:${TAG} \
110+
quay.io/redhat-chaos/krkn:${TAG}-amd64 \
111+
quay.io/redhat-chaos/krkn:${TAG}-arm64
112+
docker manifest push quay.io/redhat-chaos/krkn:${TAG}
113+
114+
docker manifest create quay.io/redhat-chaos/krkn:latest \
115+
quay.io/redhat-chaos/krkn:latest-amd64 \
116+
quay.io/redhat-chaos/krkn:latest-arm64
117+
docker manifest push quay.io/redhat-chaos/krkn:latest
118+
119+
- name: Rebuild krkn-hub
51120
uses: redhat-chaos/actions/krkn-hub@main
52121
with:
53122
QUAY_USER: ${{ secrets.QUAY_USERNAME }}

containers/krknctl-input.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,5 +558,31 @@
558558
"separator": ",",
559559
"default": "False",
560560
"required": "false"
561+
},
562+
{
563+
"name": "resiliency-score",
564+
"short_description": "Enable resiliency score calculation",
565+
"description": "The system outputs a detailed resiliency score as a single-line JSON object, facilitating easy aggregation across multiple test scenarios.",
566+
"variable": "RESILIENCY_SCORE",
567+
"type": "boolean",
568+
"required": "false"
569+
},
570+
{
571+
"name": "disable-resiliency-score",
572+
"short_description": "Disable resiliency score calculation",
573+
"description": "Disable resiliency score calculation",
574+
"variable": "DISABLE_RESILIENCY_SCORE",
575+
"type": "boolean",
576+
"required": "false"
577+
},
578+
{
579+
"name": "resiliency-file",
580+
"short_description": "Resiliency Score metrics file",
581+
"description": "Custom Resiliency score file",
582+
"variable": "RESILIENCY_FILE",
583+
"type": "file",
584+
"required": "false",
585+
"mount_path": "/home/krkn/resiliency-file.yaml"
561586
}
587+
562588
]

krkn/resiliency/resiliency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def finalize_and_save(
320320
)
321321
detailed = self.get_detailed_report()
322322

323-
if run_mode == "controller":
323+
if run_mode == "detailed":
324324
# krknctl expects the detailed report on stdout in a special format
325325
try:
326326
detailed_json = json.dumps(detailed)

scenarios/kube/cpu-hog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
duration: 60
1+
duration: 10
22
workers: '' # leave it empty '' node cpu auto-detection
33
hog-type: cpu
44
image: quay.io/krkn-chaos/krkn-hog

tests/test_resiliency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def test_finalize_and_save_controller_mode_prints_to_stdout(self, mock_eval_slos
597597
prom_cli=self.mock_prom,
598598
total_start_time=self.start,
599599
total_end_time=self.end,
600-
run_mode="controller",
600+
run_mode="detailed",
601601
)
602602

603603
mock_print.assert_called()

0 commit comments

Comments
 (0)